config.guess revision 102644
155682Smarkm#! /bin/sh
255682Smarkm# Attempt to guess a canonical system name.
3102644Snectar#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4102644Snectar#   2000, 2001, 2002 Free Software Foundation, Inc.
572445Sassar
6102644Snectartimestamp='2002-07-23'
772445Sassar
855682Smarkm# This file is free software; you can redistribute it and/or modify it
955682Smarkm# under the terms of the GNU General Public License as published by
1055682Smarkm# the Free Software Foundation; either version 2 of the License, or
1155682Smarkm# (at your option) any later version.
1255682Smarkm#
1355682Smarkm# This program is distributed in the hope that it will be useful, but
1455682Smarkm# WITHOUT ANY WARRANTY; without even the implied warranty of
1555682Smarkm# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1655682Smarkm# General Public License for more details.
1755682Smarkm#
1855682Smarkm# You should have received a copy of the GNU General Public License
1955682Smarkm# along with this program; if not, write to the Free Software
2055682Smarkm# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2155682Smarkm#
2255682Smarkm# As a special exception to the GNU General Public License, if you
2355682Smarkm# distribute this file as part of a program that contains a
2455682Smarkm# configuration script generated by Autoconf, you may include it under
2555682Smarkm# the same distribution terms that you use for the rest of that program.
2655682Smarkm
27102644Snectar# Originally written by Per Bothner <per@bothner.com>.
28102644Snectar# Please send patches to <config-patches@gnu.org>.  Submit a context
29102644Snectar# diff and a properly formatted ChangeLog entry.
3055682Smarkm#
3155682Smarkm# This script attempts to guess a canonical system name similar to
3255682Smarkm# config.sub.  If it succeeds, it prints the system name on stdout, and
3355682Smarkm# exits with 0.  Otherwise, it exits with 1.
3455682Smarkm#
3555682Smarkm# The plan is that this can be called by configure scripts if you
3690926Snectar# don't specify an explicit build system type.
3755682Smarkm
3872445Sassarme=`echo "$0" | sed -e 's,.*/,,'`
3972445Sassar
4072445Sassarusage="\
4172445SassarUsage: $0 [OPTION]
4272445Sassar
4390926SnectarOutput the configuration name of the system \`$me' is run on.
4472445Sassar
4572445SassarOperation modes:
4690926Snectar  -h, --help         print this help, then exit
4790926Snectar  -t, --time-stamp   print date of last modification, then exit
4890926Snectar  -v, --version      print version number, then exit
4972445Sassar
5090926SnectarReport bugs and patches to <config-patches@gnu.org>."
5190926Snectar
5290926Snectarversion="\
5390926SnectarGNU config.guess ($timestamp)
5490926Snectar
5590926SnectarOriginally written by Per Bothner.
5690926SnectarCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
5790926SnectarFree Software Foundation, Inc.
5890926Snectar
5990926SnectarThis is free software; see the source for copying conditions.  There is NO
6090926Snectarwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6190926Snectar
6272445Sassarhelp="
6372445SassarTry \`$me --help' for more information."
6472445Sassar
6572445Sassar# Parse command line
6672445Sassarwhile test $# -gt 0 ; do
6790926Snectar  case $1 in
6890926Snectar    --time-stamp | --time* | -t )
6990926Snectar       echo "$timestamp" ; exit 0 ;;
7090926Snectar    --version | -v )
7172445Sassar       echo "$version" ; exit 0 ;;
7272445Sassar    --help | --h* | -h )
7372445Sassar       echo "$usage"; exit 0 ;;
7472445Sassar    -- )     # Stop option processing
7572445Sassar       shift; break ;;
7672445Sassar    - )	# Use stdin as input.
7772445Sassar       break ;;
7872445Sassar    -* )
7990926Snectar       echo "$me: invalid option $1$help" >&2
8072445Sassar       exit 1 ;;
8172445Sassar    * )
8272445Sassar       break ;;
8372445Sassar  esac
8472445Sassardone
8572445Sassar
8672445Sassarif test $# != 0; then
8772445Sassar  echo "$me: too many arguments$help" >&2
8872445Sassar  exit 1
8972445Sassarfi
9072445Sassar
91102644Snectartrap 'exit 1' 1 2 15
9272445Sassar
93102644Snectar# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
94102644Snectar# compiler to aid in system detection is discouraged as it requires
95102644Snectar# temporary files to be created and, as you can see below, it is a
96102644Snectar# headache to deal with in a portable fashion.
9772445Sassar
9890926Snectar# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
9990926Snectar# use `HOST_CC' if defined, but it is deprecated.
10090926Snectar
101102644Snectar# This shell variable is my proudest work .. or something. --bje
102102644Snectar
103102644Snectarset_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
104102644Snectar(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
105102644Snectar   || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
106102644Snectardummy=$tmpdir/dummy ;
107102644Snectarfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
108102644Snectartrap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
109102644Snectarcase $CC_FOR_BUILD,$HOST_CC,$CC in
110102644Snectar ,,)    echo "int x;" > $dummy.c ;
111102644Snectar	for c in cc gcc c89 c99 ; do
112102644Snectar	  if ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; then
11390926Snectar	     CC_FOR_BUILD="$c"; break ;
11490926Snectar	  fi ;
11590926Snectar	done ;
116102644Snectar	rm -f $files ;
11790926Snectar	if test x"$CC_FOR_BUILD" = x ; then
11890926Snectar	  CC_FOR_BUILD=no_compiler_found ;
11990926Snectar	fi
12090926Snectar	;;
12190926Snectar ,,*)   CC_FOR_BUILD=$CC ;;
12290926Snectar ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
123102644Snectaresac ;
124102644Snectarunset files'
12590926Snectar
12655682Smarkm# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
12790926Snectar# (ghazi@noc.rutgers.edu 1994-08-24)
12855682Smarkmif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
12955682Smarkm	PATH=$PATH:/.attbin ; export PATH
13055682Smarkmfi
13155682Smarkm
13255682SmarkmUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
13355682SmarkmUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
134102644SnectarUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
13555682SmarkmUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
13655682Smarkm
13755682Smarkm# Note: order is significant - the case branches are not exclusive.
13855682Smarkm
13955682Smarkmcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
14072445Sassar    *:NetBSD:*:*)
141102644Snectar	# NetBSD (nbsd) targets should (where applicable) match one or
14272445Sassar	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
14372445Sassar	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
14472445Sassar	# switched to ELF, *-*-netbsd* would select the old
14572445Sassar	# object file format.  This provides both forward
14672445Sassar	# compatibility and a consistent mechanism for selecting the
14772445Sassar	# object file format.
148102644Snectar	#
149102644Snectar	# Note: NetBSD doesn't particularly care about the vendor
150102644Snectar	# portion of the name.  We always set it to "unknown".
151102644Snectar	sysctl="sysctl -n hw.machine_arch"
152102644Snectar	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
153102644Snectar	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
154102644Snectar	case "${UNAME_MACHINE_ARCH}" in
155102644Snectar	    armeb) machine=armeb-unknown ;;
156102644Snectar	    arm*) machine=arm-unknown ;;
157102644Snectar	    sh3el) machine=shl-unknown ;;
158102644Snectar	    sh3eb) machine=sh-unknown ;;
159102644Snectar	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
16072445Sassar	esac
16190926Snectar	# The Operating System including object format, if it has switched
16290926Snectar	# to ELF recently, or will in the future.
163102644Snectar	case "${UNAME_MACHINE_ARCH}" in
164102644Snectar	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
16590926Snectar		eval $set_cc_for_build
16690926Snectar		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
16790926Snectar			| grep __ELF__ >/dev/null
16890926Snectar		then
16990926Snectar		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
17090926Snectar		    # Return netbsd for either.  FIX?
17190926Snectar		    os=netbsd
17290926Snectar		else
17390926Snectar		    os=netbsdelf
17490926Snectar		fi
17590926Snectar		;;
17690926Snectar	    *)
17790926Snectar	        os=netbsd
17890926Snectar		;;
17990926Snectar	esac
18072445Sassar	# The OS release
18172445Sassar	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
18272445Sassar	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
18372445Sassar	# contains redundant information, the shorter form:
18472445Sassar	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
18572445Sassar	echo "${machine}-${os}${release}"
18672445Sassar	exit 0 ;;
187102644Snectar    amiga:OpenBSD:*:*)
188102644Snectar	echo m68k-unknown-openbsd${UNAME_RELEASE}
189102644Snectar	exit 0 ;;
190102644Snectar    arc:OpenBSD:*:*)
191102644Snectar	echo mipsel-unknown-openbsd${UNAME_RELEASE}
192102644Snectar	exit 0 ;;
193102644Snectar    hp300:OpenBSD:*:*)
194102644Snectar	echo m68k-unknown-openbsd${UNAME_RELEASE}
195102644Snectar	exit 0 ;;
196102644Snectar    mac68k:OpenBSD:*:*)
197102644Snectar	echo m68k-unknown-openbsd${UNAME_RELEASE}
198102644Snectar	exit 0 ;;
199102644Snectar    macppc:OpenBSD:*:*)
200102644Snectar	echo powerpc-unknown-openbsd${UNAME_RELEASE}
201102644Snectar	exit 0 ;;
202102644Snectar    mvme68k:OpenBSD:*:*)
203102644Snectar	echo m68k-unknown-openbsd${UNAME_RELEASE}
204102644Snectar	exit 0 ;;
205102644Snectar    mvme88k:OpenBSD:*:*)
206102644Snectar	echo m88k-unknown-openbsd${UNAME_RELEASE}
207102644Snectar	exit 0 ;;
208102644Snectar    mvmeppc:OpenBSD:*:*)
209102644Snectar	echo powerpc-unknown-openbsd${UNAME_RELEASE}
210102644Snectar	exit 0 ;;
211102644Snectar    pmax:OpenBSD:*:*)
212102644Snectar	echo mipsel-unknown-openbsd${UNAME_RELEASE}
213102644Snectar	exit 0 ;;
214102644Snectar    sgi:OpenBSD:*:*)
215102644Snectar	echo mipseb-unknown-openbsd${UNAME_RELEASE}
216102644Snectar	exit 0 ;;
217102644Snectar    sun3:OpenBSD:*:*)
218102644Snectar	echo m68k-unknown-openbsd${UNAME_RELEASE}
219102644Snectar	exit 0 ;;
220102644Snectar    wgrisc:OpenBSD:*:*)
221102644Snectar	echo mipsel-unknown-openbsd${UNAME_RELEASE}
222102644Snectar	exit 0 ;;
223102644Snectar    *:OpenBSD:*:*)
224102644Snectar	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
225102644Snectar	exit 0 ;;
22655682Smarkm    alpha:OSF1:*:*)
22755682Smarkm	if test $UNAME_RELEASE = "V4.0"; then
22855682Smarkm		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
22955682Smarkm	fi
23055682Smarkm	# A Vn.n version is a released version.
23155682Smarkm	# A Tn.n version is a released field test version.
23255682Smarkm	# A Xn.n version is an unreleased experimental baselevel.
23355682Smarkm	# 1.2 uses "1.2" for uname -r.
234102644Snectar	eval $set_cc_for_build
23555682Smarkm	cat <<EOF >$dummy.s
23672445Sassar	.data
23772445Sassar\$Lformat:
23872445Sassar	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
23972445Sassar
24072445Sassar	.text
24155682Smarkm	.globl main
24272445Sassar	.align 4
24355682Smarkm	.ent main
24455682Smarkmmain:
24572445Sassar	.frame \$30,16,\$26,0
24672445Sassar	ldgp \$29,0(\$27)
24772445Sassar	.prologue 1
24872445Sassar	.long 0x47e03d80 # implver \$0
24972445Sassar	lda \$2,-1
25072445Sassar	.long 0x47e20c21 # amask \$2,\$1
25172445Sassar	lda \$16,\$Lformat
25272445Sassar	mov \$0,\$17
25372445Sassar	not \$1,\$18
25472445Sassar	jsr \$26,printf
25572445Sassar	ldgp \$29,0(\$26)
25672445Sassar	mov 0,\$16
25772445Sassar	jsr \$26,exit
25855682Smarkm	.end main
25955682SmarkmEOF
26072445Sassar	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
26155682Smarkm	if test "$?" = 0 ; then
262102644Snectar		case `$dummy` in
26372445Sassar			0-0)
26455682Smarkm				UNAME_MACHINE="alpha"
26555682Smarkm				;;
26672445Sassar			1-0)
26755682Smarkm				UNAME_MACHINE="alphaev5"
26855682Smarkm				;;
26972445Sassar			1-1)
27055682Smarkm				UNAME_MACHINE="alphaev56"
27155682Smarkm				;;
27272445Sassar			1-101)
27355682Smarkm				UNAME_MACHINE="alphapca56"
27455682Smarkm				;;
27572445Sassar			2-303)
27655682Smarkm				UNAME_MACHINE="alphaev6"
27755682Smarkm				;;
27872445Sassar			2-307)
27972445Sassar				UNAME_MACHINE="alphaev67"
28072445Sassar				;;
28190926Snectar			2-1307)
28290926Snectar				UNAME_MACHINE="alphaev68"
28390926Snectar				;;
284102644Snectar			3-1307)
285102644Snectar				UNAME_MACHINE="alphaev7"
286102644Snectar				;;
28755682Smarkm		esac
28855682Smarkm	fi
289102644Snectar	rm -f $dummy.s $dummy && rmdir $tmpdir
29072445Sassar	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
29155682Smarkm	exit 0 ;;
29272445Sassar    Alpha\ *:Windows_NT*:*)
29372445Sassar	# How do we know it's Interix rather than the generic POSIX subsystem?
29472445Sassar	# Should we change UNAME_MACHINE based on the output of uname instead
29572445Sassar	# of the specific Alpha model?
29672445Sassar	echo alpha-pc-interix
29772445Sassar	exit 0 ;;
29855682Smarkm    21064:Windows_NT:50:3)
29955682Smarkm	echo alpha-dec-winnt3.5
30055682Smarkm	exit 0 ;;
30155682Smarkm    Amiga*:UNIX_System_V:4.0:*)
30272445Sassar	echo m68k-unknown-sysv4
30355682Smarkm	exit 0;;
30455682Smarkm    *:[Aa]miga[Oo][Ss]:*:*)
30555682Smarkm	echo ${UNAME_MACHINE}-unknown-amigaos
30655682Smarkm	exit 0 ;;
307102644Snectar    *:[Mm]orph[Oo][Ss]:*:*)
308102644Snectar	echo ${UNAME_MACHINE}-unknown-morphos
30955682Smarkm	exit 0 ;;
31072445Sassar    *:OS/390:*:*)
31172445Sassar	echo i370-ibm-openedition
31272445Sassar	exit 0 ;;
31355682Smarkm    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
31455682Smarkm	echo arm-acorn-riscix${UNAME_RELEASE}
31555682Smarkm	exit 0;;
31690926Snectar    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
31755682Smarkm	echo hppa1.1-hitachi-hiuxmpp
31855682Smarkm	exit 0;;
31972445Sassar    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
32055682Smarkm	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
32155682Smarkm	if test "`(/bin/universe) 2>/dev/null`" = att ; then
32255682Smarkm		echo pyramid-pyramid-sysv3
32355682Smarkm	else
32455682Smarkm		echo pyramid-pyramid-bsd
32555682Smarkm	fi
32655682Smarkm	exit 0 ;;
32772445Sassar    NILE*:*:*:dcosx)
32855682Smarkm	echo pyramid-pyramid-svr4
32955682Smarkm	exit 0 ;;
330102644Snectar    DRS?6000:UNIX_SV:4.2*:7*)
331102644Snectar	case `/usr/bin/uname -p` in
332102644Snectar	    sparc) echo sparc-icl-nx7 && exit 0 ;;
333102644Snectar	esac ;;
33455682Smarkm    sun4H:SunOS:5.*:*)
33555682Smarkm	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
33655682Smarkm	exit 0 ;;
33755682Smarkm    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
33855682Smarkm	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
33955682Smarkm	exit 0 ;;
34055682Smarkm    i86pc:SunOS:5.*:*)
34155682Smarkm	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
34255682Smarkm	exit 0 ;;
34355682Smarkm    sun4*:SunOS:6*:*)
34455682Smarkm	# According to config.sub, this is the proper way to canonicalize
34555682Smarkm	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
34655682Smarkm	# it's likely to be more like Solaris than SunOS4.
34755682Smarkm	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
34855682Smarkm	exit 0 ;;
34955682Smarkm    sun4*:SunOS:*:*)
35055682Smarkm	case "`/usr/bin/arch -k`" in
35155682Smarkm	    Series*|S4*)
35255682Smarkm		UNAME_RELEASE=`uname -v`
35355682Smarkm		;;
35455682Smarkm	esac
35555682Smarkm	# Japanese Language versions have a version number like `4.1.3-JL'.
35655682Smarkm	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
35755682Smarkm	exit 0 ;;
35855682Smarkm    sun3*:SunOS:*:*)
35955682Smarkm	echo m68k-sun-sunos${UNAME_RELEASE}
36055682Smarkm	exit 0 ;;
36155682Smarkm    sun*:*:4.2BSD:*)
362102644Snectar	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
36355682Smarkm	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
36455682Smarkm	case "`/bin/arch`" in
36555682Smarkm	    sun3)
36655682Smarkm		echo m68k-sun-sunos${UNAME_RELEASE}
36755682Smarkm		;;
36855682Smarkm	    sun4)
36955682Smarkm		echo sparc-sun-sunos${UNAME_RELEASE}
37055682Smarkm		;;
37155682Smarkm	esac
37255682Smarkm	exit 0 ;;
37355682Smarkm    aushp:SunOS:*:*)
37455682Smarkm	echo sparc-auspex-sunos${UNAME_RELEASE}
37555682Smarkm	exit 0 ;;
37672445Sassar    # The situation for MiNT is a little confusing.  The machine name
37772445Sassar    # can be virtually everything (everything which is not
378102644Snectar    # "atarist" or "atariste" at least should have a processor
37972445Sassar    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
38072445Sassar    # to the lowercase version "mint" (or "freemint").  Finally
38172445Sassar    # the system name "TOS" denotes a system which is actually not
38272445Sassar    # MiNT.  But MiNT is downward compatible to TOS, so this should
38372445Sassar    # be no problem.
38472445Sassar    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
38572445Sassar        echo m68k-atari-mint${UNAME_RELEASE}
38655682Smarkm	exit 0 ;;
38772445Sassar    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
38872445Sassar	echo m68k-atari-mint${UNAME_RELEASE}
38972445Sassar        exit 0 ;;
39072445Sassar    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
39172445Sassar        echo m68k-atari-mint${UNAME_RELEASE}
39272445Sassar	exit 0 ;;
39372445Sassar    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
39472445Sassar        echo m68k-milan-mint${UNAME_RELEASE}
39572445Sassar        exit 0 ;;
39672445Sassar    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
39772445Sassar        echo m68k-hades-mint${UNAME_RELEASE}
39872445Sassar        exit 0 ;;
39972445Sassar    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
40072445Sassar        echo m68k-unknown-mint${UNAME_RELEASE}
40172445Sassar        exit 0 ;;
40255682Smarkm    powerpc:machten:*:*)
40355682Smarkm	echo powerpc-apple-machten${UNAME_RELEASE}
40455682Smarkm	exit 0 ;;
40555682Smarkm    RISC*:Mach:*:*)
40655682Smarkm	echo mips-dec-mach_bsd4.3
40755682Smarkm	exit 0 ;;
40855682Smarkm    RISC*:ULTRIX:*:*)
40955682Smarkm	echo mips-dec-ultrix${UNAME_RELEASE}
41055682Smarkm	exit 0 ;;
41155682Smarkm    VAX*:ULTRIX*:*:*)
41255682Smarkm	echo vax-dec-ultrix${UNAME_RELEASE}
41355682Smarkm	exit 0 ;;
41472445Sassar    2020:CLIX:*:* | 2430:CLIX:*:*)
41555682Smarkm	echo clipper-intergraph-clix${UNAME_RELEASE}
41655682Smarkm	exit 0 ;;
41755682Smarkm    mips:*:*:UMIPS | mips:*:*:RISCos)
41890926Snectar	eval $set_cc_for_build
41955682Smarkm	sed 's/^	//' << EOF >$dummy.c
42072445Sassar#ifdef __cplusplus
42172445Sassar#include <stdio.h>  /* for printf() prototype */
42272445Sassar	int main (int argc, char *argv[]) {
42372445Sassar#else
42472445Sassar	int main (argc, argv) int argc; char *argv[]; {
42572445Sassar#endif
42655682Smarkm	#if defined (host_mips) && defined (MIPSEB)
42755682Smarkm	#if defined (SYSTYPE_SYSV)
42855682Smarkm	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
42955682Smarkm	#endif
43055682Smarkm	#if defined (SYSTYPE_SVR4)
43155682Smarkm	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
43255682Smarkm	#endif
43355682Smarkm	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
43455682Smarkm	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
43555682Smarkm	#endif
43655682Smarkm	#endif
43755682Smarkm	  exit (-1);
43855682Smarkm	}
43955682SmarkmEOF
44072445Sassar	$CC_FOR_BUILD $dummy.c -o $dummy \
441102644Snectar	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
442102644Snectar	  && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
443102644Snectar	rm -f $dummy.c $dummy && rmdir $tmpdir
44455682Smarkm	echo mips-mips-riscos${UNAME_RELEASE}
44555682Smarkm	exit 0 ;;
44690926Snectar    Motorola:PowerMAX_OS:*:*)
44790926Snectar	echo powerpc-motorola-powermax
44890926Snectar	exit 0 ;;
449102644Snectar    Night_Hawk:*:*:PowerMAX_OS)
450102644Snectar	echo powerpc-harris-powermax
451102644Snectar	exit 0 ;;
45255682Smarkm    Night_Hawk:Power_UNIX:*:*)
45355682Smarkm	echo powerpc-harris-powerunix
45455682Smarkm	exit 0 ;;
45555682Smarkm    m88k:CX/UX:7*:*)
45655682Smarkm	echo m88k-harris-cxux7
45755682Smarkm	exit 0 ;;
45855682Smarkm    m88k:*:4*:R4*)
45955682Smarkm	echo m88k-motorola-sysv4
46055682Smarkm	exit 0 ;;
46155682Smarkm    m88k:*:3*:R3*)
46255682Smarkm	echo m88k-motorola-sysv3
46355682Smarkm	exit 0 ;;
46455682Smarkm    AViiON:dgux:*:*)
46555682Smarkm        # DG/UX returns AViiON for all architectures
46655682Smarkm        UNAME_PROCESSOR=`/usr/bin/uname -p`
467102644Snectar	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
46872445Sassar	then
46972445Sassar	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
47072445Sassar	       [ ${TARGET_BINARY_INTERFACE}x = x ]
47172445Sassar	    then
47255682Smarkm		echo m88k-dg-dgux${UNAME_RELEASE}
47372445Sassar	    else
47472445Sassar		echo m88k-dg-dguxbcs${UNAME_RELEASE}
47572445Sassar	    fi
47655682Smarkm	else
47772445Sassar	    echo i586-dg-dgux${UNAME_RELEASE}
47855682Smarkm	fi
47955682Smarkm 	exit 0 ;;
48055682Smarkm    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
48155682Smarkm	echo m88k-dolphin-sysv3
48255682Smarkm	exit 0 ;;
48355682Smarkm    M88*:*:R3*:*)
48455682Smarkm	# Delta 88k system running SVR3
48555682Smarkm	echo m88k-motorola-sysv3
48655682Smarkm	exit 0 ;;
48755682Smarkm    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
48855682Smarkm	echo m88k-tektronix-sysv3
48955682Smarkm	exit 0 ;;
49055682Smarkm    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
49155682Smarkm	echo m68k-tektronix-bsd
49255682Smarkm	exit 0 ;;
49355682Smarkm    *:IRIX*:*:*)
49455682Smarkm	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
49555682Smarkm	exit 0 ;;
49655682Smarkm    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
49755682Smarkm	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
49855682Smarkm	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
49990926Snectar    i*86:AIX:*:*)
50055682Smarkm	echo i386-ibm-aix
50155682Smarkm	exit 0 ;;
50290926Snectar    ia64:AIX:*:*)
50390926Snectar	if [ -x /usr/bin/oslevel ] ; then
50490926Snectar		IBM_REV=`/usr/bin/oslevel`
50590926Snectar	else
50690926Snectar		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
50790926Snectar	fi
50890926Snectar	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
50990926Snectar	exit 0 ;;
51055682Smarkm    *:AIX:2:3)
51155682Smarkm	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
51290926Snectar		eval $set_cc_for_build
51355682Smarkm		sed 's/^		//' << EOF >$dummy.c
51455682Smarkm		#include <sys/systemcfg.h>
51555682Smarkm
51655682Smarkm		main()
51755682Smarkm			{
51855682Smarkm			if (!__power_pc())
51955682Smarkm				exit(1);
52055682Smarkm			puts("powerpc-ibm-aix3.2.5");
52155682Smarkm			exit(0);
52255682Smarkm			}
52355682SmarkmEOF
524102644Snectar		$CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
525102644Snectar		rm -f $dummy.c $dummy && rmdir $tmpdir
52655682Smarkm		echo rs6000-ibm-aix3.2.5
52755682Smarkm	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
52855682Smarkm		echo rs6000-ibm-aix3.2.4
52955682Smarkm	else
53055682Smarkm		echo rs6000-ibm-aix3.2
53155682Smarkm	fi
53255682Smarkm	exit 0 ;;
53390926Snectar    *:AIX:*:[45])
534102644Snectar	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
53590926Snectar	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
53655682Smarkm		IBM_ARCH=rs6000
53755682Smarkm	else
53855682Smarkm		IBM_ARCH=powerpc
53955682Smarkm	fi
54055682Smarkm	if [ -x /usr/bin/oslevel ] ; then
54155682Smarkm		IBM_REV=`/usr/bin/oslevel`
54255682Smarkm	else
54390926Snectar		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
54455682Smarkm	fi
54555682Smarkm	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
54655682Smarkm	exit 0 ;;
54755682Smarkm    *:AIX:*:*)
54855682Smarkm	echo rs6000-ibm-aix
54955682Smarkm	exit 0 ;;
55055682Smarkm    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
55155682Smarkm	echo romp-ibm-bsd4.4
55255682Smarkm	exit 0 ;;
55372445Sassar    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
55455682Smarkm	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
55555682Smarkm	exit 0 ;;                           # report: romp-ibm BSD 4.3
55655682Smarkm    *:BOSX:*:*)
55755682Smarkm	echo rs6000-bull-bosx
55855682Smarkm	exit 0 ;;
55955682Smarkm    DPX/2?00:B.O.S.:*:*)
56055682Smarkm	echo m68k-bull-sysv3
56155682Smarkm	exit 0 ;;
56255682Smarkm    9000/[34]??:4.3bsd:1.*:*)
56355682Smarkm	echo m68k-hp-bsd
56455682Smarkm	exit 0 ;;
56555682Smarkm    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
56655682Smarkm	echo m68k-hp-bsd4.4
56755682Smarkm	exit 0 ;;
56855682Smarkm    9000/[34678]??:HP-UX:*:*)
56990926Snectar	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
57055682Smarkm	case "${UNAME_MACHINE}" in
57155682Smarkm	    9000/31? )            HP_ARCH=m68000 ;;
57255682Smarkm	    9000/[34]?? )         HP_ARCH=m68k ;;
57372445Sassar	    9000/[678][0-9][0-9])
574102644Snectar		if [ -x /usr/bin/getconf ]; then
575102644Snectar		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
57690926Snectar                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
57790926Snectar                    case "${sc_cpu_version}" in
57890926Snectar                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
57990926Snectar                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
58090926Snectar                      532)                      # CPU_PA_RISC2_0
58190926Snectar                        case "${sc_kernel_bits}" in
58290926Snectar                          32) HP_ARCH="hppa2.0n" ;;
58390926Snectar                          64) HP_ARCH="hppa2.0w" ;;
584102644Snectar			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
58590926Snectar                        esac ;;
58690926Snectar                    esac
587102644Snectar		fi
588102644Snectar		if [ "${HP_ARCH}" = "" ]; then
589102644Snectar		    eval $set_cc_for_build
590102644Snectar		    sed 's/^              //' << EOF >$dummy.c
59172445Sassar
59272445Sassar              #define _HPUX_SOURCE
59355682Smarkm              #include <stdlib.h>
59455682Smarkm              #include <unistd.h>
59572445Sassar
59655682Smarkm              int main ()
59755682Smarkm              {
59855682Smarkm              #if defined(_SC_KERNEL_BITS)
59955682Smarkm                  long bits = sysconf(_SC_KERNEL_BITS);
60072445Sassar              #endif
60155682Smarkm                  long cpu  = sysconf (_SC_CPU_VERSION);
60272445Sassar
60372445Sassar                  switch (cpu)
60455682Smarkm              	{
60555682Smarkm              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
60655682Smarkm              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
60772445Sassar              	case CPU_PA_RISC2_0:
60855682Smarkm              #if defined(_SC_KERNEL_BITS)
60972445Sassar              	    switch (bits)
61055682Smarkm              		{
61155682Smarkm              		case 64: puts ("hppa2.0w"); break;
61255682Smarkm              		case 32: puts ("hppa2.0n"); break;
61355682Smarkm              		default: puts ("hppa2.0"); break;
61455682Smarkm              		} break;
61555682Smarkm              #else  /* !defined(_SC_KERNEL_BITS) */
61655682Smarkm              	    puts ("hppa2.0"); break;
61772445Sassar              #endif
61855682Smarkm              	default: puts ("hppa1.0"); break;
61955682Smarkm              	}
62055682Smarkm                  exit (0);
62155682Smarkm              }
62255682SmarkmEOF
623102644Snectar		    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`$dummy`
624102644Snectar		    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
625102644Snectar		    rm -f $dummy.c $dummy && rmdir $tmpdir
626102644Snectar		fi ;;
62755682Smarkm	esac
62855682Smarkm	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
62955682Smarkm	exit 0 ;;
63090926Snectar    ia64:HP-UX:*:*)
63190926Snectar	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
63290926Snectar	echo ia64-hp-hpux${HPUX_REV}
63390926Snectar	exit 0 ;;
63455682Smarkm    3050*:HI-UX:*:*)
63590926Snectar	eval $set_cc_for_build
63655682Smarkm	sed 's/^	//' << EOF >$dummy.c
63755682Smarkm	#include <unistd.h>
63855682Smarkm	int
63955682Smarkm	main ()
64055682Smarkm	{
64155682Smarkm	  long cpu = sysconf (_SC_CPU_VERSION);
64255682Smarkm	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
64355682Smarkm	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
64455682Smarkm	     results, however.  */
64555682Smarkm	  if (CPU_IS_PA_RISC (cpu))
64655682Smarkm	    {
64755682Smarkm	      switch (cpu)
64855682Smarkm		{
64955682Smarkm		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
65055682Smarkm		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
65155682Smarkm		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
65255682Smarkm		  default: puts ("hppa-hitachi-hiuxwe2"); break;
65355682Smarkm		}
65455682Smarkm	    }
65555682Smarkm	  else if (CPU_IS_HP_MC68K (cpu))
65655682Smarkm	    puts ("m68k-hitachi-hiuxwe2");
65755682Smarkm	  else puts ("unknown-hitachi-hiuxwe2");
65855682Smarkm	  exit (0);
65955682Smarkm	}
66055682SmarkmEOF
661102644Snectar	$CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
662102644Snectar	rm -f $dummy.c $dummy && rmdir $tmpdir
66355682Smarkm	echo unknown-hitachi-hiuxwe2
66455682Smarkm	exit 0 ;;
66555682Smarkm    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
66655682Smarkm	echo hppa1.1-hp-bsd
66755682Smarkm	exit 0 ;;
66855682Smarkm    9000/8??:4.3bsd:*:*)
66955682Smarkm	echo hppa1.0-hp-bsd
67055682Smarkm	exit 0 ;;
67190926Snectar    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
67272445Sassar	echo hppa1.0-hp-mpeix
67372445Sassar	exit 0 ;;
67455682Smarkm    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
67555682Smarkm	echo hppa1.1-hp-osf
67655682Smarkm	exit 0 ;;
67755682Smarkm    hp8??:OSF1:*:*)
67855682Smarkm	echo hppa1.0-hp-osf
67955682Smarkm	exit 0 ;;
68090926Snectar    i*86:OSF1:*:*)
68155682Smarkm	if [ -x /usr/sbin/sysversion ] ; then
68255682Smarkm	    echo ${UNAME_MACHINE}-unknown-osf1mk
68355682Smarkm	else
68455682Smarkm	    echo ${UNAME_MACHINE}-unknown-osf1
68555682Smarkm	fi
68655682Smarkm	exit 0 ;;
68755682Smarkm    parisc*:Lites*:*:*)
68855682Smarkm	echo hppa1.1-hp-lites
68955682Smarkm	exit 0 ;;
69055682Smarkm    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
69155682Smarkm	echo c1-convex-bsd
69255682Smarkm        exit 0 ;;
69355682Smarkm    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
69455682Smarkm	if getsysinfo -f scalar_acc
69555682Smarkm	then echo c32-convex-bsd
69655682Smarkm	else echo c2-convex-bsd
69755682Smarkm	fi
69855682Smarkm        exit 0 ;;
69955682Smarkm    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
70055682Smarkm	echo c34-convex-bsd
70155682Smarkm        exit 0 ;;
70255682Smarkm    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
70355682Smarkm	echo c38-convex-bsd
70455682Smarkm        exit 0 ;;
70555682Smarkm    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
70655682Smarkm	echo c4-convex-bsd
70755682Smarkm        exit 0 ;;
70855682Smarkm    CRAY*Y-MP:*:*:*)
70990926Snectar	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
71055682Smarkm	exit 0 ;;
71155682Smarkm    CRAY*[A-Z]90:*:*:*)
71255682Smarkm	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
71355682Smarkm	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
71490926Snectar	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
71590926Snectar	      -e 's/\.[^.]*$/.X/'
71655682Smarkm	exit 0 ;;
71755682Smarkm    CRAY*TS:*:*:*)
71872445Sassar	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
71955682Smarkm	exit 0 ;;
72090926Snectar    CRAY*T3D:*:*:*)
72172445Sassar	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
72255682Smarkm	exit 0 ;;
72390926Snectar    CRAY*T3E:*:*:*)
72490926Snectar	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
72590926Snectar	exit 0 ;;
72672445Sassar    CRAY*SV1:*:*:*)
727102644Snectar	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
72872445Sassar	exit 0 ;;
72990926Snectar    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
73090926Snectar	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
73172445Sassar        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
73255682Smarkm        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
73390926Snectar        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
73455682Smarkm        exit 0 ;;
73590926Snectar    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
73672445Sassar	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
73772445Sassar	exit 0 ;;
73855682Smarkm    sparc*:BSD/OS:*:*)
73955682Smarkm	echo sparc-unknown-bsdi${UNAME_RELEASE}
74055682Smarkm	exit 0 ;;
74155682Smarkm    *:BSD/OS:*:*)
74255682Smarkm	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
74355682Smarkm	exit 0 ;;
74455682Smarkm    *:FreeBSD:*:*)
745102644Snectar	# Determine whether the default compiler uses glibc.
746102644Snectar	eval $set_cc_for_build
747102644Snectar	sed 's/^	//' << EOF >$dummy.c
748102644Snectar	#include <features.h>
749102644Snectar	#if __GLIBC__ >= 2
750102644Snectar	LIBC=gnu
751102644Snectar	#else
752102644Snectar	LIBC=
753102644Snectar	#endif
754102644SnectarEOF
755102644Snectar	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
756102644Snectar	rm -f $dummy.c && rmdir $tmpdir
757102644Snectar	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
75855682Smarkm	exit 0 ;;
75955682Smarkm    i*:CYGWIN*:*)
76055682Smarkm	echo ${UNAME_MACHINE}-pc-cygwin
76155682Smarkm	exit 0 ;;
76255682Smarkm    i*:MINGW*:*)
76355682Smarkm	echo ${UNAME_MACHINE}-pc-mingw32
76455682Smarkm	exit 0 ;;
76572445Sassar    i*:PW*:*)
76672445Sassar	echo ${UNAME_MACHINE}-pc-pw32
76772445Sassar	exit 0 ;;
768102644Snectar    x86:Interix*:3*)
769102644Snectar	echo i386-pc-interix3
770102644Snectar	exit 0 ;;
77172445Sassar    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
77272445Sassar	# How do we know it's Interix rather than the generic POSIX subsystem?
77372445Sassar	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
77472445Sassar	# UNAME_MACHINE based on the output of uname instead of i386?
77572445Sassar	echo i386-pc-interix
77672445Sassar	exit 0 ;;
77772445Sassar    i*:UWIN*:*)
77872445Sassar	echo ${UNAME_MACHINE}-pc-uwin
77972445Sassar	exit 0 ;;
78055682Smarkm    p*:CYGWIN*:*)
78155682Smarkm	echo powerpcle-unknown-cygwin
78255682Smarkm	exit 0 ;;
78355682Smarkm    prep*:SunOS:5.*:*)
78455682Smarkm	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
78555682Smarkm	exit 0 ;;
78655682Smarkm    *:GNU:*:*)
78755682Smarkm	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
78855682Smarkm	exit 0 ;;
78972445Sassar    i*86:Minix:*:*)
79072445Sassar	echo ${UNAME_MACHINE}-pc-minix
79172445Sassar	exit 0 ;;
79290926Snectar    arm*:Linux:*:*)
79390926Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu
79490926Snectar	exit 0 ;;
79590926Snectar    ia64:Linux:*:*)
796102644Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu
79790926Snectar	exit 0 ;;
79890926Snectar    m68*:Linux:*:*)
79990926Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu
80090926Snectar	exit 0 ;;
80190926Snectar    mips:Linux:*:*)
802102644Snectar	eval $set_cc_for_build
803102644Snectar	sed 's/^	//' << EOF >$dummy.c
804102644Snectar	#undef CPU
805102644Snectar	#undef mips
806102644Snectar	#undef mipsel
807102644Snectar	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
808102644Snectar	CPU=mipsel
809102644Snectar	#else
810102644Snectar	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
811102644Snectar	CPU=mips
812102644Snectar	#else
813102644Snectar	CPU=
814102644Snectar	#endif
815102644Snectar	#endif
816102644SnectarEOF
817102644Snectar	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
818102644Snectar	rm -f $dummy.c && rmdir $tmpdir
819102644Snectar	test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
82090926Snectar	;;
82190926Snectar    ppc:Linux:*:*)
82290926Snectar	echo powerpc-unknown-linux-gnu
82390926Snectar	exit 0 ;;
82490926Snectar    ppc64:Linux:*:*)
82590926Snectar	echo powerpc64-unknown-linux-gnu
82690926Snectar	exit 0 ;;
82790926Snectar    alpha:Linux:*:*)
82890926Snectar	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
82990926Snectar	  EV5)   UNAME_MACHINE=alphaev5 ;;
83090926Snectar	  EV56)  UNAME_MACHINE=alphaev56 ;;
83190926Snectar	  PCA56) UNAME_MACHINE=alphapca56 ;;
83290926Snectar	  PCA57) UNAME_MACHINE=alphapca56 ;;
83390926Snectar	  EV6)   UNAME_MACHINE=alphaev6 ;;
83490926Snectar	  EV67)  UNAME_MACHINE=alphaev67 ;;
83590926Snectar	  EV68*) UNAME_MACHINE=alphaev68 ;;
83690926Snectar        esac
83790926Snectar	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
83890926Snectar	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
83990926Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
84090926Snectar	exit 0 ;;
84190926Snectar    parisc:Linux:*:* | hppa:Linux:*:*)
84290926Snectar	# Look for CPU level
84390926Snectar	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
84490926Snectar	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
84590926Snectar	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
84690926Snectar	  *)    echo hppa-unknown-linux-gnu ;;
84790926Snectar	esac
84890926Snectar	exit 0 ;;
84990926Snectar    parisc64:Linux:*:* | hppa64:Linux:*:*)
85090926Snectar	echo hppa64-unknown-linux-gnu
85190926Snectar	exit 0 ;;
85290926Snectar    s390:Linux:*:* | s390x:Linux:*:*)
85390926Snectar	echo ${UNAME_MACHINE}-ibm-linux
85490926Snectar	exit 0 ;;
85590926Snectar    sh*:Linux:*:*)
85690926Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu
85790926Snectar	exit 0 ;;
85890926Snectar    sparc:Linux:*:* | sparc64:Linux:*:*)
85990926Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu
86090926Snectar	exit 0 ;;
86190926Snectar    x86_64:Linux:*:*)
86290926Snectar	echo x86_64-unknown-linux-gnu
86390926Snectar	exit 0 ;;
86490926Snectar    i*86:Linux:*:*)
86555682Smarkm	# The BFD linker knows what the default object file format is, so
86672445Sassar	# first see if it will tell us. cd to the root directory to prevent
86772445Sassar	# problems with other programs or directories called `ld' in the path.
868102644Snectar	# Set LC_ALL=C to ensure ld outputs messages in English.
869102644Snectar	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
87090926Snectar			 | sed -ne '/supported targets:/!d
87155682Smarkm				    s/[ 	][ 	]*/ /g
87290926Snectar				    s/.*supported targets: *//
87355682Smarkm				    s/ .*//
87455682Smarkm				    p'`
87590926Snectar        case "$ld_supported_targets" in
87690926Snectar	  elf32-i386)
87790926Snectar		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
87872445Sassar		;;
87990926Snectar	  a.out-i386-linux)
88072445Sassar		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
881102644Snectar		exit 0 ;;
88290926Snectar	  coff-i386)
88372445Sassar		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
88490926Snectar		exit 0 ;;
88590926Snectar	  "")
88690926Snectar		# Either a pre-BFD a.out linker (linux-gnuoldld) or
88790926Snectar		# one that does not give us useful --help.
88890926Snectar		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
88990926Snectar		exit 0 ;;
89055682Smarkm	esac
89190926Snectar	# Determine whether the default compiler is a.out or elf
89290926Snectar	eval $set_cc_for_build
893102644Snectar	sed 's/^	//' << EOF >$dummy.c
894102644Snectar	#include <features.h>
895102644Snectar	#ifdef __ELF__
896102644Snectar	# ifdef __GLIBC__
897102644Snectar	#  if __GLIBC__ >= 2
898102644Snectar	LIBC=gnu
899102644Snectar	#  else
900102644Snectar	LIBC=gnulibc1
901102644Snectar	#  endif
902102644Snectar	# else
903102644Snectar	LIBC=gnulibc1
904102644Snectar	# endif
905102644Snectar	#else
906102644Snectar	#ifdef __INTEL_COMPILER
907102644Snectar	LIBC=gnu
908102644Snectar	#else
909102644Snectar	LIBC=gnuaout
910102644Snectar	#endif
911102644Snectar	#endif
91255682SmarkmEOF
913102644Snectar	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
914102644Snectar	rm -f $dummy.c && rmdir $tmpdir
915102644Snectar	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
91690926Snectar	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
91790926Snectar	;;
91890926Snectar    i*86:DYNIX/ptx:4*:*)
91990926Snectar	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
92090926Snectar	# earlier versions are messed up and put the nodename in both
92190926Snectar	# sysname and nodename.
92255682Smarkm	echo i386-sequent-sysv4
92355682Smarkm	exit 0 ;;
92490926Snectar    i*86:UNIX_SV:4.2MP:2.*)
92555682Smarkm        # Unixware is an offshoot of SVR4, but it has its own version
92655682Smarkm        # number series starting with 2...
92755682Smarkm        # I am not positive that other SVR4 systems won't match this,
92855682Smarkm	# I just have to hope.  -- rms.
92955682Smarkm        # Use sysv4.2uw... so that sysv4* matches it.
93055682Smarkm	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
93155682Smarkm	exit 0 ;;
93290926Snectar    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
93372445Sassar	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
93455682Smarkm	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
93572445Sassar		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
93655682Smarkm	else
93772445Sassar		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
93855682Smarkm	fi
93955682Smarkm	exit 0 ;;
94090926Snectar    i*86:*:5:[78]*)
94190926Snectar	case `/bin/uname -X | grep "^Machine"` in
94290926Snectar	    *486*)	     UNAME_MACHINE=i486 ;;
94390926Snectar	    *Pentium)	     UNAME_MACHINE=i586 ;;
94490926Snectar	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
94590926Snectar	esac
94690926Snectar	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
94772445Sassar	exit 0 ;;
94890926Snectar    i*86:*:3.2:*)
94955682Smarkm	if test -f /usr/options/cb.name; then
95055682Smarkm		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
95155682Smarkm		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
95255682Smarkm	elif /bin/uname -X 2>/dev/null >/dev/null ; then
953102644Snectar		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
954102644Snectar		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
955102644Snectar		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
95655682Smarkm			&& UNAME_MACHINE=i586
957102644Snectar		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
95872445Sassar			&& UNAME_MACHINE=i686
959102644Snectar		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
96072445Sassar			&& UNAME_MACHINE=i686
96155682Smarkm		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
96255682Smarkm	else
96355682Smarkm		echo ${UNAME_MACHINE}-pc-sysv32
96455682Smarkm	fi
96555682Smarkm	exit 0 ;;
96690926Snectar    i*86:*DOS:*:*)
96772445Sassar	echo ${UNAME_MACHINE}-pc-msdosdjgpp
96855682Smarkm	exit 0 ;;
96955682Smarkm    pc:*:*:*)
97072445Sassar	# Left here for compatibility:
97155682Smarkm        # uname -m prints for DJGPP always 'pc', but it prints nothing about
97255682Smarkm        # the processor, so we play safe by assuming i386.
97355682Smarkm	echo i386-pc-msdosdjgpp
97455682Smarkm        exit 0 ;;
97555682Smarkm    Intel:Mach:3*:*)
97655682Smarkm	echo i386-pc-mach3
97755682Smarkm	exit 0 ;;
97855682Smarkm    paragon:*:*:*)
97955682Smarkm	echo i860-intel-osf1
98055682Smarkm	exit 0 ;;
98155682Smarkm    i860:*:4.*:*) # i860-SVR4
98255682Smarkm	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
98355682Smarkm	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
98455682Smarkm	else # Add other i860-SVR4 vendors below as they are discovered.
98555682Smarkm	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
98655682Smarkm	fi
98755682Smarkm	exit 0 ;;
98855682Smarkm    mini*:CTIX:SYS*5:*)
98955682Smarkm	# "miniframe"
99055682Smarkm	echo m68010-convergent-sysv
99155682Smarkm	exit 0 ;;
99255682Smarkm    M68*:*:R3V[567]*:*)
99355682Smarkm	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
994102644Snectar    3[34]??:*: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)
99555682Smarkm	OS_REL=''
99655682Smarkm	test -r /etc/.relid \
99755682Smarkm	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
99855682Smarkm	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
99955682Smarkm	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
100055682Smarkm	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
100155682Smarkm	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
100255682Smarkm    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
100355682Smarkm        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
100455682Smarkm          && echo i486-ncr-sysv4 && exit 0 ;;
100590926Snectar    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
100655682Smarkm	echo m68k-unknown-lynxos${UNAME_RELEASE}
100755682Smarkm	exit 0 ;;
100855682Smarkm    mc68030:UNIX_System_V:4.*:*)
100955682Smarkm	echo m68k-atari-sysv4
101055682Smarkm	exit 0 ;;
101190926Snectar    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
101255682Smarkm	echo i386-unknown-lynxos${UNAME_RELEASE}
101355682Smarkm	exit 0 ;;
101455682Smarkm    TSUNAMI:LynxOS:2.*:*)
101555682Smarkm	echo sparc-unknown-lynxos${UNAME_RELEASE}
101655682Smarkm	exit 0 ;;
101790926Snectar    rs6000:LynxOS:2.*:*)
101855682Smarkm	echo rs6000-unknown-lynxos${UNAME_RELEASE}
101955682Smarkm	exit 0 ;;
102090926Snectar    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
102190926Snectar	echo powerpc-unknown-lynxos${UNAME_RELEASE}
102290926Snectar	exit 0 ;;
102355682Smarkm    SM[BE]S:UNIX_SV:*:*)
102455682Smarkm	echo mips-dde-sysv${UNAME_RELEASE}
102555682Smarkm	exit 0 ;;
102672445Sassar    RM*:ReliantUNIX-*:*:*)
102772445Sassar	echo mips-sni-sysv4
102872445Sassar	exit 0 ;;
102955682Smarkm    RM*:SINIX-*:*:*)
103055682Smarkm	echo mips-sni-sysv4
103155682Smarkm	exit 0 ;;
103255682Smarkm    *:SINIX-*:*:*)
103355682Smarkm	if uname -p 2>/dev/null >/dev/null ; then
103455682Smarkm		UNAME_MACHINE=`(uname -p) 2>/dev/null`
103555682Smarkm		echo ${UNAME_MACHINE}-sni-sysv4
103655682Smarkm	else
103755682Smarkm		echo ns32k-sni-sysv
103855682Smarkm	fi
103955682Smarkm	exit 0 ;;
104090926Snectar    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
104190926Snectar                      # says <Richard.M.Bartel@ccMail.Census.GOV>
104255682Smarkm        echo i586-unisys-sysv4
104355682Smarkm        exit 0 ;;
104455682Smarkm    *:UNIX_System_V:4*:FTX*)
104555682Smarkm	# From Gerald Hewes <hewes@openmarket.com>.
104655682Smarkm	# How about differentiating between stratus architectures? -djm
104755682Smarkm	echo hppa1.1-stratus-sysv4
104855682Smarkm	exit 0 ;;
104955682Smarkm    *:*:*:FTX*)
105055682Smarkm	# From seanf@swdc.stratus.com.
105155682Smarkm	echo i860-stratus-sysv4
105255682Smarkm	exit 0 ;;
105390926Snectar    *:VOS:*:*)
105490926Snectar	# From Paul.Green@stratus.com.
105590926Snectar	echo hppa1.1-stratus-vos
105690926Snectar	exit 0 ;;
105755682Smarkm    mc68*:A/UX:*:*)
105855682Smarkm	echo m68k-apple-aux${UNAME_RELEASE}
105955682Smarkm	exit 0 ;;
106072445Sassar    news*:NEWS-OS:6*:*)
106155682Smarkm	echo mips-sony-newsos6
106255682Smarkm	exit 0 ;;
106372445Sassar    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
106455682Smarkm	if [ -d /usr/nec ]; then
106555682Smarkm	        echo mips-nec-sysv${UNAME_RELEASE}
106655682Smarkm	else
106755682Smarkm	        echo mips-unknown-sysv${UNAME_RELEASE}
106855682Smarkm	fi
106955682Smarkm        exit 0 ;;
107055682Smarkm    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
107155682Smarkm	echo powerpc-be-beos
107255682Smarkm	exit 0 ;;
107355682Smarkm    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
107455682Smarkm	echo powerpc-apple-beos
107555682Smarkm	exit 0 ;;
107655682Smarkm    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
107755682Smarkm	echo i586-pc-beos
107855682Smarkm	exit 0 ;;
107955682Smarkm    SX-4:SUPER-UX:*:*)
108055682Smarkm	echo sx4-nec-superux${UNAME_RELEASE}
108155682Smarkm	exit 0 ;;
108255682Smarkm    SX-5:SUPER-UX:*:*)
108355682Smarkm	echo sx5-nec-superux${UNAME_RELEASE}
108455682Smarkm	exit 0 ;;
108555682Smarkm    Power*:Rhapsody:*:*)
108655682Smarkm	echo powerpc-apple-rhapsody${UNAME_RELEASE}
108755682Smarkm	exit 0 ;;
108855682Smarkm    *:Rhapsody:*:*)
108955682Smarkm	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
109055682Smarkm	exit 0 ;;
109172445Sassar    *:Darwin:*:*)
109272445Sassar	echo `uname -p`-apple-darwin${UNAME_RELEASE}
109372445Sassar	exit 0 ;;
109472445Sassar    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1095102644Snectar	UNAME_PROCESSOR=`uname -p`
1096102644Snectar	if test "$UNAME_PROCESSOR" = "x86"; then
1097102644Snectar		UNAME_PROCESSOR=i386
109872445Sassar		UNAME_MACHINE=pc
109972445Sassar	fi
1100102644Snectar	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
110172445Sassar	exit 0 ;;
110272445Sassar    *:QNX:*:4*)
110372445Sassar	echo i386-pc-qnx
110472445Sassar	exit 0 ;;
1105102644Snectar    NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
110672445Sassar	echo nsr-tandem-nsk${UNAME_RELEASE}
110772445Sassar	exit 0 ;;
110890926Snectar    *:NonStop-UX:*:*)
110990926Snectar	echo mips-compaq-nonstopux
111090926Snectar	exit 0 ;;
111172445Sassar    BS2000:POSIX*:*:*)
111272445Sassar	echo bs2000-siemens-sysv
111372445Sassar	exit 0 ;;
111472445Sassar    DS/*:UNIX_System_V:*:*)
111572445Sassar	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
111672445Sassar	exit 0 ;;
111772445Sassar    *:Plan9:*:*)
111872445Sassar	# "uname -m" is not consistent, so use $cputype instead. 386
111972445Sassar	# is converted to i386 for consistency with other x86
112072445Sassar	# operating systems.
112172445Sassar	if test "$cputype" = "386"; then
112272445Sassar	    UNAME_MACHINE=i386
112372445Sassar	else
112472445Sassar	    UNAME_MACHINE="$cputype"
112572445Sassar	fi
112672445Sassar	echo ${UNAME_MACHINE}-unknown-plan9
112772445Sassar	exit 0 ;;
112890926Snectar    i*86:OS/2:*:*)
112990926Snectar	# If we were able to find `uname', then EMX Unix compatibility
113090926Snectar	# is probably installed.
113190926Snectar	echo ${UNAME_MACHINE}-pc-os2-emx
113290926Snectar	exit 0 ;;
113390926Snectar    *:TOPS-10:*:*)
113490926Snectar	echo pdp10-unknown-tops10
113590926Snectar	exit 0 ;;
113690926Snectar    *:TENEX:*:*)
113790926Snectar	echo pdp10-unknown-tenex
113890926Snectar	exit 0 ;;
113990926Snectar    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
114090926Snectar	echo pdp10-dec-tops20
114190926Snectar	exit 0 ;;
114290926Snectar    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
114390926Snectar	echo pdp10-xkl-tops20
114490926Snectar	exit 0 ;;
114590926Snectar    *:TOPS-20:*:*)
114690926Snectar	echo pdp10-unknown-tops20
114790926Snectar	exit 0 ;;
114890926Snectar    *:ITS:*:*)
114990926Snectar	echo pdp10-unknown-its
115090926Snectar	exit 0 ;;
115190926Snectar    i*86:XTS-300:*:STOP)
115290926Snectar	echo ${UNAME_MACHINE}-unknown-stop
115390926Snectar	exit 0 ;;
115490926Snectar    i*86:atheos:*:*)
115590926Snectar	echo ${UNAME_MACHINE}-unknown-atheos
115690926Snectar	exit 0 ;;
115755682Smarkmesac
115855682Smarkm
115955682Smarkm#echo '(No uname command or uname output not recognized.)' 1>&2
116055682Smarkm#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
116155682Smarkm
116290926Snectareval $set_cc_for_build
116355682Smarkmcat >$dummy.c <<EOF
116455682Smarkm#ifdef _SEQUENT_
116555682Smarkm# include <sys/types.h>
116655682Smarkm# include <sys/utsname.h>
116755682Smarkm#endif
116855682Smarkmmain ()
116955682Smarkm{
117055682Smarkm#if defined (sony)
117155682Smarkm#if defined (MIPSEB)
117255682Smarkm  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
117355682Smarkm     I don't know....  */
117455682Smarkm  printf ("mips-sony-bsd\n"); exit (0);
117555682Smarkm#else
117655682Smarkm#include <sys/param.h>
117755682Smarkm  printf ("m68k-sony-newsos%s\n",
117855682Smarkm#ifdef NEWSOS4
117955682Smarkm          "4"
118055682Smarkm#else
118155682Smarkm	  ""
118255682Smarkm#endif
118355682Smarkm         ); exit (0);
118455682Smarkm#endif
118555682Smarkm#endif
118655682Smarkm
118755682Smarkm#if defined (__arm) && defined (__acorn) && defined (__unix)
118855682Smarkm  printf ("arm-acorn-riscix"); exit (0);
118955682Smarkm#endif
119055682Smarkm
119155682Smarkm#if defined (hp300) && !defined (hpux)
119255682Smarkm  printf ("m68k-hp-bsd\n"); exit (0);
119355682Smarkm#endif
119455682Smarkm
119555682Smarkm#if defined (NeXT)
119655682Smarkm#if !defined (__ARCHITECTURE__)
119755682Smarkm#define __ARCHITECTURE__ "m68k"
119855682Smarkm#endif
119955682Smarkm  int version;
120055682Smarkm  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
120155682Smarkm  if (version < 4)
120255682Smarkm    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
120355682Smarkm  else
120455682Smarkm    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
120555682Smarkm  exit (0);
120655682Smarkm#endif
120755682Smarkm
120855682Smarkm#if defined (MULTIMAX) || defined (n16)
120955682Smarkm#if defined (UMAXV)
121055682Smarkm  printf ("ns32k-encore-sysv\n"); exit (0);
121155682Smarkm#else
121255682Smarkm#if defined (CMU)
121355682Smarkm  printf ("ns32k-encore-mach\n"); exit (0);
121455682Smarkm#else
121555682Smarkm  printf ("ns32k-encore-bsd\n"); exit (0);
121655682Smarkm#endif
121755682Smarkm#endif
121855682Smarkm#endif
121955682Smarkm
122055682Smarkm#if defined (__386BSD__)
122155682Smarkm  printf ("i386-pc-bsd\n"); exit (0);
122255682Smarkm#endif
122355682Smarkm
122455682Smarkm#if defined (sequent)
122555682Smarkm#if defined (i386)
122655682Smarkm  printf ("i386-sequent-dynix\n"); exit (0);
122755682Smarkm#endif
122855682Smarkm#if defined (ns32000)
122955682Smarkm  printf ("ns32k-sequent-dynix\n"); exit (0);
123055682Smarkm#endif
123155682Smarkm#endif
123255682Smarkm
123355682Smarkm#if defined (_SEQUENT_)
123455682Smarkm    struct utsname un;
123555682Smarkm
123655682Smarkm    uname(&un);
123755682Smarkm
123855682Smarkm    if (strncmp(un.version, "V2", 2) == 0) {
123955682Smarkm	printf ("i386-sequent-ptx2\n"); exit (0);
124055682Smarkm    }
124155682Smarkm    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
124255682Smarkm	printf ("i386-sequent-ptx1\n"); exit (0);
124355682Smarkm    }
124455682Smarkm    printf ("i386-sequent-ptx\n"); exit (0);
124555682Smarkm
124655682Smarkm#endif
124755682Smarkm
124855682Smarkm#if defined (vax)
124990926Snectar# if !defined (ultrix)
125090926Snectar#  include <sys/param.h>
125190926Snectar#  if defined (BSD)
125290926Snectar#   if BSD == 43
125390926Snectar      printf ("vax-dec-bsd4.3\n"); exit (0);
125490926Snectar#   else
125590926Snectar#    if BSD == 199006
125690926Snectar      printf ("vax-dec-bsd4.3reno\n"); exit (0);
125790926Snectar#    else
125890926Snectar      printf ("vax-dec-bsd\n"); exit (0);
125990926Snectar#    endif
126090926Snectar#   endif
126190926Snectar#  else
126290926Snectar    printf ("vax-dec-bsd\n"); exit (0);
126390926Snectar#  endif
126490926Snectar# else
126590926Snectar    printf ("vax-dec-ultrix\n"); exit (0);
126690926Snectar# endif
126755682Smarkm#endif
126855682Smarkm
126955682Smarkm#if defined (alliant) && defined (i860)
127055682Smarkm  printf ("i860-alliant-bsd\n"); exit (0);
127155682Smarkm#endif
127255682Smarkm
127355682Smarkm  exit (1);
127455682Smarkm}
127555682SmarkmEOF
127655682Smarkm
1277102644Snectar$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
1278102644Snectarrm -f $dummy.c $dummy && rmdir $tmpdir
127955682Smarkm
128055682Smarkm# Apollos put the system type in the environment.
128155682Smarkm
128255682Smarkmtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
128355682Smarkm
128455682Smarkm# Convex versions that predate uname can use getsysinfo(1)
128555682Smarkm
128655682Smarkmif [ -x /usr/convex/getsysinfo ]
128755682Smarkmthen
128855682Smarkm    case `getsysinfo -f cpu_type` in
128955682Smarkm    c1*)
129055682Smarkm	echo c1-convex-bsd
129155682Smarkm	exit 0 ;;
129255682Smarkm    c2*)
129355682Smarkm	if getsysinfo -f scalar_acc
129455682Smarkm	then echo c32-convex-bsd
129555682Smarkm	else echo c2-convex-bsd
129655682Smarkm	fi
129755682Smarkm	exit 0 ;;
129855682Smarkm    c34*)
129955682Smarkm	echo c34-convex-bsd
130055682Smarkm	exit 0 ;;
130155682Smarkm    c38*)
130255682Smarkm	echo c38-convex-bsd
130355682Smarkm	exit 0 ;;
130455682Smarkm    c4*)
130555682Smarkm	echo c4-convex-bsd
130655682Smarkm	exit 0 ;;
130755682Smarkm    esac
130855682Smarkmfi
130955682Smarkm
131072445Sassarcat >&2 <<EOF
131172445Sassar$0: unable to guess system type
131255682Smarkm
131390926SnectarThis script, last modified $timestamp, has failed to recognize
131490926Snectarthe operating system you are using. It is advised that you
131590926Snectardownload the most up to date version of the config scripts from
131672445Sassar
131772445Sassar    ftp://ftp.gnu.org/pub/gnu/config/
131872445Sassar
131972445SassarIf the version you run ($0) is already up to date, please
132072445Sassarsend the following data and any information you think might be
132172445Sassarpertinent to <config-patches@gnu.org> in order to provide the needed
132272445Sassarinformation to handle your system.
132372445Sassar
132490926Snectarconfig.guess timestamp = $timestamp
132572445Sassar
132672445Sassaruname -m = `(uname -m) 2>/dev/null || echo unknown`
132772445Sassaruname -r = `(uname -r) 2>/dev/null || echo unknown`
132872445Sassaruname -s = `(uname -s) 2>/dev/null || echo unknown`
132972445Sassaruname -v = `(uname -v) 2>/dev/null || echo unknown`
133072445Sassar
133172445Sassar/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
133272445Sassar/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
133372445Sassar
133472445Sassarhostinfo               = `(hostinfo) 2>/dev/null`
133572445Sassar/bin/universe          = `(/bin/universe) 2>/dev/null`
133672445Sassar/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
133772445Sassar/bin/arch              = `(/bin/arch) 2>/dev/null`
133872445Sassar/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
133972445Sassar/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
134072445Sassar
134172445SassarUNAME_MACHINE = ${UNAME_MACHINE}
134272445SassarUNAME_RELEASE = ${UNAME_RELEASE}
134372445SassarUNAME_SYSTEM  = ${UNAME_SYSTEM}
134472445SassarUNAME_VERSION = ${UNAME_VERSION}
134572445SassarEOF
134672445Sassar
134755682Smarkmexit 1
134872445Sassar
134972445Sassar# Local variables:
135072445Sassar# eval: (add-hook 'write-file-hooks 'time-stamp)
135190926Snectar# time-stamp-start: "timestamp='"
135272445Sassar# time-stamp-format: "%:y-%02m-%02d"
135372445Sassar# time-stamp-end: "'"
135472445Sassar# End:
1355