config.guess revision c4f7863a
19bd41f2cSmrg#! /bin/sh
29bd41f2cSmrg# Attempt to guess a canonical system name.
39bd41f2cSmrg#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4c4f7863aSmrg#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
59418810dSmrg#   Free Software Foundation, Inc.
69bd41f2cSmrg
7c4f7863aSmrgtimestamp='2008-11-15'
89bd41f2cSmrg
99bd41f2cSmrg# This file is free software; you can redistribute it and/or modify it
109bd41f2cSmrg# under the terms of the GNU General Public License as published by
119bd41f2cSmrg# the Free Software Foundation; either version 2 of the License, or
129bd41f2cSmrg# (at your option) any later version.
139bd41f2cSmrg#
149bd41f2cSmrg# This program is distributed in the hope that it will be useful, but
159bd41f2cSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
169bd41f2cSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
179bd41f2cSmrg# General Public License for more details.
189bd41f2cSmrg#
199bd41f2cSmrg# You should have received a copy of the GNU General Public License
209bd41f2cSmrg# along with this program; if not, write to the Free Software
219bd41f2cSmrg# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
229bd41f2cSmrg# 02110-1301, USA.
239bd41f2cSmrg#
249bd41f2cSmrg# As a special exception to the GNU General Public License, if you
259bd41f2cSmrg# distribute this file as part of a program that contains a
269bd41f2cSmrg# configuration script generated by Autoconf, you may include it under
279bd41f2cSmrg# the same distribution terms that you use for the rest of that program.
289bd41f2cSmrg
299bd41f2cSmrg
30c4f7863aSmrg# Originally written by Per Bothner <per@bothner.com>.
31c4f7863aSmrg# Please send patches to <config-patches@gnu.org>.  Submit a context
32c4f7863aSmrg# diff and a properly formatted ChangeLog entry.
339bd41f2cSmrg#
349bd41f2cSmrg# This script attempts to guess a canonical system name similar to
359bd41f2cSmrg# config.sub.  If it succeeds, it prints the system name on stdout, and
369bd41f2cSmrg# exits with 0.  Otherwise, it exits with 1.
379bd41f2cSmrg#
38c4f7863aSmrg# The plan is that this can be called by configure scripts if you
39c4f7863aSmrg# don't specify an explicit build system type.
409bd41f2cSmrg
419bd41f2cSmrgme=`echo "$0" | sed -e 's,.*/,,'`
429bd41f2cSmrg
439bd41f2cSmrgusage="\
449bd41f2cSmrgUsage: $0 [OPTION]
459bd41f2cSmrg
469bd41f2cSmrgOutput the configuration name of the system \`$me' is run on.
479bd41f2cSmrg
489bd41f2cSmrgOperation modes:
499bd41f2cSmrg  -h, --help         print this help, then exit
509bd41f2cSmrg  -t, --time-stamp   print date of last modification, then exit
519bd41f2cSmrg  -v, --version      print version number, then exit
529bd41f2cSmrg
539bd41f2cSmrgReport bugs and patches to <config-patches@gnu.org>."
549bd41f2cSmrg
559bd41f2cSmrgversion="\
569bd41f2cSmrgGNU config.guess ($timestamp)
579bd41f2cSmrg
589bd41f2cSmrgOriginally written by Per Bothner.
599418810dSmrgCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
609418810dSmrg2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
619bd41f2cSmrg
629bd41f2cSmrgThis is free software; see the source for copying conditions.  There is NO
639bd41f2cSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
649bd41f2cSmrg
659bd41f2cSmrghelp="
669bd41f2cSmrgTry \`$me --help' for more information."
679bd41f2cSmrg
689bd41f2cSmrg# Parse command line
699bd41f2cSmrgwhile test $# -gt 0 ; do
709bd41f2cSmrg  case $1 in
719bd41f2cSmrg    --time-stamp | --time* | -t )
729bd41f2cSmrg       echo "$timestamp" ; exit ;;
739bd41f2cSmrg    --version | -v )
749bd41f2cSmrg       echo "$version" ; exit ;;
759bd41f2cSmrg    --help | --h* | -h )
769bd41f2cSmrg       echo "$usage"; exit ;;
779bd41f2cSmrg    -- )     # Stop option processing
789bd41f2cSmrg       shift; break ;;
799bd41f2cSmrg    - )	# Use stdin as input.
809bd41f2cSmrg       break ;;
819bd41f2cSmrg    -* )
829bd41f2cSmrg       echo "$me: invalid option $1$help" >&2
839bd41f2cSmrg       exit 1 ;;
849bd41f2cSmrg    * )
859bd41f2cSmrg       break ;;
869bd41f2cSmrg  esac
879bd41f2cSmrgdone
889bd41f2cSmrg
899bd41f2cSmrgif test $# != 0; then
909bd41f2cSmrg  echo "$me: too many arguments$help" >&2
919bd41f2cSmrg  exit 1
929bd41f2cSmrgfi
939bd41f2cSmrg
949bd41f2cSmrgtrap 'exit 1' 1 2 15
959bd41f2cSmrg
969bd41f2cSmrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
979bd41f2cSmrg# compiler to aid in system detection is discouraged as it requires
989bd41f2cSmrg# temporary files to be created and, as you can see below, it is a
999bd41f2cSmrg# headache to deal with in a portable fashion.
1009bd41f2cSmrg
1019bd41f2cSmrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
1029bd41f2cSmrg# use `HOST_CC' if defined, but it is deprecated.
1039bd41f2cSmrg
1049bd41f2cSmrg# Portable tmp directory creation inspired by the Autoconf team.
1059bd41f2cSmrg
1069bd41f2cSmrgset_cc_for_build='
1079bd41f2cSmrgtrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
1089bd41f2cSmrgtrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
1099bd41f2cSmrg: ${TMPDIR=/tmp} ;
1109418810dSmrg { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
1119bd41f2cSmrg { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
1129bd41f2cSmrg { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
1139bd41f2cSmrg { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
1149bd41f2cSmrgdummy=$tmp/dummy ;
1159bd41f2cSmrgtmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
1169bd41f2cSmrgcase $CC_FOR_BUILD,$HOST_CC,$CC in
1179bd41f2cSmrg ,,)    echo "int x;" > $dummy.c ;
1189bd41f2cSmrg	for c in cc gcc c89 c99 ; do
1199bd41f2cSmrg	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
1209bd41f2cSmrg	     CC_FOR_BUILD="$c"; break ;
1219bd41f2cSmrg	  fi ;
1229bd41f2cSmrg	done ;
1239bd41f2cSmrg	if test x"$CC_FOR_BUILD" = x ; then
1249bd41f2cSmrg	  CC_FOR_BUILD=no_compiler_found ;
1259bd41f2cSmrg	fi
1269bd41f2cSmrg	;;
1279bd41f2cSmrg ,,*)   CC_FOR_BUILD=$CC ;;
1289bd41f2cSmrg ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
1299bd41f2cSmrgesac ; set_cc_for_build= ;'
1309bd41f2cSmrg
1319bd41f2cSmrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1329bd41f2cSmrg# (ghazi@noc.rutgers.edu 1994-08-24)
1339bd41f2cSmrgif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
1349bd41f2cSmrg	PATH=$PATH:/.attbin ; export PATH
1359bd41f2cSmrgfi
1369bd41f2cSmrg
1379bd41f2cSmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1389bd41f2cSmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1399bd41f2cSmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
1409bd41f2cSmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1419bd41f2cSmrg
1429bd41f2cSmrg# Note: order is significant - the case branches are not exclusive.
1439bd41f2cSmrg
1449bd41f2cSmrgcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
1459bd41f2cSmrg    *:NetBSD:*:*)
1469bd41f2cSmrg	# NetBSD (nbsd) targets should (where applicable) match one or
1479bd41f2cSmrg	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
1489bd41f2cSmrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
1499bd41f2cSmrg	# switched to ELF, *-*-netbsd* would select the old
1509bd41f2cSmrg	# object file format.  This provides both forward
1519bd41f2cSmrg	# compatibility and a consistent mechanism for selecting the
1529bd41f2cSmrg	# object file format.
1539bd41f2cSmrg	#
1549bd41f2cSmrg	# Note: NetBSD doesn't particularly care about the vendor
1559bd41f2cSmrg	# portion of the name.  We always set it to "unknown".
1569bd41f2cSmrg	sysctl="sysctl -n hw.machine_arch"
1579bd41f2cSmrg	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
1589bd41f2cSmrg	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
1599bd41f2cSmrg	case "${UNAME_MACHINE_ARCH}" in
1609bd41f2cSmrg	    armeb) machine=armeb-unknown ;;
1619bd41f2cSmrg	    arm*) machine=arm-unknown ;;
1629bd41f2cSmrg	    sh3el) machine=shl-unknown ;;
1639bd41f2cSmrg	    sh3eb) machine=sh-unknown ;;
1649418810dSmrg	    sh5el) machine=sh5le-unknown ;;
1659bd41f2cSmrg	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
1669bd41f2cSmrg	esac
1679bd41f2cSmrg	# The Operating System including object format, if it has switched
1689bd41f2cSmrg	# to ELF recently, or will in the future.
1699bd41f2cSmrg	case "${UNAME_MACHINE_ARCH}" in
1709bd41f2cSmrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
1719bd41f2cSmrg		eval $set_cc_for_build
1729bd41f2cSmrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
173c4f7863aSmrg			| grep __ELF__ >/dev/null
1749bd41f2cSmrg		then
1759bd41f2cSmrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
1769bd41f2cSmrg		    # Return netbsd for either.  FIX?
1779bd41f2cSmrg		    os=netbsd
1789bd41f2cSmrg		else
1799bd41f2cSmrg		    os=netbsdelf
1809bd41f2cSmrg		fi
1819bd41f2cSmrg		;;
1829bd41f2cSmrg	    *)
1839bd41f2cSmrg	        os=netbsd
1849bd41f2cSmrg		;;
1859bd41f2cSmrg	esac
1869bd41f2cSmrg	# The OS release
1879bd41f2cSmrg	# Debian GNU/NetBSD machines have a different userland, and
1889bd41f2cSmrg	# thus, need a distinct triplet. However, they do not need
1899bd41f2cSmrg	# kernel version information, so it can be replaced with a
1909bd41f2cSmrg	# suitable tag, in the style of linux-gnu.
1919bd41f2cSmrg	case "${UNAME_VERSION}" in
1929bd41f2cSmrg	    Debian*)
1939bd41f2cSmrg		release='-gnu'
1949bd41f2cSmrg		;;
1959bd41f2cSmrg	    *)
1969bd41f2cSmrg		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
1979bd41f2cSmrg		;;
1989bd41f2cSmrg	esac
1999bd41f2cSmrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2009bd41f2cSmrg	# contains redundant information, the shorter form:
2019bd41f2cSmrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
2029bd41f2cSmrg	echo "${machine}-${os}${release}"
2039bd41f2cSmrg	exit ;;
2049bd41f2cSmrg    *:OpenBSD:*:*)
2059bd41f2cSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
2069bd41f2cSmrg	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
2079bd41f2cSmrg	exit ;;
2089bd41f2cSmrg    *:ekkoBSD:*:*)
2099bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
2109bd41f2cSmrg	exit ;;
2119418810dSmrg    *:SolidBSD:*:*)
2129418810dSmrg	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
2139418810dSmrg	exit ;;
2149bd41f2cSmrg    macppc:MirBSD:*:*)
2159418810dSmrg	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
2169bd41f2cSmrg	exit ;;
2179bd41f2cSmrg    *:MirBSD:*:*)
2189bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
2199bd41f2cSmrg	exit ;;
2209bd41f2cSmrg    alpha:OSF1:*:*)
2219bd41f2cSmrg	case $UNAME_RELEASE in
2229bd41f2cSmrg	*4.0)
2239bd41f2cSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
2249bd41f2cSmrg		;;
2259bd41f2cSmrg	*5.*)
2269bd41f2cSmrg	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
2279bd41f2cSmrg		;;
2289bd41f2cSmrg	esac
2299bd41f2cSmrg	# According to Compaq, /usr/sbin/psrinfo has been available on
2309bd41f2cSmrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
2319bd41f2cSmrg	# covers most systems running today.  This code pipes the CPU
2329bd41f2cSmrg	# types through head -n 1, so we only detect the type of CPU 0.
2339bd41f2cSmrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
2349bd41f2cSmrg	case "$ALPHA_CPU_TYPE" in
2359bd41f2cSmrg	    "EV4 (21064)")
2369bd41f2cSmrg		UNAME_MACHINE="alpha" ;;
2379bd41f2cSmrg	    "EV4.5 (21064)")
2389bd41f2cSmrg		UNAME_MACHINE="alpha" ;;
2399bd41f2cSmrg	    "LCA4 (21066/21068)")
2409bd41f2cSmrg		UNAME_MACHINE="alpha" ;;
2419bd41f2cSmrg	    "EV5 (21164)")
2429bd41f2cSmrg		UNAME_MACHINE="alphaev5" ;;
2439bd41f2cSmrg	    "EV5.6 (21164A)")
2449bd41f2cSmrg		UNAME_MACHINE="alphaev56" ;;
2459bd41f2cSmrg	    "EV5.6 (21164PC)")
2469bd41f2cSmrg		UNAME_MACHINE="alphapca56" ;;
2479bd41f2cSmrg	    "EV5.7 (21164PC)")
2489bd41f2cSmrg		UNAME_MACHINE="alphapca57" ;;
2499bd41f2cSmrg	    "EV6 (21264)")
2509bd41f2cSmrg		UNAME_MACHINE="alphaev6" ;;
2519bd41f2cSmrg	    "EV6.7 (21264A)")
2529bd41f2cSmrg		UNAME_MACHINE="alphaev67" ;;
2539bd41f2cSmrg	    "EV6.8CB (21264C)")
2549bd41f2cSmrg		UNAME_MACHINE="alphaev68" ;;
2559bd41f2cSmrg	    "EV6.8AL (21264B)")
2569bd41f2cSmrg		UNAME_MACHINE="alphaev68" ;;
2579bd41f2cSmrg	    "EV6.8CX (21264D)")
2589bd41f2cSmrg		UNAME_MACHINE="alphaev68" ;;
2599bd41f2cSmrg	    "EV6.9A (21264/EV69A)")
2609bd41f2cSmrg		UNAME_MACHINE="alphaev69" ;;
2619bd41f2cSmrg	    "EV7 (21364)")
2629bd41f2cSmrg		UNAME_MACHINE="alphaev7" ;;
2639bd41f2cSmrg	    "EV7.9 (21364A)")
2649bd41f2cSmrg		UNAME_MACHINE="alphaev79" ;;
2659bd41f2cSmrg	esac
2669bd41f2cSmrg	# A Pn.n version is a patched version.
2679bd41f2cSmrg	# A Vn.n version is a released version.
2689bd41f2cSmrg	# A Tn.n version is a released field test version.
2699bd41f2cSmrg	# A Xn.n version is an unreleased experimental baselevel.
2709bd41f2cSmrg	# 1.2 uses "1.2" for uname -r.
2719bd41f2cSmrg	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
2729bd41f2cSmrg	exit ;;
2739bd41f2cSmrg    Alpha\ *:Windows_NT*:*)
2749bd41f2cSmrg	# How do we know it's Interix rather than the generic POSIX subsystem?
2759bd41f2cSmrg	# Should we change UNAME_MACHINE based on the output of uname instead
2769bd41f2cSmrg	# of the specific Alpha model?
2779bd41f2cSmrg	echo alpha-pc-interix
2789bd41f2cSmrg	exit ;;
2799bd41f2cSmrg    21064:Windows_NT:50:3)
2809bd41f2cSmrg	echo alpha-dec-winnt3.5
2819bd41f2cSmrg	exit ;;
2829bd41f2cSmrg    Amiga*:UNIX_System_V:4.0:*)
2839bd41f2cSmrg	echo m68k-unknown-sysv4
2849bd41f2cSmrg	exit ;;
2859bd41f2cSmrg    *:[Aa]miga[Oo][Ss]:*:*)
2869bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-amigaos
2879bd41f2cSmrg	exit ;;
2889bd41f2cSmrg    *:[Mm]orph[Oo][Ss]:*:*)
2899bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-morphos
2909bd41f2cSmrg	exit ;;
2919bd41f2cSmrg    *:OS/390:*:*)
2929bd41f2cSmrg	echo i370-ibm-openedition
2939bd41f2cSmrg	exit ;;
2949bd41f2cSmrg    *:z/VM:*:*)
2959bd41f2cSmrg	echo s390-ibm-zvmoe
2969bd41f2cSmrg	exit ;;
2979bd41f2cSmrg    *:OS400:*:*)
2989bd41f2cSmrg        echo powerpc-ibm-os400
2999bd41f2cSmrg	exit ;;
3009bd41f2cSmrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
3019bd41f2cSmrg	echo arm-acorn-riscix${UNAME_RELEASE}
3029bd41f2cSmrg	exit ;;
3039bd41f2cSmrg    arm:riscos:*:*|arm:RISCOS:*:*)
3049bd41f2cSmrg	echo arm-unknown-riscos
3059bd41f2cSmrg	exit ;;
3069bd41f2cSmrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
3079bd41f2cSmrg	echo hppa1.1-hitachi-hiuxmpp
3089bd41f2cSmrg	exit ;;
3099bd41f2cSmrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
3109bd41f2cSmrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
3119bd41f2cSmrg	if test "`(/bin/universe) 2>/dev/null`" = att ; then
3129bd41f2cSmrg		echo pyramid-pyramid-sysv3
3139bd41f2cSmrg	else
3149bd41f2cSmrg		echo pyramid-pyramid-bsd
3159bd41f2cSmrg	fi
3169bd41f2cSmrg	exit ;;
3179bd41f2cSmrg    NILE*:*:*:dcosx)
3189bd41f2cSmrg	echo pyramid-pyramid-svr4
3199bd41f2cSmrg	exit ;;
3209bd41f2cSmrg    DRS?6000:unix:4.0:6*)
3219bd41f2cSmrg	echo sparc-icl-nx6
3229bd41f2cSmrg	exit ;;
3239bd41f2cSmrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
3249bd41f2cSmrg	case `/usr/bin/uname -p` in
3259bd41f2cSmrg	    sparc) echo sparc-icl-nx7; exit ;;
3269bd41f2cSmrg	esac ;;
3279bd41f2cSmrg    sun4H:SunOS:5.*:*)
3289bd41f2cSmrg	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3299bd41f2cSmrg	exit ;;
3309bd41f2cSmrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
3319bd41f2cSmrg	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3329bd41f2cSmrg	exit ;;
3339418810dSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
3349418810dSmrg	eval $set_cc_for_build
3359418810dSmrg	SUN_ARCH="i386"
3369418810dSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
3379418810dSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
3389418810dSmrg	# This test works for both compilers.
3399418810dSmrg	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
340c4f7863aSmrg	    if echo '\n#ifdef __amd64\nIS_64BIT_ARCH\n#endif' | \
3419418810dSmrg		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
3429418810dSmrg		grep IS_64BIT_ARCH >/dev/null
3439418810dSmrg	    then
3449418810dSmrg		SUN_ARCH="x86_64"
3459418810dSmrg	    fi
3469418810dSmrg	fi
3479418810dSmrg	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3489bd41f2cSmrg	exit ;;
3499bd41f2cSmrg    sun4*:SunOS:6*:*)
3509bd41f2cSmrg	# According to config.sub, this is the proper way to canonicalize
3519bd41f2cSmrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
3529bd41f2cSmrg	# it's likely to be more like Solaris than SunOS4.
3539bd41f2cSmrg	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3549bd41f2cSmrg	exit ;;
3559bd41f2cSmrg    sun4*:SunOS:*:*)
3569bd41f2cSmrg	case "`/usr/bin/arch -k`" in
3579bd41f2cSmrg	    Series*|S4*)
3589bd41f2cSmrg		UNAME_RELEASE=`uname -v`
3599bd41f2cSmrg		;;
3609bd41f2cSmrg	esac
3619bd41f2cSmrg	# Japanese Language versions have a version number like `4.1.3-JL'.
3629bd41f2cSmrg	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
3639bd41f2cSmrg	exit ;;
3649bd41f2cSmrg    sun3*:SunOS:*:*)
3659bd41f2cSmrg	echo m68k-sun-sunos${UNAME_RELEASE}
3669bd41f2cSmrg	exit ;;
3679bd41f2cSmrg    sun*:*:4.2BSD:*)
3689bd41f2cSmrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
3699bd41f2cSmrg	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
3709bd41f2cSmrg	case "`/bin/arch`" in
3719bd41f2cSmrg	    sun3)
3729bd41f2cSmrg		echo m68k-sun-sunos${UNAME_RELEASE}
3739bd41f2cSmrg		;;
3749bd41f2cSmrg	    sun4)
3759bd41f2cSmrg		echo sparc-sun-sunos${UNAME_RELEASE}
3769bd41f2cSmrg		;;
3779bd41f2cSmrg	esac
3789bd41f2cSmrg	exit ;;
3799bd41f2cSmrg    aushp:SunOS:*:*)
3809bd41f2cSmrg	echo sparc-auspex-sunos${UNAME_RELEASE}
3819bd41f2cSmrg	exit ;;
3829bd41f2cSmrg    # The situation for MiNT is a little confusing.  The machine name
3839bd41f2cSmrg    # can be virtually everything (everything which is not
3849bd41f2cSmrg    # "atarist" or "atariste" at least should have a processor
3859bd41f2cSmrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
3869bd41f2cSmrg    # to the lowercase version "mint" (or "freemint").  Finally
3879bd41f2cSmrg    # the system name "TOS" denotes a system which is actually not
3889bd41f2cSmrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
3899bd41f2cSmrg    # be no problem.
3909bd41f2cSmrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
3919bd41f2cSmrg        echo m68k-atari-mint${UNAME_RELEASE}
3929bd41f2cSmrg	exit ;;
3939bd41f2cSmrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
3949bd41f2cSmrg	echo m68k-atari-mint${UNAME_RELEASE}
3959bd41f2cSmrg        exit ;;
3969bd41f2cSmrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
3979bd41f2cSmrg        echo m68k-atari-mint${UNAME_RELEASE}
3989bd41f2cSmrg	exit ;;
3999bd41f2cSmrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
4009bd41f2cSmrg        echo m68k-milan-mint${UNAME_RELEASE}
4019bd41f2cSmrg        exit ;;
4029bd41f2cSmrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
4039bd41f2cSmrg        echo m68k-hades-mint${UNAME_RELEASE}
4049bd41f2cSmrg        exit ;;
4059bd41f2cSmrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
4069bd41f2cSmrg        echo m68k-unknown-mint${UNAME_RELEASE}
4079bd41f2cSmrg        exit ;;
4089bd41f2cSmrg    m68k:machten:*:*)
4099bd41f2cSmrg	echo m68k-apple-machten${UNAME_RELEASE}
4109bd41f2cSmrg	exit ;;
4119bd41f2cSmrg    powerpc:machten:*:*)
4129bd41f2cSmrg	echo powerpc-apple-machten${UNAME_RELEASE}
4139bd41f2cSmrg	exit ;;
4149bd41f2cSmrg    RISC*:Mach:*:*)
4159bd41f2cSmrg	echo mips-dec-mach_bsd4.3
4169bd41f2cSmrg	exit ;;
4179bd41f2cSmrg    RISC*:ULTRIX:*:*)
4189bd41f2cSmrg	echo mips-dec-ultrix${UNAME_RELEASE}
4199bd41f2cSmrg	exit ;;
4209bd41f2cSmrg    VAX*:ULTRIX*:*:*)
4219bd41f2cSmrg	echo vax-dec-ultrix${UNAME_RELEASE}
4229bd41f2cSmrg	exit ;;
4239bd41f2cSmrg    2020:CLIX:*:* | 2430:CLIX:*:*)
4249bd41f2cSmrg	echo clipper-intergraph-clix${UNAME_RELEASE}
4259bd41f2cSmrg	exit ;;
4269bd41f2cSmrg    mips:*:*:UMIPS | mips:*:*:RISCos)
4279bd41f2cSmrg	eval $set_cc_for_build
4289bd41f2cSmrg	sed 's/^	//' << EOF >$dummy.c
4299bd41f2cSmrg#ifdef __cplusplus
4309bd41f2cSmrg#include <stdio.h>  /* for printf() prototype */
4319bd41f2cSmrg	int main (int argc, char *argv[]) {
4329bd41f2cSmrg#else
4339bd41f2cSmrg	int main (argc, argv) int argc; char *argv[]; {
4349bd41f2cSmrg#endif
4359bd41f2cSmrg	#if defined (host_mips) && defined (MIPSEB)
4369bd41f2cSmrg	#if defined (SYSTYPE_SYSV)
4379bd41f2cSmrg	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
4389bd41f2cSmrg	#endif
4399bd41f2cSmrg	#if defined (SYSTYPE_SVR4)
4409bd41f2cSmrg	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
4419bd41f2cSmrg	#endif
4429bd41f2cSmrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
4439bd41f2cSmrg	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
4449bd41f2cSmrg	#endif
4459bd41f2cSmrg	#endif
4469bd41f2cSmrg	  exit (-1);
4479bd41f2cSmrg	}
4489bd41f2cSmrgEOF
4499bd41f2cSmrg	$CC_FOR_BUILD -o $dummy $dummy.c &&
4509bd41f2cSmrg	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
4519bd41f2cSmrg	  SYSTEM_NAME=`$dummy $dummyarg` &&
4529bd41f2cSmrg	    { echo "$SYSTEM_NAME"; exit; }
4539bd41f2cSmrg	echo mips-mips-riscos${UNAME_RELEASE}
4549bd41f2cSmrg	exit ;;
4559bd41f2cSmrg    Motorola:PowerMAX_OS:*:*)
4569bd41f2cSmrg	echo powerpc-motorola-powermax
4579bd41f2cSmrg	exit ;;
4589bd41f2cSmrg    Motorola:*:4.3:PL8-*)
4599bd41f2cSmrg	echo powerpc-harris-powermax
4609bd41f2cSmrg	exit ;;
4619bd41f2cSmrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
4629bd41f2cSmrg	echo powerpc-harris-powermax
4639bd41f2cSmrg	exit ;;
4649bd41f2cSmrg    Night_Hawk:Power_UNIX:*:*)
4659bd41f2cSmrg	echo powerpc-harris-powerunix
4669bd41f2cSmrg	exit ;;
4679bd41f2cSmrg    m88k:CX/UX:7*:*)
4689bd41f2cSmrg	echo m88k-harris-cxux7
4699bd41f2cSmrg	exit ;;
4709bd41f2cSmrg    m88k:*:4*:R4*)
4719bd41f2cSmrg	echo m88k-motorola-sysv4
4729bd41f2cSmrg	exit ;;
4739bd41f2cSmrg    m88k:*:3*:R3*)
4749bd41f2cSmrg	echo m88k-motorola-sysv3
4759bd41f2cSmrg	exit ;;
4769bd41f2cSmrg    AViiON:dgux:*:*)
4779bd41f2cSmrg        # DG/UX returns AViiON for all architectures
4789bd41f2cSmrg        UNAME_PROCESSOR=`/usr/bin/uname -p`
4799bd41f2cSmrg	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
4809bd41f2cSmrg	then
4819bd41f2cSmrg	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
4829bd41f2cSmrg	       [ ${TARGET_BINARY_INTERFACE}x = x ]
4839bd41f2cSmrg	    then
4849bd41f2cSmrg		echo m88k-dg-dgux${UNAME_RELEASE}
4859bd41f2cSmrg	    else
4869bd41f2cSmrg		echo m88k-dg-dguxbcs${UNAME_RELEASE}
4879bd41f2cSmrg	    fi
4889bd41f2cSmrg	else
4899bd41f2cSmrg	    echo i586-dg-dgux${UNAME_RELEASE}
4909bd41f2cSmrg	fi
4919bd41f2cSmrg 	exit ;;
4929bd41f2cSmrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
4939bd41f2cSmrg	echo m88k-dolphin-sysv3
4949bd41f2cSmrg	exit ;;
4959bd41f2cSmrg    M88*:*:R3*:*)
4969bd41f2cSmrg	# Delta 88k system running SVR3
4979bd41f2cSmrg	echo m88k-motorola-sysv3
4989bd41f2cSmrg	exit ;;
4999bd41f2cSmrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
5009bd41f2cSmrg	echo m88k-tektronix-sysv3
5019bd41f2cSmrg	exit ;;
5029bd41f2cSmrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
5039bd41f2cSmrg	echo m68k-tektronix-bsd
5049bd41f2cSmrg	exit ;;
5059bd41f2cSmrg    *:IRIX*:*:*)
5069bd41f2cSmrg	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
5079bd41f2cSmrg	exit ;;
5089bd41f2cSmrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
5099bd41f2cSmrg	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
5109bd41f2cSmrg	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
5119bd41f2cSmrg    i*86:AIX:*:*)
5129bd41f2cSmrg	echo i386-ibm-aix
5139bd41f2cSmrg	exit ;;
5149bd41f2cSmrg    ia64:AIX:*:*)
5159bd41f2cSmrg	if [ -x /usr/bin/oslevel ] ; then
5169bd41f2cSmrg		IBM_REV=`/usr/bin/oslevel`
5179bd41f2cSmrg	else
5189bd41f2cSmrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
5199bd41f2cSmrg	fi
5209bd41f2cSmrg	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
5219bd41f2cSmrg	exit ;;
5229bd41f2cSmrg    *:AIX:2:3)
5239bd41f2cSmrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
5249bd41f2cSmrg		eval $set_cc_for_build
5259bd41f2cSmrg		sed 's/^		//' << EOF >$dummy.c
5269bd41f2cSmrg		#include <sys/systemcfg.h>
5279bd41f2cSmrg
5289bd41f2cSmrg		main()
5299bd41f2cSmrg			{
5309bd41f2cSmrg			if (!__power_pc())
5319bd41f2cSmrg				exit(1);
5329bd41f2cSmrg			puts("powerpc-ibm-aix3.2.5");
5339bd41f2cSmrg			exit(0);
5349bd41f2cSmrg			}
5359bd41f2cSmrgEOF
5369bd41f2cSmrg		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
5379bd41f2cSmrg		then
5389bd41f2cSmrg			echo "$SYSTEM_NAME"
5399bd41f2cSmrg		else
5409bd41f2cSmrg			echo rs6000-ibm-aix3.2.5
5419bd41f2cSmrg		fi
5429bd41f2cSmrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
5439bd41f2cSmrg		echo rs6000-ibm-aix3.2.4
5449bd41f2cSmrg	else
5459bd41f2cSmrg		echo rs6000-ibm-aix3.2
5469bd41f2cSmrg	fi
5479bd41f2cSmrg	exit ;;
5489418810dSmrg    *:AIX:*:[456])
5499bd41f2cSmrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
5509bd41f2cSmrg	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
5519bd41f2cSmrg		IBM_ARCH=rs6000
5529bd41f2cSmrg	else
5539bd41f2cSmrg		IBM_ARCH=powerpc
5549bd41f2cSmrg	fi
5559bd41f2cSmrg	if [ -x /usr/bin/oslevel ] ; then
5569bd41f2cSmrg		IBM_REV=`/usr/bin/oslevel`
5579bd41f2cSmrg	else
5589bd41f2cSmrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
5599bd41f2cSmrg	fi
5609bd41f2cSmrg	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
5619bd41f2cSmrg	exit ;;
5629bd41f2cSmrg    *:AIX:*:*)
5639bd41f2cSmrg	echo rs6000-ibm-aix
5649bd41f2cSmrg	exit ;;
5659bd41f2cSmrg    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
5669bd41f2cSmrg	echo romp-ibm-bsd4.4
5679bd41f2cSmrg	exit ;;
5689bd41f2cSmrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
5699bd41f2cSmrg	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
5709bd41f2cSmrg	exit ;;                             # report: romp-ibm BSD 4.3
5719bd41f2cSmrg    *:BOSX:*:*)
5729bd41f2cSmrg	echo rs6000-bull-bosx
5739bd41f2cSmrg	exit ;;
5749bd41f2cSmrg    DPX/2?00:B.O.S.:*:*)
5759bd41f2cSmrg	echo m68k-bull-sysv3
5769bd41f2cSmrg	exit ;;
5779bd41f2cSmrg    9000/[34]??:4.3bsd:1.*:*)
5789bd41f2cSmrg	echo m68k-hp-bsd
5799bd41f2cSmrg	exit ;;
5809bd41f2cSmrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
5819bd41f2cSmrg	echo m68k-hp-bsd4.4
5829bd41f2cSmrg	exit ;;
5839bd41f2cSmrg    9000/[34678]??:HP-UX:*:*)
5849bd41f2cSmrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
5859bd41f2cSmrg	case "${UNAME_MACHINE}" in
5869bd41f2cSmrg	    9000/31? )            HP_ARCH=m68000 ;;
5879bd41f2cSmrg	    9000/[34]?? )         HP_ARCH=m68k ;;
5889bd41f2cSmrg	    9000/[678][0-9][0-9])
5899bd41f2cSmrg		if [ -x /usr/bin/getconf ]; then
5909bd41f2cSmrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
5919bd41f2cSmrg                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
5929bd41f2cSmrg                    case "${sc_cpu_version}" in
5939bd41f2cSmrg                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
5949bd41f2cSmrg                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
5959bd41f2cSmrg                      532)                      # CPU_PA_RISC2_0
5969bd41f2cSmrg                        case "${sc_kernel_bits}" in
5979bd41f2cSmrg                          32) HP_ARCH="hppa2.0n" ;;
5989bd41f2cSmrg                          64) HP_ARCH="hppa2.0w" ;;
5999bd41f2cSmrg			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
6009bd41f2cSmrg                        esac ;;
6019bd41f2cSmrg                    esac
6029bd41f2cSmrg		fi
6039bd41f2cSmrg		if [ "${HP_ARCH}" = "" ]; then
6049bd41f2cSmrg		    eval $set_cc_for_build
6059bd41f2cSmrg		    sed 's/^              //' << EOF >$dummy.c
6069bd41f2cSmrg
6079bd41f2cSmrg              #define _HPUX_SOURCE
6089bd41f2cSmrg              #include <stdlib.h>
6099bd41f2cSmrg              #include <unistd.h>
6109bd41f2cSmrg
6119bd41f2cSmrg              int main ()
6129bd41f2cSmrg              {
6139bd41f2cSmrg              #if defined(_SC_KERNEL_BITS)
6149bd41f2cSmrg                  long bits = sysconf(_SC_KERNEL_BITS);
6159bd41f2cSmrg              #endif
6169bd41f2cSmrg                  long cpu  = sysconf (_SC_CPU_VERSION);
6179bd41f2cSmrg
6189bd41f2cSmrg                  switch (cpu)
6199bd41f2cSmrg              	{
6209bd41f2cSmrg              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
6219bd41f2cSmrg              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
6229bd41f2cSmrg              	case CPU_PA_RISC2_0:
6239bd41f2cSmrg              #if defined(_SC_KERNEL_BITS)
6249bd41f2cSmrg              	    switch (bits)
6259bd41f2cSmrg              		{
6269bd41f2cSmrg              		case 64: puts ("hppa2.0w"); break;
6279bd41f2cSmrg              		case 32: puts ("hppa2.0n"); break;
6289bd41f2cSmrg              		default: puts ("hppa2.0"); break;
6299bd41f2cSmrg              		} break;
6309bd41f2cSmrg              #else  /* !defined(_SC_KERNEL_BITS) */
6319bd41f2cSmrg              	    puts ("hppa2.0"); break;
6329bd41f2cSmrg              #endif
6339bd41f2cSmrg              	default: puts ("hppa1.0"); break;
6349bd41f2cSmrg              	}
6359bd41f2cSmrg                  exit (0);
6369bd41f2cSmrg              }
6379bd41f2cSmrgEOF
6389bd41f2cSmrg		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
6399bd41f2cSmrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
6409bd41f2cSmrg		fi ;;
6419bd41f2cSmrg	esac
6429bd41f2cSmrg	if [ ${HP_ARCH} = "hppa2.0w" ]
6439bd41f2cSmrg	then
6449bd41f2cSmrg	    eval $set_cc_for_build
6459bd41f2cSmrg
6469bd41f2cSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
6479bd41f2cSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
6489bd41f2cSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
6499bd41f2cSmrg	    #
6509bd41f2cSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
6519bd41f2cSmrg	    # => hppa2.0w-hp-hpux11.23
6529bd41f2cSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
6539bd41f2cSmrg	    # => hppa64-hp-hpux11.23
6549bd41f2cSmrg
6559bd41f2cSmrg	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
656c4f7863aSmrg		grep __LP64__ >/dev/null
6579bd41f2cSmrg	    then
6589bd41f2cSmrg		HP_ARCH="hppa2.0w"
6599bd41f2cSmrg	    else
6609bd41f2cSmrg		HP_ARCH="hppa64"
6619bd41f2cSmrg	    fi
6629bd41f2cSmrg	fi
6639bd41f2cSmrg	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
6649bd41f2cSmrg	exit ;;
6659bd41f2cSmrg    ia64:HP-UX:*:*)
6669bd41f2cSmrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
6679bd41f2cSmrg	echo ia64-hp-hpux${HPUX_REV}
6689bd41f2cSmrg	exit ;;
6699bd41f2cSmrg    3050*:HI-UX:*:*)
6709bd41f2cSmrg	eval $set_cc_for_build
6719bd41f2cSmrg	sed 's/^	//' << EOF >$dummy.c
6729bd41f2cSmrg	#include <unistd.h>
6739bd41f2cSmrg	int
6749bd41f2cSmrg	main ()
6759bd41f2cSmrg	{
6769bd41f2cSmrg	  long cpu = sysconf (_SC_CPU_VERSION);
6779bd41f2cSmrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
6789bd41f2cSmrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
6799bd41f2cSmrg	     results, however.  */
6809bd41f2cSmrg	  if (CPU_IS_PA_RISC (cpu))
6819bd41f2cSmrg	    {
6829bd41f2cSmrg	      switch (cpu)
6839bd41f2cSmrg		{
6849bd41f2cSmrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
6859bd41f2cSmrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
6869bd41f2cSmrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
6879bd41f2cSmrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
6889bd41f2cSmrg		}
6899bd41f2cSmrg	    }
6909bd41f2cSmrg	  else if (CPU_IS_HP_MC68K (cpu))
6919bd41f2cSmrg	    puts ("m68k-hitachi-hiuxwe2");
6929bd41f2cSmrg	  else puts ("unknown-hitachi-hiuxwe2");
6939bd41f2cSmrg	  exit (0);
6949bd41f2cSmrg	}
6959bd41f2cSmrgEOF
6969bd41f2cSmrg	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
6979bd41f2cSmrg		{ echo "$SYSTEM_NAME"; exit; }
6989bd41f2cSmrg	echo unknown-hitachi-hiuxwe2
6999bd41f2cSmrg	exit ;;
7009bd41f2cSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
7019bd41f2cSmrg	echo hppa1.1-hp-bsd
7029bd41f2cSmrg	exit ;;
7039bd41f2cSmrg    9000/8??:4.3bsd:*:*)
7049bd41f2cSmrg	echo hppa1.0-hp-bsd
7059bd41f2cSmrg	exit ;;
7069bd41f2cSmrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
7079bd41f2cSmrg	echo hppa1.0-hp-mpeix
7089bd41f2cSmrg	exit ;;
7099bd41f2cSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
7109bd41f2cSmrg	echo hppa1.1-hp-osf
7119bd41f2cSmrg	exit ;;
7129bd41f2cSmrg    hp8??:OSF1:*:*)
7139bd41f2cSmrg	echo hppa1.0-hp-osf
7149bd41f2cSmrg	exit ;;
7159bd41f2cSmrg    i*86:OSF1:*:*)
7169bd41f2cSmrg	if [ -x /usr/sbin/sysversion ] ; then
7179bd41f2cSmrg	    echo ${UNAME_MACHINE}-unknown-osf1mk
7189bd41f2cSmrg	else
7199bd41f2cSmrg	    echo ${UNAME_MACHINE}-unknown-osf1
7209bd41f2cSmrg	fi
7219bd41f2cSmrg	exit ;;
7229bd41f2cSmrg    parisc*:Lites*:*:*)
7239bd41f2cSmrg	echo hppa1.1-hp-lites
7249bd41f2cSmrg	exit ;;
7259bd41f2cSmrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
7269bd41f2cSmrg	echo c1-convex-bsd
7279bd41f2cSmrg        exit ;;
7289bd41f2cSmrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
7299bd41f2cSmrg	if getsysinfo -f scalar_acc
7309bd41f2cSmrg	then echo c32-convex-bsd
7319bd41f2cSmrg	else echo c2-convex-bsd
7329bd41f2cSmrg	fi
7339bd41f2cSmrg        exit ;;
7349bd41f2cSmrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
7359bd41f2cSmrg	echo c34-convex-bsd
7369bd41f2cSmrg        exit ;;
7379bd41f2cSmrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
7389bd41f2cSmrg	echo c38-convex-bsd
7399bd41f2cSmrg        exit ;;
7409bd41f2cSmrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
7419bd41f2cSmrg	echo c4-convex-bsd
7429bd41f2cSmrg        exit ;;
7439bd41f2cSmrg    CRAY*Y-MP:*:*:*)
7449bd41f2cSmrg	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7459bd41f2cSmrg	exit ;;
7469bd41f2cSmrg    CRAY*[A-Z]90:*:*:*)
7479bd41f2cSmrg	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
7489bd41f2cSmrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
7499bd41f2cSmrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
7509bd41f2cSmrg	      -e 's/\.[^.]*$/.X/'
7519bd41f2cSmrg	exit ;;
7529bd41f2cSmrg    CRAY*TS:*:*:*)
7539bd41f2cSmrg	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7549bd41f2cSmrg	exit ;;
7559bd41f2cSmrg    CRAY*T3E:*:*:*)
7569bd41f2cSmrg	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7579bd41f2cSmrg	exit ;;
7589bd41f2cSmrg    CRAY*SV1:*:*:*)
7599bd41f2cSmrg	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7609bd41f2cSmrg	exit ;;
7619bd41f2cSmrg    *:UNICOS/mp:*:*)
7629bd41f2cSmrg	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7639bd41f2cSmrg	exit ;;
7649bd41f2cSmrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
7659bd41f2cSmrg	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
7669bd41f2cSmrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
7679bd41f2cSmrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
7689bd41f2cSmrg        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
7699bd41f2cSmrg        exit ;;
7709bd41f2cSmrg    5000:UNIX_System_V:4.*:*)
7719bd41f2cSmrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
7729bd41f2cSmrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
7739bd41f2cSmrg        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
7749bd41f2cSmrg	exit ;;
7759bd41f2cSmrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
7769bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
7779bd41f2cSmrg	exit ;;
7789bd41f2cSmrg    sparc*:BSD/OS:*:*)
7799bd41f2cSmrg	echo sparc-unknown-bsdi${UNAME_RELEASE}
7809bd41f2cSmrg	exit ;;
7819bd41f2cSmrg    *:BSD/OS:*:*)
7829bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
7839bd41f2cSmrg	exit ;;
7849bd41f2cSmrg    *:FreeBSD:*:*)
7859418810dSmrg	case ${UNAME_MACHINE} in
7869418810dSmrg	    pc98)
7879418810dSmrg		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
7889418810dSmrg	    amd64)
7899418810dSmrg		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
7909418810dSmrg	    *)
7919418810dSmrg		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
7929418810dSmrg	esac
7939bd41f2cSmrg	exit ;;
7949bd41f2cSmrg    i*:CYGWIN*:*)
7959bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-cygwin
7969bd41f2cSmrg	exit ;;
7979418810dSmrg    *:MINGW*:*)
7989bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-mingw32
7999bd41f2cSmrg	exit ;;
8009bd41f2cSmrg    i*:windows32*:*)
8019bd41f2cSmrg    	# uname -m includes "-pc" on this system.
8029bd41f2cSmrg    	echo ${UNAME_MACHINE}-mingw32
8039bd41f2cSmrg	exit ;;
8049bd41f2cSmrg    i*:PW*:*)
8059bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-pw32
8069bd41f2cSmrg	exit ;;
807c4f7863aSmrg    *:Interix*:[3456]*)
8089418810dSmrg    	case ${UNAME_MACHINE} in
8099418810dSmrg	    x86)
8109418810dSmrg		echo i586-pc-interix${UNAME_RELEASE}
8119418810dSmrg		exit ;;
812c4f7863aSmrg	    EM64T | authenticamd | genuineintel)
8139418810dSmrg		echo x86_64-unknown-interix${UNAME_RELEASE}
8149418810dSmrg		exit ;;
8159418810dSmrg	    IA64)
8169418810dSmrg		echo ia64-unknown-interix${UNAME_RELEASE}
8179418810dSmrg		exit ;;
8189418810dSmrg	esac ;;
8199bd41f2cSmrg    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
8209bd41f2cSmrg	echo i${UNAME_MACHINE}-pc-mks
8219bd41f2cSmrg	exit ;;
8229bd41f2cSmrg    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
8239bd41f2cSmrg	# How do we know it's Interix rather than the generic POSIX subsystem?
8249bd41f2cSmrg	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
8259bd41f2cSmrg	# UNAME_MACHINE based on the output of uname instead of i386?
8269bd41f2cSmrg	echo i586-pc-interix
8279bd41f2cSmrg	exit ;;
8289bd41f2cSmrg    i*:UWIN*:*)
8299bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-uwin
8309bd41f2cSmrg	exit ;;
8319bd41f2cSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
8329bd41f2cSmrg	echo x86_64-unknown-cygwin
8339bd41f2cSmrg	exit ;;
8349bd41f2cSmrg    p*:CYGWIN*:*)
8359bd41f2cSmrg	echo powerpcle-unknown-cygwin
8369bd41f2cSmrg	exit ;;
8379bd41f2cSmrg    prep*:SunOS:5.*:*)
8389bd41f2cSmrg	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
8399bd41f2cSmrg	exit ;;
8409bd41f2cSmrg    *:GNU:*:*)
8419bd41f2cSmrg	# the GNU system
8429bd41f2cSmrg	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
8439bd41f2cSmrg	exit ;;
8449bd41f2cSmrg    *:GNU/*:*:*)
8459bd41f2cSmrg	# other systems with GNU libc and userland
8469bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
8479bd41f2cSmrg	exit ;;
8489bd41f2cSmrg    i*86:Minix:*:*)
8499bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-minix
8509bd41f2cSmrg	exit ;;
8519bd41f2cSmrg    arm*:Linux:*:*)
8529418810dSmrg	eval $set_cc_for_build
8539418810dSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
8549418810dSmrg	    | grep -q __ARM_EABI__
8559418810dSmrg	then
8569418810dSmrg	    echo ${UNAME_MACHINE}-unknown-linux-gnu
8579418810dSmrg	else
8589418810dSmrg	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
8599418810dSmrg	fi
8609418810dSmrg	exit ;;
8619418810dSmrg    avr32*:Linux:*:*)
8629bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8639bd41f2cSmrg	exit ;;
8649bd41f2cSmrg    cris:Linux:*:*)
8659bd41f2cSmrg	echo cris-axis-linux-gnu
8669bd41f2cSmrg	exit ;;
8679bd41f2cSmrg    crisv32:Linux:*:*)
8689bd41f2cSmrg	echo crisv32-axis-linux-gnu
8699bd41f2cSmrg	exit ;;
8709bd41f2cSmrg    frv:Linux:*:*)
8719bd41f2cSmrg    	echo frv-unknown-linux-gnu
8729bd41f2cSmrg	exit ;;
8739bd41f2cSmrg    ia64:Linux:*:*)
8749bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8759bd41f2cSmrg	exit ;;
8769bd41f2cSmrg    m32r*:Linux:*:*)
8779bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8789bd41f2cSmrg	exit ;;
8799bd41f2cSmrg    m68*:Linux:*:*)
8809bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8819bd41f2cSmrg	exit ;;
882c4f7863aSmrg    mips:Linux:*:*)
8839bd41f2cSmrg	eval $set_cc_for_build
8849bd41f2cSmrg	sed 's/^	//' << EOF >$dummy.c
8859bd41f2cSmrg	#undef CPU
886c4f7863aSmrg	#undef mips
887c4f7863aSmrg	#undef mipsel
8889bd41f2cSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
889c4f7863aSmrg	CPU=mipsel
8909bd41f2cSmrg	#else
8919bd41f2cSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
892c4f7863aSmrg	CPU=mips
8939bd41f2cSmrg	#else
8949bd41f2cSmrg	CPU=
8959bd41f2cSmrg	#endif
8969bd41f2cSmrg	#endif
8979bd41f2cSmrgEOF
898c4f7863aSmrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
899c4f7863aSmrg	    /^CPU/{
900c4f7863aSmrg		s: ::g
901c4f7863aSmrg		p
902c4f7863aSmrg	    }'`"
903c4f7863aSmrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
904c4f7863aSmrg	;;
905c4f7863aSmrg    mips64:Linux:*:*)
906c4f7863aSmrg	eval $set_cc_for_build
907c4f7863aSmrg	sed 's/^	//' << EOF >$dummy.c
908c4f7863aSmrg	#undef CPU
909c4f7863aSmrg	#undef mips64
910c4f7863aSmrg	#undef mips64el
911c4f7863aSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
912c4f7863aSmrg	CPU=mips64el
913c4f7863aSmrg	#else
914c4f7863aSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
915c4f7863aSmrg	CPU=mips64
916c4f7863aSmrg	#else
917c4f7863aSmrg	CPU=
918c4f7863aSmrg	#endif
919c4f7863aSmrg	#endif
920c4f7863aSmrgEOF
921c4f7863aSmrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
922c4f7863aSmrg	    /^CPU/{
923c4f7863aSmrg		s: ::g
924c4f7863aSmrg		p
925c4f7863aSmrg	    }'`"
9269bd41f2cSmrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
9279bd41f2cSmrg	;;
9289bd41f2cSmrg    or32:Linux:*:*)
9299bd41f2cSmrg	echo or32-unknown-linux-gnu
9309bd41f2cSmrg	exit ;;
931c4f7863aSmrg    ppc:Linux:*:*)
932c4f7863aSmrg	echo powerpc-unknown-linux-gnu
933c4f7863aSmrg	exit ;;
934c4f7863aSmrg    ppc64:Linux:*:*)
935c4f7863aSmrg	echo powerpc64-unknown-linux-gnu
936c4f7863aSmrg	exit ;;
937c4f7863aSmrg    alpha:Linux:*:*)
938c4f7863aSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
939c4f7863aSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
940c4f7863aSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
941c4f7863aSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
942c4f7863aSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
943c4f7863aSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
944c4f7863aSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
945c4f7863aSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
946c4f7863aSmrg        esac
947c4f7863aSmrg	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
948c4f7863aSmrg	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
949c4f7863aSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
950c4f7863aSmrg	exit ;;
9519418810dSmrg    padre:Linux:*:*)
9529418810dSmrg	echo sparc-unknown-linux-gnu
9539418810dSmrg	exit ;;
9549bd41f2cSmrg    parisc:Linux:*:* | hppa:Linux:*:*)
9559bd41f2cSmrg	# Look for CPU level
9569bd41f2cSmrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
9579bd41f2cSmrg	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
9589bd41f2cSmrg	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
9599bd41f2cSmrg	  *)    echo hppa-unknown-linux-gnu ;;
9609bd41f2cSmrg	esac
9619bd41f2cSmrg	exit ;;
962c4f7863aSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
963c4f7863aSmrg	echo hppa64-unknown-linux-gnu
9649bd41f2cSmrg	exit ;;
9659bd41f2cSmrg    s390:Linux:*:* | s390x:Linux:*:*)
9669bd41f2cSmrg	echo ${UNAME_MACHINE}-ibm-linux
9679bd41f2cSmrg	exit ;;
9689bd41f2cSmrg    sh64*:Linux:*:*)
9699bd41f2cSmrg    	echo ${UNAME_MACHINE}-unknown-linux-gnu
9709bd41f2cSmrg	exit ;;
9719bd41f2cSmrg    sh*:Linux:*:*)
9729bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
9739bd41f2cSmrg	exit ;;
9749bd41f2cSmrg    sparc:Linux:*:* | sparc64:Linux:*:*)
9759bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
9769bd41f2cSmrg	exit ;;
9779bd41f2cSmrg    vax:Linux:*:*)
9789bd41f2cSmrg	echo ${UNAME_MACHINE}-dec-linux-gnu
9799bd41f2cSmrg	exit ;;
9809bd41f2cSmrg    x86_64:Linux:*:*)
9819bd41f2cSmrg	echo x86_64-unknown-linux-gnu
9829bd41f2cSmrg	exit ;;
9839418810dSmrg    xtensa*:Linux:*:*)
9849418810dSmrg    	echo ${UNAME_MACHINE}-unknown-linux-gnu
9859418810dSmrg	exit ;;
986c4f7863aSmrg    i*86:Linux:*:*)
987c4f7863aSmrg	# The BFD linker knows what the default object file format is, so
988c4f7863aSmrg	# first see if it will tell us. cd to the root directory to prevent
989c4f7863aSmrg	# problems with other programs or directories called `ld' in the path.
990c4f7863aSmrg	# Set LC_ALL=C to ensure ld outputs messages in English.
991c4f7863aSmrg	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
992c4f7863aSmrg			 | sed -ne '/supported targets:/!d
993c4f7863aSmrg				    s/[ 	][ 	]*/ /g
994c4f7863aSmrg				    s/.*supported targets: *//
995c4f7863aSmrg				    s/ .*//
996c4f7863aSmrg				    p'`
997c4f7863aSmrg        case "$ld_supported_targets" in
998c4f7863aSmrg	  elf32-i386)
999c4f7863aSmrg		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
1000c4f7863aSmrg		;;
1001c4f7863aSmrg	  a.out-i386-linux)
1002c4f7863aSmrg		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
1003c4f7863aSmrg		exit ;;
1004c4f7863aSmrg	  "")
1005c4f7863aSmrg		# Either a pre-BFD a.out linker (linux-gnuoldld) or
1006c4f7863aSmrg		# one that does not give us useful --help.
1007c4f7863aSmrg		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
1008c4f7863aSmrg		exit ;;
1009c4f7863aSmrg	esac
1010c4f7863aSmrg	# Determine whether the default compiler is a.out or elf
1011c4f7863aSmrg	eval $set_cc_for_build
1012c4f7863aSmrg	sed 's/^	//' << EOF >$dummy.c
1013c4f7863aSmrg	#include <features.h>
1014c4f7863aSmrg	#ifdef __ELF__
1015c4f7863aSmrg	# ifdef __GLIBC__
1016c4f7863aSmrg	#  if __GLIBC__ >= 2
1017c4f7863aSmrg	LIBC=gnu
1018c4f7863aSmrg	#  else
1019c4f7863aSmrg	LIBC=gnulibc1
1020c4f7863aSmrg	#  endif
1021c4f7863aSmrg	# else
1022c4f7863aSmrg	LIBC=gnulibc1
1023c4f7863aSmrg	# endif
1024c4f7863aSmrg	#else
1025c4f7863aSmrg	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1026c4f7863aSmrg	LIBC=gnu
1027c4f7863aSmrg	#else
1028c4f7863aSmrg	LIBC=gnuaout
1029c4f7863aSmrg	#endif
1030c4f7863aSmrg	#endif
1031c4f7863aSmrg	#ifdef __dietlibc__
1032c4f7863aSmrg	LIBC=dietlibc
1033c4f7863aSmrg	#endif
1034c4f7863aSmrgEOF
1035c4f7863aSmrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1036c4f7863aSmrg	    /^LIBC/{
1037c4f7863aSmrg		s: ::g
1038c4f7863aSmrg		p
1039c4f7863aSmrg	    }'`"
1040c4f7863aSmrg	test x"${LIBC}" != x && {
1041c4f7863aSmrg		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
1042c4f7863aSmrg		exit
1043c4f7863aSmrg	}
1044c4f7863aSmrg	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
1045c4f7863aSmrg	;;
10469bd41f2cSmrg    i*86:DYNIX/ptx:4*:*)
10479bd41f2cSmrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
10489bd41f2cSmrg	# earlier versions are messed up and put the nodename in both
10499bd41f2cSmrg	# sysname and nodename.
10509bd41f2cSmrg	echo i386-sequent-sysv4
10519bd41f2cSmrg	exit ;;
10529bd41f2cSmrg    i*86:UNIX_SV:4.2MP:2.*)
10539bd41f2cSmrg        # Unixware is an offshoot of SVR4, but it has its own version
10549bd41f2cSmrg        # number series starting with 2...
10559bd41f2cSmrg        # I am not positive that other SVR4 systems won't match this,
10569bd41f2cSmrg	# I just have to hope.  -- rms.
10579bd41f2cSmrg        # Use sysv4.2uw... so that sysv4* matches it.
10589bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
10599bd41f2cSmrg	exit ;;
10609bd41f2cSmrg    i*86:OS/2:*:*)
10619bd41f2cSmrg	# If we were able to find `uname', then EMX Unix compatibility
10629bd41f2cSmrg	# is probably installed.
10639bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-os2-emx
10649bd41f2cSmrg	exit ;;
10659bd41f2cSmrg    i*86:XTS-300:*:STOP)
10669bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-stop
10679bd41f2cSmrg	exit ;;
10689bd41f2cSmrg    i*86:atheos:*:*)
10699bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-atheos
10709bd41f2cSmrg	exit ;;
10719bd41f2cSmrg    i*86:syllable:*:*)
10729bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-syllable
10739bd41f2cSmrg	exit ;;
1074c4f7863aSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
10759bd41f2cSmrg	echo i386-unknown-lynxos${UNAME_RELEASE}
10769bd41f2cSmrg	exit ;;
10779bd41f2cSmrg    i*86:*DOS:*:*)
10789bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-msdosdjgpp
10799bd41f2cSmrg	exit ;;
10809bd41f2cSmrg    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
10819bd41f2cSmrg	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
10829bd41f2cSmrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
10839bd41f2cSmrg		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
10849bd41f2cSmrg	else
10859bd41f2cSmrg		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
10869bd41f2cSmrg	fi
10879bd41f2cSmrg	exit ;;
10889bd41f2cSmrg    i*86:*:5:[678]*)
10899bd41f2cSmrg    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
10909bd41f2cSmrg	case `/bin/uname -X | grep "^Machine"` in
10919bd41f2cSmrg	    *486*)	     UNAME_MACHINE=i486 ;;
10929bd41f2cSmrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
10939bd41f2cSmrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
10949bd41f2cSmrg	esac
10959bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
10969bd41f2cSmrg	exit ;;
10979bd41f2cSmrg    i*86:*:3.2:*)
10989bd41f2cSmrg	if test -f /usr/options/cb.name; then
10999bd41f2cSmrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
11009bd41f2cSmrg		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
11019bd41f2cSmrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
11029bd41f2cSmrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
11039bd41f2cSmrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
11049bd41f2cSmrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
11059bd41f2cSmrg			&& UNAME_MACHINE=i586
11069bd41f2cSmrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
11079bd41f2cSmrg			&& UNAME_MACHINE=i686
11089bd41f2cSmrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
11099bd41f2cSmrg			&& UNAME_MACHINE=i686
11109bd41f2cSmrg		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
11119bd41f2cSmrg	else
11129bd41f2cSmrg		echo ${UNAME_MACHINE}-pc-sysv32
11139bd41f2cSmrg	fi
11149bd41f2cSmrg	exit ;;
11159bd41f2cSmrg    pc:*:*:*)
11169bd41f2cSmrg	# Left here for compatibility:
11179bd41f2cSmrg        # uname -m prints for DJGPP always 'pc', but it prints nothing about
1118c4f7863aSmrg        # the processor, so we play safe by assuming i386.
1119c4f7863aSmrg	echo i386-pc-msdosdjgpp
11209bd41f2cSmrg        exit ;;
11219bd41f2cSmrg    Intel:Mach:3*:*)
11229bd41f2cSmrg	echo i386-pc-mach3
11239bd41f2cSmrg	exit ;;
11249bd41f2cSmrg    paragon:*:*:*)
11259bd41f2cSmrg	echo i860-intel-osf1
11269bd41f2cSmrg	exit ;;
11279bd41f2cSmrg    i860:*:4.*:*) # i860-SVR4
11289bd41f2cSmrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
11299bd41f2cSmrg	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
11309bd41f2cSmrg	else # Add other i860-SVR4 vendors below as they are discovered.
11319bd41f2cSmrg	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
11329bd41f2cSmrg	fi
11339bd41f2cSmrg	exit ;;
11349bd41f2cSmrg    mini*:CTIX:SYS*5:*)
11359bd41f2cSmrg	# "miniframe"
11369bd41f2cSmrg	echo m68010-convergent-sysv
11379bd41f2cSmrg	exit ;;
11389bd41f2cSmrg    mc68k:UNIX:SYSTEM5:3.51m)
11399bd41f2cSmrg	echo m68k-convergent-sysv
11409bd41f2cSmrg	exit ;;
11419bd41f2cSmrg    M680?0:D-NIX:5.3:*)
11429bd41f2cSmrg	echo m68k-diab-dnix
11439bd41f2cSmrg	exit ;;
11449bd41f2cSmrg    M68*:*:R3V[5678]*:*)
11459bd41f2cSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
11469bd41f2cSmrg    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)
11479bd41f2cSmrg	OS_REL=''
11489bd41f2cSmrg	test -r /etc/.relid \
11499bd41f2cSmrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
11509bd41f2cSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
11519bd41f2cSmrg	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
11529bd41f2cSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
11539bd41f2cSmrg	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
11549bd41f2cSmrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
11559bd41f2cSmrg        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
11569bd41f2cSmrg          && { echo i486-ncr-sysv4; exit; } ;;
11579bd41f2cSmrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
11589bd41f2cSmrg	echo m68k-unknown-lynxos${UNAME_RELEASE}
11599bd41f2cSmrg	exit ;;
11609bd41f2cSmrg    mc68030:UNIX_System_V:4.*:*)
11619bd41f2cSmrg	echo m68k-atari-sysv4
11629bd41f2cSmrg	exit ;;
11639bd41f2cSmrg    TSUNAMI:LynxOS:2.*:*)
11649bd41f2cSmrg	echo sparc-unknown-lynxos${UNAME_RELEASE}
11659bd41f2cSmrg	exit ;;
11669bd41f2cSmrg    rs6000:LynxOS:2.*:*)
11679bd41f2cSmrg	echo rs6000-unknown-lynxos${UNAME_RELEASE}
11689bd41f2cSmrg	exit ;;
1169c4f7863aSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
11709bd41f2cSmrg	echo powerpc-unknown-lynxos${UNAME_RELEASE}
11719bd41f2cSmrg	exit ;;
11729bd41f2cSmrg    SM[BE]S:UNIX_SV:*:*)
11739bd41f2cSmrg	echo mips-dde-sysv${UNAME_RELEASE}
11749bd41f2cSmrg	exit ;;
11759bd41f2cSmrg    RM*:ReliantUNIX-*:*:*)
11769bd41f2cSmrg	echo mips-sni-sysv4
11779bd41f2cSmrg	exit ;;
11789bd41f2cSmrg    RM*:SINIX-*:*:*)
11799bd41f2cSmrg	echo mips-sni-sysv4
11809bd41f2cSmrg	exit ;;
11819bd41f2cSmrg    *:SINIX-*:*:*)
11829bd41f2cSmrg	if uname -p 2>/dev/null >/dev/null ; then
11839bd41f2cSmrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
11849bd41f2cSmrg		echo ${UNAME_MACHINE}-sni-sysv4
11859bd41f2cSmrg	else
11869bd41f2cSmrg		echo ns32k-sni-sysv
11879bd41f2cSmrg	fi
11889bd41f2cSmrg	exit ;;
11899bd41f2cSmrg    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
11909bd41f2cSmrg                      # says <Richard.M.Bartel@ccMail.Census.GOV>
11919bd41f2cSmrg        echo i586-unisys-sysv4
11929bd41f2cSmrg        exit ;;
11939bd41f2cSmrg    *:UNIX_System_V:4*:FTX*)
11949bd41f2cSmrg	# From Gerald Hewes <hewes@openmarket.com>.
11959bd41f2cSmrg	# How about differentiating between stratus architectures? -djm
11969bd41f2cSmrg	echo hppa1.1-stratus-sysv4
11979bd41f2cSmrg	exit ;;
11989bd41f2cSmrg    *:*:*:FTX*)
11999bd41f2cSmrg	# From seanf@swdc.stratus.com.
12009bd41f2cSmrg	echo i860-stratus-sysv4
12019bd41f2cSmrg	exit ;;
12029bd41f2cSmrg    i*86:VOS:*:*)
12039bd41f2cSmrg	# From Paul.Green@stratus.com.
12049bd41f2cSmrg	echo ${UNAME_MACHINE}-stratus-vos
12059bd41f2cSmrg	exit ;;
12069bd41f2cSmrg    *:VOS:*:*)
12079bd41f2cSmrg	# From Paul.Green@stratus.com.
12089bd41f2cSmrg	echo hppa1.1-stratus-vos
12099bd41f2cSmrg	exit ;;
12109bd41f2cSmrg    mc68*:A/UX:*:*)
12119bd41f2cSmrg	echo m68k-apple-aux${UNAME_RELEASE}
12129bd41f2cSmrg	exit ;;
12139bd41f2cSmrg    news*:NEWS-OS:6*:*)
12149bd41f2cSmrg	echo mips-sony-newsos6
12159bd41f2cSmrg	exit ;;
12169bd41f2cSmrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
12179bd41f2cSmrg	if [ -d /usr/nec ]; then
12189bd41f2cSmrg	        echo mips-nec-sysv${UNAME_RELEASE}
12199bd41f2cSmrg	else
12209bd41f2cSmrg	        echo mips-unknown-sysv${UNAME_RELEASE}
12219bd41f2cSmrg	fi
12229bd41f2cSmrg        exit ;;
12239bd41f2cSmrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
12249bd41f2cSmrg	echo powerpc-be-beos
12259bd41f2cSmrg	exit ;;
12269bd41f2cSmrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
12279bd41f2cSmrg	echo powerpc-apple-beos
12289bd41f2cSmrg	exit ;;
12299bd41f2cSmrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
12309bd41f2cSmrg	echo i586-pc-beos
12319bd41f2cSmrg	exit ;;
12329418810dSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
12339418810dSmrg	echo i586-pc-haiku
12349418810dSmrg	exit ;;
12359bd41f2cSmrg    SX-4:SUPER-UX:*:*)
12369bd41f2cSmrg	echo sx4-nec-superux${UNAME_RELEASE}
12379bd41f2cSmrg	exit ;;
12389bd41f2cSmrg    SX-5:SUPER-UX:*:*)
12399bd41f2cSmrg	echo sx5-nec-superux${UNAME_RELEASE}
12409bd41f2cSmrg	exit ;;
12419bd41f2cSmrg    SX-6:SUPER-UX:*:*)
12429bd41f2cSmrg	echo sx6-nec-superux${UNAME_RELEASE}
12439bd41f2cSmrg	exit ;;
12449418810dSmrg    SX-7:SUPER-UX:*:*)
12459418810dSmrg	echo sx7-nec-superux${UNAME_RELEASE}
12469418810dSmrg	exit ;;
12479418810dSmrg    SX-8:SUPER-UX:*:*)
12489418810dSmrg	echo sx8-nec-superux${UNAME_RELEASE}
12499418810dSmrg	exit ;;
12509418810dSmrg    SX-8R:SUPER-UX:*:*)
12519418810dSmrg	echo sx8r-nec-superux${UNAME_RELEASE}
12529418810dSmrg	exit ;;
12539bd41f2cSmrg    Power*:Rhapsody:*:*)
12549bd41f2cSmrg	echo powerpc-apple-rhapsody${UNAME_RELEASE}
12559bd41f2cSmrg	exit ;;
12569bd41f2cSmrg    *:Rhapsody:*:*)
12579bd41f2cSmrg	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
12589bd41f2cSmrg	exit ;;
12599bd41f2cSmrg    *:Darwin:*:*)
12609bd41f2cSmrg	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
12619bd41f2cSmrg	case $UNAME_PROCESSOR in
12629bd41f2cSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
12639bd41f2cSmrg	esac
12649bd41f2cSmrg	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
12659bd41f2cSmrg	exit ;;
12669bd41f2cSmrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
12679bd41f2cSmrg	UNAME_PROCESSOR=`uname -p`
12689bd41f2cSmrg	if test "$UNAME_PROCESSOR" = "x86"; then
12699bd41f2cSmrg		UNAME_PROCESSOR=i386
12709bd41f2cSmrg		UNAME_MACHINE=pc
12719bd41f2cSmrg	fi
12729bd41f2cSmrg	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
12739bd41f2cSmrg	exit ;;
12749bd41f2cSmrg    *:QNX:*:4*)
12759bd41f2cSmrg	echo i386-pc-qnx
12769bd41f2cSmrg	exit ;;
12779bd41f2cSmrg    NSE-?:NONSTOP_KERNEL:*:*)
12789bd41f2cSmrg	echo nse-tandem-nsk${UNAME_RELEASE}
12799bd41f2cSmrg	exit ;;
12809bd41f2cSmrg    NSR-?:NONSTOP_KERNEL:*:*)
12819bd41f2cSmrg	echo nsr-tandem-nsk${UNAME_RELEASE}
12829bd41f2cSmrg	exit ;;
12839bd41f2cSmrg    *:NonStop-UX:*:*)
12849bd41f2cSmrg	echo mips-compaq-nonstopux
12859bd41f2cSmrg	exit ;;
12869bd41f2cSmrg    BS2000:POSIX*:*:*)
12879bd41f2cSmrg	echo bs2000-siemens-sysv
12889bd41f2cSmrg	exit ;;
12899bd41f2cSmrg    DS/*:UNIX_System_V:*:*)
12909bd41f2cSmrg	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
12919bd41f2cSmrg	exit ;;
12929bd41f2cSmrg    *:Plan9:*:*)
12939bd41f2cSmrg	# "uname -m" is not consistent, so use $cputype instead. 386
12949bd41f2cSmrg	# is converted to i386 for consistency with other x86
12959bd41f2cSmrg	# operating systems.
12969bd41f2cSmrg	if test "$cputype" = "386"; then
12979bd41f2cSmrg	    UNAME_MACHINE=i386
12989bd41f2cSmrg	else
12999bd41f2cSmrg	    UNAME_MACHINE="$cputype"
13009bd41f2cSmrg	fi
13019bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-plan9
13029bd41f2cSmrg	exit ;;
13039bd41f2cSmrg    *:TOPS-10:*:*)
13049bd41f2cSmrg	echo pdp10-unknown-tops10
13059bd41f2cSmrg	exit ;;
13069bd41f2cSmrg    *:TENEX:*:*)
13079bd41f2cSmrg	echo pdp10-unknown-tenex
13089bd41f2cSmrg	exit ;;
13099bd41f2cSmrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
13109bd41f2cSmrg	echo pdp10-dec-tops20
13119bd41f2cSmrg	exit ;;
13129bd41f2cSmrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
13139bd41f2cSmrg	echo pdp10-xkl-tops20
13149bd41f2cSmrg	exit ;;
13159bd41f2cSmrg    *:TOPS-20:*:*)
13169bd41f2cSmrg	echo pdp10-unknown-tops20
13179bd41f2cSmrg	exit ;;
13189bd41f2cSmrg    *:ITS:*:*)
13199bd41f2cSmrg	echo pdp10-unknown-its
13209bd41f2cSmrg	exit ;;
13219bd41f2cSmrg    SEI:*:*:SEIUX)
13229bd41f2cSmrg        echo mips-sei-seiux${UNAME_RELEASE}
13239bd41f2cSmrg	exit ;;
13249bd41f2cSmrg    *:DragonFly:*:*)
13259bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
13269bd41f2cSmrg	exit ;;
13279bd41f2cSmrg    *:*VMS:*:*)
13289bd41f2cSmrg    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
13299bd41f2cSmrg	case "${UNAME_MACHINE}" in
13309bd41f2cSmrg	    A*) echo alpha-dec-vms ; exit ;;
13319bd41f2cSmrg	    I*) echo ia64-dec-vms ; exit ;;
13329bd41f2cSmrg	    V*) echo vax-dec-vms ; exit ;;
13339bd41f2cSmrg	esac ;;
13349bd41f2cSmrg    *:XENIX:*:SysV)
13359bd41f2cSmrg	echo i386-pc-xenix
13369bd41f2cSmrg	exit ;;
13379bd41f2cSmrg    i*86:skyos:*:*)
13389bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
13399bd41f2cSmrg	exit ;;
13409bd41f2cSmrg    i*86:rdos:*:*)
13419bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-rdos
13429bd41f2cSmrg	exit ;;
13439bd41f2cSmrgesac
13449bd41f2cSmrg
13459bd41f2cSmrg#echo '(No uname command or uname output not recognized.)' 1>&2
13469bd41f2cSmrg#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
13479bd41f2cSmrg
13489bd41f2cSmrgeval $set_cc_for_build
13499bd41f2cSmrgcat >$dummy.c <<EOF
13509bd41f2cSmrg#ifdef _SEQUENT_
13519bd41f2cSmrg# include <sys/types.h>
13529bd41f2cSmrg# include <sys/utsname.h>
13539bd41f2cSmrg#endif
13549bd41f2cSmrgmain ()
13559bd41f2cSmrg{
13569bd41f2cSmrg#if defined (sony)
13579bd41f2cSmrg#if defined (MIPSEB)
13589bd41f2cSmrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
13599bd41f2cSmrg     I don't know....  */
13609bd41f2cSmrg  printf ("mips-sony-bsd\n"); exit (0);
13619bd41f2cSmrg#else
13629bd41f2cSmrg#include <sys/param.h>
13639bd41f2cSmrg  printf ("m68k-sony-newsos%s\n",
13649bd41f2cSmrg#ifdef NEWSOS4
13659bd41f2cSmrg          "4"
13669bd41f2cSmrg#else
13679bd41f2cSmrg	  ""
13689bd41f2cSmrg#endif
13699bd41f2cSmrg         ); exit (0);
13709bd41f2cSmrg#endif
13719bd41f2cSmrg#endif
13729bd41f2cSmrg
13739bd41f2cSmrg#if defined (__arm) && defined (__acorn) && defined (__unix)
13749bd41f2cSmrg  printf ("arm-acorn-riscix\n"); exit (0);
13759bd41f2cSmrg#endif
13769bd41f2cSmrg
13779bd41f2cSmrg#if defined (hp300) && !defined (hpux)
13789bd41f2cSmrg  printf ("m68k-hp-bsd\n"); exit (0);
13799bd41f2cSmrg#endif
13809bd41f2cSmrg
13819bd41f2cSmrg#if defined (NeXT)
13829bd41f2cSmrg#if !defined (__ARCHITECTURE__)
13839bd41f2cSmrg#define __ARCHITECTURE__ "m68k"
13849bd41f2cSmrg#endif
13859bd41f2cSmrg  int version;
13869bd41f2cSmrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
13879bd41f2cSmrg  if (version < 4)
13889bd41f2cSmrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
13899bd41f2cSmrg  else
13909bd41f2cSmrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
13919bd41f2cSmrg  exit (0);
13929bd41f2cSmrg#endif
13939bd41f2cSmrg
13949bd41f2cSmrg#if defined (MULTIMAX) || defined (n16)
13959bd41f2cSmrg#if defined (UMAXV)
13969bd41f2cSmrg  printf ("ns32k-encore-sysv\n"); exit (0);
13979bd41f2cSmrg#else
13989bd41f2cSmrg#if defined (CMU)
13999bd41f2cSmrg  printf ("ns32k-encore-mach\n"); exit (0);
14009bd41f2cSmrg#else
14019bd41f2cSmrg  printf ("ns32k-encore-bsd\n"); exit (0);
14029bd41f2cSmrg#endif
14039bd41f2cSmrg#endif
14049bd41f2cSmrg#endif
14059bd41f2cSmrg
14069bd41f2cSmrg#if defined (__386BSD__)
14079bd41f2cSmrg  printf ("i386-pc-bsd\n"); exit (0);
14089bd41f2cSmrg#endif
14099bd41f2cSmrg
14109bd41f2cSmrg#if defined (sequent)
14119bd41f2cSmrg#if defined (i386)
14129bd41f2cSmrg  printf ("i386-sequent-dynix\n"); exit (0);
14139bd41f2cSmrg#endif
14149bd41f2cSmrg#if defined (ns32000)
14159bd41f2cSmrg  printf ("ns32k-sequent-dynix\n"); exit (0);
14169bd41f2cSmrg#endif
14179bd41f2cSmrg#endif
14189bd41f2cSmrg
14199bd41f2cSmrg#if defined (_SEQUENT_)
14209bd41f2cSmrg    struct utsname un;
14219bd41f2cSmrg
14229bd41f2cSmrg    uname(&un);
14239bd41f2cSmrg
14249bd41f2cSmrg    if (strncmp(un.version, "V2", 2) == 0) {
14259bd41f2cSmrg	printf ("i386-sequent-ptx2\n"); exit (0);
14269bd41f2cSmrg    }
14279bd41f2cSmrg    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
14289bd41f2cSmrg	printf ("i386-sequent-ptx1\n"); exit (0);
14299bd41f2cSmrg    }
14309bd41f2cSmrg    printf ("i386-sequent-ptx\n"); exit (0);
14319bd41f2cSmrg
14329bd41f2cSmrg#endif
14339bd41f2cSmrg
14349bd41f2cSmrg#if defined (vax)
14359bd41f2cSmrg# if !defined (ultrix)
14369bd41f2cSmrg#  include <sys/param.h>
14379bd41f2cSmrg#  if defined (BSD)
14389bd41f2cSmrg#   if BSD == 43
14399bd41f2cSmrg      printf ("vax-dec-bsd4.3\n"); exit (0);
14409bd41f2cSmrg#   else
14419bd41f2cSmrg#    if BSD == 199006
14429bd41f2cSmrg      printf ("vax-dec-bsd4.3reno\n"); exit (0);
14439bd41f2cSmrg#    else
14449bd41f2cSmrg      printf ("vax-dec-bsd\n"); exit (0);
14459bd41f2cSmrg#    endif
14469bd41f2cSmrg#   endif
14479bd41f2cSmrg#  else
14489bd41f2cSmrg    printf ("vax-dec-bsd\n"); exit (0);
14499bd41f2cSmrg#  endif
14509bd41f2cSmrg# else
14519bd41f2cSmrg    printf ("vax-dec-ultrix\n"); exit (0);
14529bd41f2cSmrg# endif
14539bd41f2cSmrg#endif
14549bd41f2cSmrg
14559bd41f2cSmrg#if defined (alliant) && defined (i860)
14569bd41f2cSmrg  printf ("i860-alliant-bsd\n"); exit (0);
14579bd41f2cSmrg#endif
14589bd41f2cSmrg
14599bd41f2cSmrg  exit (1);
14609bd41f2cSmrg}
14619bd41f2cSmrgEOF
14629bd41f2cSmrg
14639bd41f2cSmrg$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
14649bd41f2cSmrg	{ echo "$SYSTEM_NAME"; exit; }
14659bd41f2cSmrg
14669bd41f2cSmrg# Apollos put the system type in the environment.
14679bd41f2cSmrg
14689bd41f2cSmrgtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
14699bd41f2cSmrg
14709bd41f2cSmrg# Convex versions that predate uname can use getsysinfo(1)
14719bd41f2cSmrg
14729bd41f2cSmrgif [ -x /usr/convex/getsysinfo ]
14739bd41f2cSmrgthen
14749bd41f2cSmrg    case `getsysinfo -f cpu_type` in
14759bd41f2cSmrg    c1*)
14769bd41f2cSmrg	echo c1-convex-bsd
14779bd41f2cSmrg	exit ;;
14789bd41f2cSmrg    c2*)
14799bd41f2cSmrg	if getsysinfo -f scalar_acc
14809bd41f2cSmrg	then echo c32-convex-bsd
14819bd41f2cSmrg	else echo c2-convex-bsd
14829bd41f2cSmrg	fi
14839bd41f2cSmrg	exit ;;
14849bd41f2cSmrg    c34*)
14859bd41f2cSmrg	echo c34-convex-bsd
14869bd41f2cSmrg	exit ;;
14879bd41f2cSmrg    c38*)
14889bd41f2cSmrg	echo c38-convex-bsd
14899bd41f2cSmrg	exit ;;
14909bd41f2cSmrg    c4*)
14919bd41f2cSmrg	echo c4-convex-bsd
14929bd41f2cSmrg	exit ;;
14939bd41f2cSmrg    esac
14949bd41f2cSmrgfi
14959bd41f2cSmrg
14969bd41f2cSmrgcat >&2 <<EOF
14979bd41f2cSmrg$0: unable to guess system type
14989bd41f2cSmrg
14999bd41f2cSmrgThis script, last modified $timestamp, has failed to recognize
15009bd41f2cSmrgthe operating system you are using. It is advised that you
15019bd41f2cSmrgdownload the most up to date version of the config scripts from
15029bd41f2cSmrg
15039418810dSmrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
15049bd41f2cSmrgand
15059418810dSmrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
15069bd41f2cSmrg
15079bd41f2cSmrgIf the version you run ($0) is already up to date, please
15089bd41f2cSmrgsend the following data and any information you think might be
15099bd41f2cSmrgpertinent to <config-patches@gnu.org> in order to provide the needed
15109bd41f2cSmrginformation to handle your system.
15119bd41f2cSmrg
15129bd41f2cSmrgconfig.guess timestamp = $timestamp
15139bd41f2cSmrg
15149bd41f2cSmrguname -m = `(uname -m) 2>/dev/null || echo unknown`
15159bd41f2cSmrguname -r = `(uname -r) 2>/dev/null || echo unknown`
15169bd41f2cSmrguname -s = `(uname -s) 2>/dev/null || echo unknown`
15179bd41f2cSmrguname -v = `(uname -v) 2>/dev/null || echo unknown`
15189bd41f2cSmrg
15199bd41f2cSmrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
15209bd41f2cSmrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
15219bd41f2cSmrg
15229bd41f2cSmrghostinfo               = `(hostinfo) 2>/dev/null`
15239bd41f2cSmrg/bin/universe          = `(/bin/universe) 2>/dev/null`
15249bd41f2cSmrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
15259bd41f2cSmrg/bin/arch              = `(/bin/arch) 2>/dev/null`
15269bd41f2cSmrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
15279bd41f2cSmrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
15289bd41f2cSmrg
15299bd41f2cSmrgUNAME_MACHINE = ${UNAME_MACHINE}
15309bd41f2cSmrgUNAME_RELEASE = ${UNAME_RELEASE}
15319bd41f2cSmrgUNAME_SYSTEM  = ${UNAME_SYSTEM}
15329bd41f2cSmrgUNAME_VERSION = ${UNAME_VERSION}
15339bd41f2cSmrgEOF
15349bd41f2cSmrg
15359bd41f2cSmrgexit 1
15369bd41f2cSmrg
15379bd41f2cSmrg# Local variables:
15389bd41f2cSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
15399bd41f2cSmrg# time-stamp-start: "timestamp='"
15409bd41f2cSmrg# time-stamp-format: "%:y-%02m-%02d"
15419bd41f2cSmrg# time-stamp-end: "'"
15429bd41f2cSmrg# End:
1543