config.guess
author Sam Lantinga <slouken@libsdl.org>
Wed, 20 Mar 2002 02:37:44 +0000
changeset 313 67ad846ed21c
parent 53 25dfe480c75e
child 729 dac996d69abb
permissions -rwxr-xr-x
*** empty log message ***
slouken@0
     1
#! /bin/sh
slouken@0
     2
# Attempt to guess a canonical system name.
slouken@53
     3
#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
slouken@0
     4
#   Free Software Foundation, Inc.
slouken@53
     5
slouken@53
     6
timestamp='2001-03-16'
slouken@53
     7
slouken@0
     8
# This file is free software; you can redistribute it and/or modify it
slouken@0
     9
# under the terms of the GNU General Public License as published by
slouken@0
    10
# the Free Software Foundation; either version 2 of the License, or
slouken@0
    11
# (at your option) any later version.
slouken@0
    12
#
slouken@0
    13
# This program is distributed in the hope that it will be useful, but
slouken@0
    14
# WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@0
    16
# General Public License for more details.
slouken@0
    17
#
slouken@0
    18
# You should have received a copy of the GNU General Public License
slouken@0
    19
# along with this program; if not, write to the Free Software
slouken@0
    20
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
slouken@0
    21
#
slouken@0
    22
# As a special exception to the GNU General Public License, if you
slouken@0
    23
# distribute this file as part of a program that contains a
slouken@0
    24
# configuration script generated by Autoconf, you may include it under
slouken@0
    25
# the same distribution terms that you use for the rest of that program.
slouken@0
    26
slouken@0
    27
# Written by Per Bothner <bothner@cygnus.com>.
slouken@53
    28
# Please send patches to <config-patches@gnu.org>.
slouken@0
    29
#
slouken@0
    30
# This script attempts to guess a canonical system name similar to
slouken@0
    31
# config.sub.  If it succeeds, it prints the system name on stdout, and
slouken@0
    32
# exits with 0.  Otherwise, it exits with 1.
slouken@0
    33
#
slouken@0
    34
# The plan is that this can be called by configure scripts if you
slouken@53
    35
# don't specify an explicit build system type.
slouken@0
    36
slouken@53
    37
me=`echo "$0" | sed -e 's,.*/,,'`
slouken@53
    38
slouken@53
    39
usage="\
slouken@53
    40
Usage: $0 [OPTION]
slouken@53
    41
slouken@53
    42
Output the configuration name of the system \`$me' is run on.
slouken@53
    43
slouken@53
    44
Operation modes:
slouken@53
    45
  -h, --help         print this help, then exit
slouken@53
    46
  -t, --time-stamp   print date of last modification, then exit
slouken@53
    47
  -v, --version      print version number, then exit
slouken@53
    48
slouken@53
    49
Report bugs and patches to <config-patches@gnu.org>."
slouken@53
    50
slouken@53
    51
version="\
slouken@53
    52
GNU config.guess ($timestamp)
slouken@53
    53
slouken@53
    54
Originally written by Per Bothner.
slouken@53
    55
Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000
slouken@53
    56
Free Software Foundation, Inc.
slouken@53
    57
slouken@53
    58
This is free software; see the source for copying conditions.  There is NO
slouken@53
    59
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
slouken@53
    60
slouken@53
    61
help="
slouken@53
    62
Try \`$me --help' for more information."
slouken@53
    63
slouken@53
    64
# Parse command line
slouken@53
    65
while test $# -gt 0 ; do
slouken@53
    66
  case $1 in
slouken@53
    67
    --time-stamp | --time* | -t )
slouken@53
    68
       echo "$timestamp" ; exit 0 ;;
slouken@53
    69
    --version | -v )
slouken@53
    70
       echo "$version" ; exit 0 ;;
slouken@53
    71
    --help | --h* | -h )
slouken@53
    72
       echo "$usage"; exit 0 ;;
slouken@53
    73
    -- )     # Stop option processing
slouken@53
    74
       shift; break ;;
slouken@53
    75
    - )	# Use stdin as input.
slouken@53
    76
       break ;;
slouken@53
    77
    -* )
slouken@53
    78
       echo "$me: invalid option $1$help" >&2
slouken@53
    79
       exit 1 ;;
slouken@53
    80
    * )
slouken@53
    81
       break ;;
slouken@53
    82
  esac
slouken@53
    83
done
slouken@53
    84
slouken@53
    85
if test $# != 0; then
slouken@53
    86
  echo "$me: too many arguments$help" >&2
slouken@53
    87
  exit 1
slouken@0
    88
fi
slouken@0
    89
slouken@0
    90
slouken@53
    91
dummy=dummy-$$
slouken@53
    92
trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
slouken@53
    93
slouken@53
    94
# CC_FOR_BUILD -- compiler used by this script.
slouken@53
    95
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
slouken@53
    96
# use `HOST_CC' if defined, but it is deprecated.
slouken@53
    97
slouken@53
    98
case $CC_FOR_BUILD,$HOST_CC,$CC in
slouken@53
    99
 ,,)    echo "int dummy(){}" > $dummy.c
slouken@53
   100
	for c in cc gcc c89 ; do
slouken@53
   101
	  ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1
slouken@53
   102
	  if test $? = 0 ; then
slouken@53
   103
	     CC_FOR_BUILD="$c"; break
slouken@53
   104
	  fi
slouken@53
   105
	done
slouken@53
   106
	rm -f $dummy.c $dummy.o $dummy.rel
slouken@53
   107
	if test x"$CC_FOR_BUILD" = x ; then
slouken@53
   108
	  CC_FOR_BUILD=no_compiler_found
slouken@53
   109
	fi
slouken@53
   110
	;;
slouken@53
   111
 ,,*)   CC_FOR_BUILD=$CC ;;
slouken@53
   112
 ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
slouken@53
   113
esac
slouken@53
   114
slouken@0
   115
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
slouken@0
   116
# (ghazi@noc.rutgers.edu 8/24/94.)
slouken@0
   117
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
slouken@0
   118
	PATH=$PATH:/.attbin ; export PATH
slouken@0
   119
fi
slouken@0
   120
slouken@0
   121
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
slouken@0
   122
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
slouken@53
   123
UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
slouken@0
   124
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
slouken@0
   125
slouken@0
   126
# Note: order is significant - the case branches are not exclusive.
slouken@0
   127
slouken@0
   128
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
slouken@53
   129
    *:NetBSD:*:*)
slouken@53
   130
	# Netbsd (nbsd) targets should (where applicable) match one or
slouken@53
   131
	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
slouken@53
   132
	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
slouken@53
   133
	# switched to ELF, *-*-netbsd* would select the old
slouken@53
   134
	# object file format.  This provides both forward
slouken@53
   135
	# compatibility and a consistent mechanism for selecting the
slouken@53
   136
	# object file format.
slouken@53
   137
	# Determine the machine/vendor (is the vendor relevant).
slouken@53
   138
	case "${UNAME_MACHINE}" in
slouken@53
   139
	    amiga) machine=m68k-unknown ;;
slouken@53
   140
	    arm32) machine=arm-unknown ;;
slouken@53
   141
	    atari*) machine=m68k-atari ;;
slouken@53
   142
	    sun3*) machine=m68k-sun ;;
slouken@53
   143
	    mac68k) machine=m68k-apple ;;
slouken@53
   144
	    macppc) machine=powerpc-apple ;;
slouken@53
   145
	    hp3[0-9][05]) machine=m68k-hp ;;
slouken@53
   146
	    ibmrt|romp-ibm) machine=romp-ibm ;;
slouken@53
   147
	    *) machine=${UNAME_MACHINE}-unknown ;;
slouken@53
   148
	esac
slouken@53
   149
	# The Operating System including object format, if it has switched
slouken@53
   150
	# to ELF recently, or will in the future.
slouken@53
   151
	case "${UNAME_MACHINE}" in
slouken@53
   152
	    i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
slouken@53
   153
		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
slouken@53
   154
			| grep __ELF__ >/dev/null
slouken@53
   155
		then
slouken@53
   156
		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
slouken@53
   157
		    # Return netbsd for either.  FIX?
slouken@53
   158
		    os=netbsd
slouken@53
   159
		else
slouken@53
   160
		    os=netbsdelf
slouken@53
   161
		fi
slouken@53
   162
		;;
slouken@53
   163
	    *)
slouken@53
   164
	        os=netbsd
slouken@53
   165
		;;
slouken@53
   166
	esac
slouken@53
   167
	# The OS release
slouken@53
   168
	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
slouken@53
   169
	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
slouken@53
   170
	# contains redundant information, the shorter form:
slouken@53
   171
	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
slouken@53
   172
	echo "${machine}-${os}${release}"
slouken@53
   173
	exit 0 ;;
slouken@0
   174
    alpha:OSF1:*:*)
slouken@0
   175
	if test $UNAME_RELEASE = "V4.0"; then
slouken@0
   176
		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
slouken@0
   177
	fi
slouken@0
   178
	# A Vn.n version is a released version.
slouken@0
   179
	# A Tn.n version is a released field test version.
slouken@0
   180
	# A Xn.n version is an unreleased experimental baselevel.
slouken@0
   181
	# 1.2 uses "1.2" for uname -r.
slouken@0
   182
	cat <<EOF >$dummy.s
slouken@53
   183
	.data
slouken@53
   184
\$Lformat:
slouken@53
   185
	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
slouken@53
   186
slouken@53
   187
	.text
slouken@0
   188
	.globl main
slouken@53
   189
	.align 4
slouken@0
   190
	.ent main
slouken@0
   191
main:
slouken@53
   192
	.frame \$30,16,\$26,0
slouken@53
   193
	ldgp \$29,0(\$27)
slouken@53
   194
	.prologue 1
slouken@53
   195
	.long 0x47e03d80 # implver \$0
slouken@53
   196
	lda \$2,-1
slouken@53
   197
	.long 0x47e20c21 # amask \$2,\$1
slouken@53
   198
	lda \$16,\$Lformat
slouken@53
   199
	mov \$0,\$17
slouken@53
   200
	not \$1,\$18
slouken@53
   201
	jsr \$26,printf
slouken@53
   202
	ldgp \$29,0(\$26)
slouken@53
   203
	mov 0,\$16
slouken@53
   204
	jsr \$26,exit
slouken@0
   205
	.end main
slouken@0
   206
EOF
slouken@0
   207
	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
slouken@0
   208
	if test "$?" = 0 ; then
slouken@53
   209
		case `./$dummy` in
slouken@53
   210
			0-0)
slouken@0
   211
				UNAME_MACHINE="alpha"
slouken@0
   212
				;;
slouken@53
   213
			1-0)
slouken@0
   214
				UNAME_MACHINE="alphaev5"
slouken@0
   215
				;;
slouken@53
   216
			1-1)
slouken@0
   217
				UNAME_MACHINE="alphaev56"
slouken@0
   218
				;;
slouken@53
   219
			1-101)
slouken@0
   220
				UNAME_MACHINE="alphapca56"
slouken@0
   221
				;;
slouken@53
   222
			2-303)
slouken@0
   223
				UNAME_MACHINE="alphaev6"
slouken@0
   224
				;;
slouken@53
   225
			2-307)
slouken@53
   226
				UNAME_MACHINE="alphaev67"
slouken@53
   227
				;;
slouken@0
   228
		esac
slouken@0
   229
	fi
slouken@0
   230
	rm -f $dummy.s $dummy
slouken@0
   231
	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
slouken@0
   232
	exit 0 ;;
slouken@0
   233
    Alpha\ *:Windows_NT*:*)
slouken@0
   234
	# How do we know it's Interix rather than the generic POSIX subsystem?
slouken@0
   235
	# Should we change UNAME_MACHINE based on the output of uname instead
slouken@0
   236
	# of the specific Alpha model?
slouken@0
   237
	echo alpha-pc-interix
slouken@0
   238
	exit 0 ;;
slouken@0
   239
    21064:Windows_NT:50:3)
slouken@0
   240
	echo alpha-dec-winnt3.5
slouken@0
   241
	exit 0 ;;
slouken@0
   242
    Amiga*:UNIX_System_V:4.0:*)
slouken@53
   243
	echo m68k-unknown-sysv4
slouken@0
   244
	exit 0;;
slouken@0
   245
    amiga:OpenBSD:*:*)
slouken@0
   246
	echo m68k-unknown-openbsd${UNAME_RELEASE}
slouken@0
   247
	exit 0 ;;
slouken@0
   248
    *:[Aa]miga[Oo][Ss]:*:*)
slouken@0
   249
	echo ${UNAME_MACHINE}-unknown-amigaos
slouken@0
   250
	exit 0 ;;
slouken@0
   251
    arc64:OpenBSD:*:*)
slouken@0
   252
	echo mips64el-unknown-openbsd${UNAME_RELEASE}
slouken@0
   253
	exit 0 ;;
slouken@0
   254
    arc:OpenBSD:*:*)
slouken@0
   255
	echo mipsel-unknown-openbsd${UNAME_RELEASE}
slouken@0
   256
	exit 0 ;;
slouken@0
   257
    hkmips:OpenBSD:*:*)
slouken@0
   258
	echo mips-unknown-openbsd${UNAME_RELEASE}
slouken@0
   259
	exit 0 ;;
slouken@0
   260
    pmax:OpenBSD:*:*)
slouken@0
   261
	echo mipsel-unknown-openbsd${UNAME_RELEASE}
slouken@0
   262
	exit 0 ;;
slouken@0
   263
    sgi:OpenBSD:*:*)
slouken@0
   264
	echo mips-unknown-openbsd${UNAME_RELEASE}
slouken@0
   265
	exit 0 ;;
slouken@0
   266
    wgrisc:OpenBSD:*:*)
slouken@0
   267
	echo mipsel-unknown-openbsd${UNAME_RELEASE}
slouken@0
   268
	exit 0 ;;
slouken@53
   269
    *:OS/390:*:*)
slouken@53
   270
	echo i370-ibm-openedition
slouken@53
   271
	exit 0 ;;
slouken@0
   272
    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
slouken@0
   273
	echo arm-acorn-riscix${UNAME_RELEASE}
slouken@0
   274
	exit 0;;
slouken@53
   275
    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
slouken@0
   276
	echo hppa1.1-hitachi-hiuxmpp
slouken@0
   277
	exit 0;;
slouken@0
   278
    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
slouken@0
   279
	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
slouken@0
   280
	if test "`(/bin/universe) 2>/dev/null`" = att ; then
slouken@0
   281
		echo pyramid-pyramid-sysv3
slouken@0
   282
	else
slouken@0
   283
		echo pyramid-pyramid-bsd
slouken@0
   284
	fi
slouken@0
   285
	exit 0 ;;
slouken@0
   286
    NILE*:*:*:dcosx)
slouken@0
   287
	echo pyramid-pyramid-svr4
slouken@0
   288
	exit 0 ;;
slouken@0
   289
    sun4H:SunOS:5.*:*)
slouken@0
   290
	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
slouken@0
   291
	exit 0 ;;
slouken@0
   292
    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
slouken@0
   293
	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
slouken@0
   294
	exit 0 ;;
slouken@0
   295
    i86pc:SunOS:5.*:*)
slouken@0
   296
	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
slouken@0
   297
	exit 0 ;;
slouken@0
   298
    sun4*:SunOS:6*:*)
slouken@0
   299
	# According to config.sub, this is the proper way to canonicalize
slouken@0
   300
	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
slouken@0
   301
	# it's likely to be more like Solaris than SunOS4.
slouken@0
   302
	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
slouken@0
   303
	exit 0 ;;
slouken@0
   304
    sun4*:SunOS:*:*)
slouken@0
   305
	case "`/usr/bin/arch -k`" in
slouken@0
   306
	    Series*|S4*)
slouken@0
   307
		UNAME_RELEASE=`uname -v`
slouken@0
   308
		;;
slouken@0
   309
	esac
slouken@0
   310
	# Japanese Language versions have a version number like `4.1.3-JL'.
slouken@0
   311
	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
slouken@0
   312
	exit 0 ;;
slouken@0
   313
    sun3*:SunOS:*:*)
slouken@0
   314
	echo m68k-sun-sunos${UNAME_RELEASE}
slouken@0
   315
	exit 0 ;;
slouken@0
   316
    sun*:*:4.2BSD:*)
slouken@0
   317
	UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
slouken@0
   318
	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
slouken@0
   319
	case "`/bin/arch`" in
slouken@0
   320
	    sun3)
slouken@0
   321
		echo m68k-sun-sunos${UNAME_RELEASE}
slouken@0
   322
		;;
slouken@0
   323
	    sun4)
slouken@0
   324
		echo sparc-sun-sunos${UNAME_RELEASE}
slouken@0
   325
		;;
slouken@0
   326
	esac
slouken@0
   327
	exit 0 ;;
slouken@0
   328
    aushp:SunOS:*:*)
slouken@0
   329
	echo sparc-auspex-sunos${UNAME_RELEASE}
slouken@0
   330
	exit 0 ;;
slouken@0
   331
    atari*:OpenBSD:*:*)
slouken@0
   332
	echo m68k-unknown-openbsd${UNAME_RELEASE}
slouken@0
   333
	exit 0 ;;
slouken@0
   334
    # The situation for MiNT is a little confusing.  The machine name
slouken@0
   335
    # can be virtually everything (everything which is not
slouken@53
   336
    # "atarist" or "atariste" at least should have a processor
slouken@0
   337
    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
slouken@0
   338
    # to the lowercase version "mint" (or "freemint").  Finally
slouken@0
   339
    # the system name "TOS" denotes a system which is actually not
slouken@0
   340
    # MiNT.  But MiNT is downward compatible to TOS, so this should
slouken@0
   341
    # be no problem.
slouken@0
   342
    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
slouken@0
   343
        echo m68k-atari-mint${UNAME_RELEASE}
slouken@0
   344
	exit 0 ;;
slouken@0
   345
    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
slouken@0
   346
	echo m68k-atari-mint${UNAME_RELEASE}
slouken@0
   347
        exit 0 ;;
slouken@0
   348
    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
slouken@0
   349
        echo m68k-atari-mint${UNAME_RELEASE}
slouken@0
   350
	exit 0 ;;
slouken@0
   351
    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
slouken@0
   352
        echo m68k-milan-mint${UNAME_RELEASE}
slouken@0
   353
        exit 0 ;;
slouken@0
   354
    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
slouken@0
   355
        echo m68k-hades-mint${UNAME_RELEASE}
slouken@0
   356
        exit 0 ;;
slouken@0
   357
    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
slouken@0
   358
        echo m68k-unknown-mint${UNAME_RELEASE}
slouken@0
   359
        exit 0 ;;
slouken@0
   360
    sun3*:OpenBSD:*:*)
slouken@0
   361
	echo m68k-unknown-openbsd${UNAME_RELEASE}
slouken@0
   362
	exit 0 ;;
slouken@0
   363
    mac68k:OpenBSD:*:*)
slouken@0
   364
	echo m68k-unknown-openbsd${UNAME_RELEASE}
slouken@0
   365
	exit 0 ;;
slouken@0
   366
    mvme68k:OpenBSD:*:*)
slouken@0
   367
	echo m68k-unknown-openbsd${UNAME_RELEASE}
slouken@0
   368
	exit 0 ;;
slouken@0
   369
    mvme88k:OpenBSD:*:*)
slouken@0
   370
	echo m88k-unknown-openbsd${UNAME_RELEASE}
slouken@0
   371
	exit 0 ;;
slouken@0
   372
    powerpc:machten:*:*)
slouken@0
   373
	echo powerpc-apple-machten${UNAME_RELEASE}
slouken@0
   374
	exit 0 ;;
slouken@0
   375
    RISC*:Mach:*:*)
slouken@0
   376
	echo mips-dec-mach_bsd4.3
slouken@0
   377
	exit 0 ;;
slouken@0
   378
    RISC*:ULTRIX:*:*)
slouken@0
   379
	echo mips-dec-ultrix${UNAME_RELEASE}
slouken@0
   380
	exit 0 ;;
slouken@0
   381
    VAX*:ULTRIX*:*:*)
slouken@0
   382
	echo vax-dec-ultrix${UNAME_RELEASE}
slouken@0
   383
	exit 0 ;;
slouken@0
   384
    2020:CLIX:*:* | 2430:CLIX:*:*)
slouken@0
   385
	echo clipper-intergraph-clix${UNAME_RELEASE}
slouken@0
   386
	exit 0 ;;
slouken@0
   387
    mips:*:*:UMIPS | mips:*:*:RISCos)
slouken@0
   388
	sed 's/^	//' << EOF >$dummy.c
slouken@0
   389
#ifdef __cplusplus
slouken@53
   390
#include <stdio.h>  /* for printf() prototype */
slouken@0
   391
	int main (int argc, char *argv[]) {
slouken@0
   392
#else
slouken@0
   393
	int main (argc, argv) int argc; char *argv[]; {
slouken@0
   394
#endif
slouken@0
   395
	#if defined (host_mips) && defined (MIPSEB)
slouken@0
   396
	#if defined (SYSTYPE_SYSV)
slouken@0
   397
	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
slouken@0
   398
	#endif
slouken@0
   399
	#if defined (SYSTYPE_SVR4)
slouken@0
   400
	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
slouken@0
   401
	#endif
slouken@0
   402
	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
slouken@0
   403
	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
slouken@0
   404
	#endif
slouken@0
   405
	#endif
slouken@0
   406
	  exit (-1);
slouken@0
   407
	}
slouken@0
   408
EOF
slouken@0
   409
	$CC_FOR_BUILD $dummy.c -o $dummy \
slouken@0
   410
	  && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
slouken@53
   411
	  && rm -f $dummy.c $dummy && exit 0
slouken@0
   412
	rm -f $dummy.c $dummy
slouken@0
   413
	echo mips-mips-riscos${UNAME_RELEASE}
slouken@0
   414
	exit 0 ;;
slouken@0
   415
    Night_Hawk:Power_UNIX:*:*)
slouken@0
   416
	echo powerpc-harris-powerunix
slouken@0
   417
	exit 0 ;;
slouken@0
   418
    m88k:CX/UX:7*:*)
slouken@0
   419
	echo m88k-harris-cxux7
slouken@0
   420
	exit 0 ;;
slouken@0
   421
    m88k:*:4*:R4*)
slouken@0
   422
	echo m88k-motorola-sysv4
slouken@0
   423
	exit 0 ;;
slouken@0
   424
    m88k:*:3*:R3*)
slouken@0
   425
	echo m88k-motorola-sysv3
slouken@0
   426
	exit 0 ;;
slouken@0
   427
    AViiON:dgux:*:*)
slouken@0
   428
        # DG/UX returns AViiON for all architectures
slouken@0
   429
        UNAME_PROCESSOR=`/usr/bin/uname -p`
slouken@53
   430
	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
slouken@53
   431
	then
slouken@53
   432
	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
slouken@53
   433
	       [ ${TARGET_BINARY_INTERFACE}x = x ]
slouken@53
   434
	    then
slouken@0
   435
		echo m88k-dg-dgux${UNAME_RELEASE}
slouken@53
   436
	    else
slouken@53
   437
		echo m88k-dg-dguxbcs${UNAME_RELEASE}
slouken@53
   438
	    fi
slouken@28
   439
	else
slouken@53
   440
	    echo i586-dg-dgux${UNAME_RELEASE}
slouken@0
   441
	fi
slouken@0
   442
 	exit 0 ;;
slouken@0
   443
    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
slouken@0
   444
	echo m88k-dolphin-sysv3
slouken@0
   445
	exit 0 ;;
slouken@0
   446
    M88*:*:R3*:*)
slouken@0
   447
	# Delta 88k system running SVR3
slouken@0
   448
	echo m88k-motorola-sysv3
slouken@0
   449
	exit 0 ;;
slouken@0
   450
    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
slouken@0
   451
	echo m88k-tektronix-sysv3
slouken@0
   452
	exit 0 ;;
slouken@0
   453
    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
slouken@0
   454
	echo m68k-tektronix-bsd
slouken@0
   455
	exit 0 ;;
slouken@0
   456
    *:IRIX*:*:*)
slouken@0
   457
	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
slouken@0
   458
	exit 0 ;;
slouken@0
   459
    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
slouken@0
   460
	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
slouken@0
   461
	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
slouken@0
   462
    i?86:AIX:*:*)
slouken@0
   463
	echo i386-ibm-aix
slouken@0
   464
	exit 0 ;;
slouken@53
   465
    ia64:AIX:*:*)
slouken@53
   466
	if [ -x /usr/bin/oslevel ] ; then
slouken@53
   467
		IBM_REV=`/usr/bin/oslevel`
slouken@53
   468
	else
slouken@53
   469
		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
slouken@53
   470
	fi
slouken@53
   471
	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
slouken@53
   472
	exit 0 ;;
slouken@0
   473
    *:AIX:2:3)
slouken@0
   474
	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
slouken@0
   475
		sed 's/^		//' << EOF >$dummy.c
slouken@0
   476
		#include <sys/systemcfg.h>
slouken@0
   477
slouken@0
   478
		main()
slouken@0
   479
			{
slouken@0
   480
			if (!__power_pc())
slouken@0
   481
				exit(1);
slouken@0
   482
			puts("powerpc-ibm-aix3.2.5");
slouken@0
   483
			exit(0);
slouken@0
   484
			}
slouken@0
   485
EOF
slouken@53
   486
		$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
slouken@0
   487
		rm -f $dummy.c $dummy
slouken@0
   488
		echo rs6000-ibm-aix3.2.5
slouken@0
   489
	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
slouken@0
   490
		echo rs6000-ibm-aix3.2.4
slouken@0
   491
	else
slouken@0
   492
		echo rs6000-ibm-aix3.2
slouken@0
   493
	fi
slouken@0
   494
	exit 0 ;;
slouken@53
   495
    *:AIX:*:[45])
slouken@0
   496
	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
slouken@53
   497
	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
slouken@0
   498
		IBM_ARCH=rs6000
slouken@0
   499
	else
slouken@0
   500
		IBM_ARCH=powerpc
slouken@0
   501
	fi
slouken@0
   502
	if [ -x /usr/bin/oslevel ] ; then
slouken@0
   503
		IBM_REV=`/usr/bin/oslevel`
slouken@0
   504
	else
slouken@53
   505
		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
slouken@0
   506
	fi
slouken@0
   507
	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
slouken@0
   508
	exit 0 ;;
slouken@0
   509
    *:AIX:*:*)
slouken@0
   510
	echo rs6000-ibm-aix
slouken@0
   511
	exit 0 ;;
slouken@0
   512
    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
slouken@0
   513
	echo romp-ibm-bsd4.4
slouken@0
   514
	exit 0 ;;
slouken@53
   515
    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
slouken@0
   516
	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
slouken@0
   517
	exit 0 ;;                           # report: romp-ibm BSD 4.3
slouken@0
   518
    *:BOSX:*:*)
slouken@0
   519
	echo rs6000-bull-bosx
slouken@0
   520
	exit 0 ;;
slouken@0
   521
    DPX/2?00:B.O.S.:*:*)
slouken@0
   522
	echo m68k-bull-sysv3
slouken@0
   523
	exit 0 ;;
slouken@0
   524
    9000/[34]??:4.3bsd:1.*:*)
slouken@0
   525
	echo m68k-hp-bsd
slouken@0
   526
	exit 0 ;;
slouken@0
   527
    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
slouken@0
   528
	echo m68k-hp-bsd4.4
slouken@0
   529
	exit 0 ;;
slouken@0
   530
    9000/[34678]??:HP-UX:*:*)
slouken@53
   531
	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
slouken@0
   532
	case "${UNAME_MACHINE}" in
slouken@0
   533
	    9000/31? )            HP_ARCH=m68000 ;;
slouken@0
   534
	    9000/[34]?? )         HP_ARCH=m68k ;;
slouken@0
   535
	    9000/[678][0-9][0-9])
slouken@53
   536
              case "${HPUX_REV}" in
slouken@53
   537
                11.[0-9][0-9])
slouken@53
   538
                  if [ -x /usr/bin/getconf ]; then
slouken@53
   539
                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
slouken@53
   540
                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
slouken@53
   541
                    case "${sc_cpu_version}" in
slouken@53
   542
                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
slouken@53
   543
                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
slouken@53
   544
                      532)                      # CPU_PA_RISC2_0
slouken@53
   545
                        case "${sc_kernel_bits}" in
slouken@53
   546
                          32) HP_ARCH="hppa2.0n" ;;
slouken@53
   547
                          64) HP_ARCH="hppa2.0w" ;;
slouken@53
   548
                        esac ;;
slouken@53
   549
                    esac
slouken@53
   550
                  fi ;;
slouken@53
   551
              esac
slouken@53
   552
              if [ "${HP_ARCH}" = "" ]; then
slouken@0
   553
              sed 's/^              //' << EOF >$dummy.c
slouken@53
   554
slouken@53
   555
              #define _HPUX_SOURCE
slouken@0
   556
              #include <stdlib.h>
slouken@0
   557
              #include <unistd.h>
slouken@0
   558
slouken@0
   559
              int main ()
slouken@0
   560
              {
slouken@0
   561
              #if defined(_SC_KERNEL_BITS)
slouken@0
   562
                  long bits = sysconf(_SC_KERNEL_BITS);
slouken@0
   563
              #endif
slouken@0
   564
                  long cpu  = sysconf (_SC_CPU_VERSION);
slouken@0
   565
slouken@0
   566
                  switch (cpu)
slouken@0
   567
              	{
slouken@0
   568
              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
slouken@0
   569
              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
slouken@0
   570
              	case CPU_PA_RISC2_0:
slouken@0
   571
              #if defined(_SC_KERNEL_BITS)
slouken@0
   572
              	    switch (bits)
slouken@0
   573
              		{
slouken@0
   574
              		case 64: puts ("hppa2.0w"); break;
slouken@0
   575
              		case 32: puts ("hppa2.0n"); break;
slouken@0
   576
              		default: puts ("hppa2.0"); break;
slouken@0
   577
              		} break;
slouken@0
   578
              #else  /* !defined(_SC_KERNEL_BITS) */
slouken@0
   579
              	    puts ("hppa2.0"); break;
slouken@0
   580
              #endif
slouken@0
   581
              	default: puts ("hppa1.0"); break;
slouken@0
   582
              	}
slouken@0
   583
                  exit (0);
slouken@0
   584
              }
slouken@0
   585
EOF
slouken@53
   586
	(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
slouken@53
   587
	if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
slouken@0
   588
	rm -f $dummy.c $dummy
slouken@53
   589
	fi ;;
slouken@0
   590
	esac
slouken@53
   591
	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
slouken@53
   592
	exit 0 ;;
slouken@53
   593
    ia64:HP-UX:*:*)
slouken@28
   594
	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
slouken@53
   595
	echo ia64-hp-hpux${HPUX_REV}
slouken@0
   596
	exit 0 ;;
slouken@0
   597
    3050*:HI-UX:*:*)
slouken@0
   598
	sed 's/^	//' << EOF >$dummy.c
slouken@0
   599
	#include <unistd.h>
slouken@0
   600
	int
slouken@0
   601
	main ()
slouken@0
   602
	{
slouken@0
   603
	  long cpu = sysconf (_SC_CPU_VERSION);
slouken@0
   604
	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
slouken@0
   605
	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
slouken@0
   606
	     results, however.  */
slouken@0
   607
	  if (CPU_IS_PA_RISC (cpu))
slouken@0
   608
	    {
slouken@0
   609
	      switch (cpu)
slouken@0
   610
		{
slouken@0
   611
		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
slouken@0
   612
		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
slouken@0
   613
		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
slouken@0
   614
		  default: puts ("hppa-hitachi-hiuxwe2"); break;
slouken@0
   615
		}
slouken@0
   616
	    }
slouken@0
   617
	  else if (CPU_IS_HP_MC68K (cpu))
slouken@0
   618
	    puts ("m68k-hitachi-hiuxwe2");
slouken@0
   619
	  else puts ("unknown-hitachi-hiuxwe2");
slouken@0
   620
	  exit (0);
slouken@0
   621
	}
slouken@0
   622
EOF
slouken@53
   623
	$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
slouken@0
   624
	rm -f $dummy.c $dummy
slouken@0
   625
	echo unknown-hitachi-hiuxwe2
slouken@0
   626
	exit 0 ;;
slouken@0
   627
    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
slouken@0
   628
	echo hppa1.1-hp-bsd
slouken@0
   629
	exit 0 ;;
slouken@0
   630
    9000/8??:4.3bsd:*:*)
slouken@0
   631
	echo hppa1.0-hp-bsd
slouken@0
   632
	exit 0 ;;
slouken@0
   633
    *9??*:MPE/iX:*:*)
slouken@0
   634
	echo hppa1.0-hp-mpeix
slouken@0
   635
	exit 0 ;;
slouken@0
   636
    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
slouken@0
   637
	echo hppa1.1-hp-osf
slouken@0
   638
	exit 0 ;;
slouken@0
   639
    hp8??:OSF1:*:*)
slouken@0
   640
	echo hppa1.0-hp-osf
slouken@0
   641
	exit 0 ;;
slouken@0
   642
    i?86:OSF1:*:*)
slouken@0
   643
	if [ -x /usr/sbin/sysversion ] ; then
slouken@0
   644
	    echo ${UNAME_MACHINE}-unknown-osf1mk
slouken@0
   645
	else
slouken@0
   646
	    echo ${UNAME_MACHINE}-unknown-osf1
slouken@0
   647
	fi
slouken@0
   648
	exit 0 ;;
slouken@0
   649
    parisc*:Lites*:*:*)
slouken@0
   650
	echo hppa1.1-hp-lites
slouken@0
   651
	exit 0 ;;
slouken@0
   652
    hppa*:OpenBSD:*:*)
slouken@0
   653
	echo hppa-unknown-openbsd
slouken@0
   654
	exit 0 ;;
slouken@0
   655
    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
slouken@0
   656
	echo c1-convex-bsd
slouken@0
   657
        exit 0 ;;
slouken@0
   658
    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
slouken@0
   659
	if getsysinfo -f scalar_acc
slouken@0
   660
	then echo c32-convex-bsd
slouken@0
   661
	else echo c2-convex-bsd
slouken@0
   662
	fi
slouken@0
   663
        exit 0 ;;
slouken@0
   664
    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
slouken@0
   665
	echo c34-convex-bsd
slouken@0
   666
        exit 0 ;;
slouken@0
   667
    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
slouken@0
   668
	echo c38-convex-bsd
slouken@0
   669
        exit 0 ;;
slouken@0
   670
    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
slouken@0
   671
	echo c4-convex-bsd
slouken@0
   672
        exit 0 ;;
slouken@0
   673
    CRAY*X-MP:*:*:*)
slouken@0
   674
	echo xmp-cray-unicos
slouken@0
   675
        exit 0 ;;
slouken@0
   676
    CRAY*Y-MP:*:*:*)
slouken@0
   677
	echo ymp-cray-unicos${UNAME_RELEASE}
slouken@0
   678
	exit 0 ;;
slouken@0
   679
    CRAY*[A-Z]90:*:*:*)
slouken@0
   680
	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
slouken@0
   681
	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
slouken@0
   682
	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
slouken@0
   683
	exit 0 ;;
slouken@0
   684
    CRAY*TS:*:*:*)
slouken@53
   685
	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
slouken@53
   686
	exit 0 ;;
slouken@53
   687
    CRAY*T3D:*:*:*)
slouken@53
   688
	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
slouken@0
   689
	exit 0 ;;
slouken@0
   690
    CRAY*T3E:*:*:*)
slouken@53
   691
	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
slouken@53
   692
	exit 0 ;;
slouken@53
   693
    CRAY*SV1:*:*:*)
slouken@53
   694
	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
slouken@0
   695
	exit 0 ;;
slouken@0
   696
    CRAY-2:*:*:*)
slouken@0
   697
	echo cray2-cray-unicos
slouken@0
   698
        exit 0 ;;
slouken@53
   699
    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
slouken@53
   700
	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
slouken@0
   701
        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
slouken@0
   702
        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
slouken@53
   703
        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
slouken@0
   704
        exit 0 ;;
slouken@0
   705
    hp300:OpenBSD:*:*)
slouken@0
   706
	echo m68k-unknown-openbsd${UNAME_RELEASE}
slouken@0
   707
	exit 0 ;;
slouken@53
   708
    i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
slouken@0
   709
	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
slouken@0
   710
	exit 0 ;;
slouken@0
   711
    sparc*:BSD/OS:*:*)
slouken@0
   712
	echo sparc-unknown-bsdi${UNAME_RELEASE}
slouken@0
   713
	exit 0 ;;
slouken@0
   714
    *:BSD/OS:*:*)
slouken@0
   715
	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
slouken@0
   716
	exit 0 ;;
slouken@0
   717
    *:FreeBSD:*:*)
slouken@0
   718
	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
slouken@0
   719
	exit 0 ;;
slouken@0
   720
    *:OpenBSD:*:*)
slouken@0
   721
	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
slouken@0
   722
	exit 0 ;;
slouken@0
   723
    i*:CYGWIN*:*)
slouken@0
   724
	echo ${UNAME_MACHINE}-pc-cygwin
slouken@0
   725
	exit 0 ;;
slouken@0
   726
    i*:MINGW*:*)
slouken@0
   727
	echo ${UNAME_MACHINE}-pc-mingw32
slouken@0
   728
	exit 0 ;;
slouken@53
   729
    i*:PW*:*)
slouken@53
   730
	echo ${UNAME_MACHINE}-pc-pw32
slouken@53
   731
	exit 0 ;;
slouken@0
   732
    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
slouken@0
   733
	# How do we know it's Interix rather than the generic POSIX subsystem?
slouken@0
   734
	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
slouken@0
   735
	# UNAME_MACHINE based on the output of uname instead of i386?
slouken@0
   736
	echo i386-pc-interix
slouken@0
   737
	exit 0 ;;
slouken@0
   738
    i*:UWIN*:*)
slouken@0
   739
	echo ${UNAME_MACHINE}-pc-uwin
slouken@0
   740
	exit 0 ;;
slouken@0
   741
    p*:CYGWIN*:*)
slouken@0
   742
	echo powerpcle-unknown-cygwin
slouken@0
   743
	exit 0 ;;
slouken@0
   744
    prep*:SunOS:5.*:*)
slouken@0
   745
	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
slouken@0
   746
	exit 0 ;;
slouken@0
   747
    *:GNU:*:*)
slouken@0
   748
	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
slouken@0
   749
	exit 0 ;;
slouken@53
   750
    i*86:Minix:*:*)
slouken@53
   751
	echo ${UNAME_MACHINE}-pc-minix
slouken@53
   752
	exit 0 ;;
slouken@53
   753
    arm*:Linux:*:*)
slouken@53
   754
	echo ${UNAME_MACHINE}-unknown-linux-gnu
slouken@53
   755
	exit 0 ;;
slouken@53
   756
    ia64:Linux:*:*)
slouken@53
   757
	echo ${UNAME_MACHINE}-unknown-linux
slouken@53
   758
	exit 0 ;;
slouken@53
   759
    m68*:Linux:*:*)
slouken@53
   760
	echo ${UNAME_MACHINE}-unknown-linux-gnu
slouken@53
   761
	exit 0 ;;
slouken@53
   762
    mips:Linux:*:*)
slouken@53
   763
	cat >$dummy.c <<EOF
slouken@53
   764
#ifdef __cplusplus
slouken@53
   765
#include <stdio.h>  /* for printf() prototype */
slouken@53
   766
int main (int argc, char *argv[]) {
slouken@53
   767
#else
slouken@53
   768
int main (argc, argv) int argc; char *argv[]; {
slouken@53
   769
#endif
slouken@53
   770
#ifdef __MIPSEB__
slouken@53
   771
  printf ("%s-unknown-linux-gnu\n", argv[1]);
slouken@53
   772
#endif
slouken@53
   773
#ifdef __MIPSEL__
slouken@53
   774
  printf ("%sel-unknown-linux-gnu\n", argv[1]);
slouken@53
   775
#endif
slouken@53
   776
  return 0;
slouken@53
   777
}
slouken@53
   778
EOF
slouken@53
   779
	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
slouken@53
   780
	rm -f $dummy.c $dummy
slouken@53
   781
	;;
slouken@53
   782
    ppc:Linux:*:*)
slouken@53
   783
	# Determine Lib Version
slouken@53
   784
	cat >$dummy.c <<EOF
slouken@0
   785
#include <features.h>
slouken@0
   786
#if defined(__GLIBC__)
slouken@0
   787
extern char __libc_version[];
slouken@0
   788
extern char __libc_release[];
slouken@0
   789
#endif
slouken@0
   790
main(argc, argv)
slouken@0
   791
     int argc;
slouken@0
   792
     char *argv[];
slouken@0
   793
{
slouken@0
   794
#if defined(__GLIBC__)
slouken@0
   795
  printf("%s %s\n", __libc_version, __libc_release);
slouken@0
   796
#else
slouken@53
   797
  printf("unknown\n");
slouken@0
   798
#endif
slouken@0
   799
  return 0;
slouken@0
   800
}
slouken@0
   801
EOF
slouken@53
   802
	LIBC=""
slouken@53
   803
	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
slouken@53
   804
	if test "$?" = 0 ; then
slouken@53
   805
		./$dummy | grep 1\.99 > /dev/null
slouken@53
   806
		if test "$?" = 0 ; then LIBC="libc1" ; fi
slouken@53
   807
	fi
slouken@53
   808
	rm -f $dummy.c $dummy
slouken@53
   809
	echo powerpc-unknown-linux-gnu${LIBC}
slouken@53
   810
	exit 0 ;;
slouken@53
   811
    alpha:Linux:*:*)
slouken@53
   812
	cat <<EOF >$dummy.s
slouken@53
   813
	  .data
slouken@53
   814
	  \$Lformat:
slouken@53
   815
		.byte 37,100,45,37,120,10,0	# "%d-%x\n"
slouken@53
   816
	   .text
slouken@0
   817
		.globl main
slouken@53
   818
		.align 4
slouken@0
   819
		.ent main
slouken@53
   820
	    main:
slouken@53
   821
		.frame \$30,16,\$26,0
slouken@53
   822
		ldgp \$29,0(\$27)
slouken@53
   823
		.prologue 1
slouken@53
   824
		.long 0x47e03d80 # implver \$0
slouken@53
   825
		lda \$2,-1
slouken@53
   826
		.long 0x47e20c21 # amask \$2,\$1
slouken@53
   827
		lda \$16,\$Lformat
slouken@53
   828
		mov \$0,\$17
slouken@53
   829
		not \$1,\$18
slouken@53
   830
		jsr \$26,printf
slouken@53
   831
		ldgp \$29,0(\$26)
slouken@53
   832
		mov 0,\$16
slouken@53
   833
		jsr \$26,exit
slouken@0
   834
		.end main
slouken@0
   835
EOF
slouken@53
   836
	LIBC=""
slouken@53
   837
	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
slouken@53
   838
	if test "$?" = 0 ; then
slouken@53
   839
		case `./$dummy` in
slouken@53
   840
		0-0)	UNAME_MACHINE="alpha" ;;
slouken@53
   841
		1-0)	UNAME_MACHINE="alphaev5" ;;
slouken@53
   842
		1-1)    UNAME_MACHINE="alphaev56" ;;
slouken@53
   843
		1-101)	UNAME_MACHINE="alphapca56" ;;
slouken@53
   844
		2-303)	UNAME_MACHINE="alphaev6" ;;
slouken@53
   845
		2-307)	UNAME_MACHINE="alphaev67" ;;
slouken@53
   846
		esac
slouken@53
   847
		objdump --private-headers $dummy | \
slouken@53
   848
		  grep ld.so.1 > /dev/null
slouken@0
   849
		if test "$?" = 0 ; then
slouken@53
   850
			LIBC="libc1"
slouken@0
   851
		fi
slouken@53
   852
	fi
slouken@53
   853
	rm -f $dummy.s $dummy
slouken@53
   854
	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
slouken@53
   855
	exit 0 ;;
slouken@53
   856
    parisc:Linux:*:* | hppa:Linux:*:*)
slouken@53
   857
	# Look for CPU level
slouken@53
   858
	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
slouken@53
   859
	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
slouken@53
   860
	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
slouken@53
   861
	  *)    echo hppa-unknown-linux-gnu ;;
slouken@53
   862
	esac
slouken@53
   863
	exit 0 ;;
slouken@53
   864
    parisc64:Linux:*:* | hppa64:Linux:*:*)
slouken@53
   865
	echo hppa64-unknown-linux-gnu
slouken@53
   866
	exit 0 ;;
slouken@53
   867
    s390:Linux:*:* | s390x:Linux:*:*)
slouken@53
   868
	echo ${UNAME_MACHINE}-ibm-linux
slouken@53
   869
	exit 0 ;;
slouken@53
   870
    sh*:Linux:*:*)
slouken@53
   871
	echo ${UNAME_MACHINE}-unknown-linux-gnu
slouken@53
   872
	exit 0 ;;
slouken@53
   873
    sparc:Linux:*:* | sparc64:Linux:*:*)
slouken@53
   874
	echo ${UNAME_MACHINE}-unknown-linux-gnu
slouken@53
   875
	exit 0 ;;
slouken@53
   876
    x86_64:Linux:*:*)
slouken@53
   877
	echo x86_64-unknown-linux-gnu
slouken@53
   878
	exit 0 ;;
slouken@53
   879
    i?86:Linux:*:*)
slouken@53
   880
	# The BFD linker knows what the default object file format is, so
slouken@53
   881
	# first see if it will tell us. cd to the root directory to prevent
slouken@53
   882
	# problems with other programs or directories called `ld' in the path.
slouken@53
   883
	ld_supported_emulations=`cd /; ld --help 2>&1 \
slouken@53
   884
			 | sed -ne '/supported emulations:/!d
slouken@53
   885
				    s/[ 	][ 	]*/ /g
slouken@53
   886
				    s/.*supported emulations: *//
slouken@53
   887
				    s/ .*//
slouken@53
   888
				    p'`
slouken@53
   889
        case "$ld_supported_emulations" in
slouken@53
   890
	  i?86linux)
slouken@53
   891
		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
slouken@53
   892
		exit 0
slouken@53
   893
		;;
slouken@53
   894
	  elf_i?86)
slouken@53
   895
		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
slouken@53
   896
		;;
slouken@53
   897
	  i?86coff)
slouken@53
   898
		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
slouken@53
   899
		exit 0
slouken@53
   900
		;;
slouken@53
   901
	esac
slouken@53
   902
	# Either a pre-BFD a.out linker (linux-gnuoldld)
slouken@53
   903
	# or one that does not give us useful --help.
slouken@53
   904
	# GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
slouken@53
   905
	# If ld does not provide *any* "supported emulations:"
slouken@53
   906
	# that means it is gnuoldld.
slouken@53
   907
	test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
slouken@53
   908
	case "${UNAME_MACHINE}" in
slouken@53
   909
	i?86)
slouken@53
   910
	  VENDOR=pc;
slouken@53
   911
	  ;;
slouken@53
   912
	*)
slouken@53
   913
	  VENDOR=unknown;
slouken@53
   914
	  ;;
slouken@53
   915
	esac
slouken@53
   916
	# Determine whether the default compiler is a.out or elf
slouken@53
   917
	cat >$dummy.c <<EOF
slouken@0
   918
#include <features.h>
slouken@0
   919
#ifdef __cplusplus
slouken@53
   920
#include <stdio.h>  /* for printf() prototype */
slouken@0
   921
	int main (int argc, char *argv[]) {
slouken@0
   922
#else
slouken@0
   923
	int main (argc, argv) int argc; char *argv[]; {
slouken@0
   924
#endif
slouken@0
   925
#ifdef __ELF__
slouken@0
   926
# ifdef __GLIBC__
slouken@0
   927
#  if __GLIBC__ >= 2
slouken@0
   928
    printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
slouken@0
   929
#  else
slouken@0
   930
    printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
slouken@0
   931
#  endif
slouken@0
   932
# else
slouken@0
   933
   printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
slouken@0
   934
# endif
slouken@0
   935
#else
slouken@0
   936
  printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
slouken@0
   937
#endif
slouken@0
   938
  return 0;
slouken@0
   939
}
slouken@0
   940
EOF
slouken@53
   941
	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
slouken@53
   942
	rm -f $dummy.c $dummy
slouken@53
   943
	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
slouken@53
   944
	;;
slouken@0
   945
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
slouken@0
   946
# are messed up and put the nodename in both sysname and nodename.
slouken@0
   947
    i?86:DYNIX/ptx:4*:*)
slouken@0
   948
	echo i386-sequent-sysv4
slouken@0
   949
	exit 0 ;;
slouken@0
   950
    i?86:UNIX_SV:4.2MP:2.*)
slouken@0
   951
        # Unixware is an offshoot of SVR4, but it has its own version
slouken@0
   952
        # number series starting with 2...
slouken@0
   953
        # I am not positive that other SVR4 systems won't match this,
slouken@0
   954
	# I just have to hope.  -- rms.
slouken@0
   955
        # Use sysv4.2uw... so that sysv4* matches it.
slouken@0
   956
	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
slouken@0
   957
	exit 0 ;;
slouken@0
   958
    i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
slouken@53
   959
	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
slouken@0
   960
	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
slouken@53
   961
		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
slouken@0
   962
	else
slouken@53
   963
		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
slouken@0
   964
	fi
slouken@0
   965
	exit 0 ;;
slouken@0
   966
    i?86:*:5:7*)
slouken@53
   967
        # Fixed at (any) Pentium or better
slouken@53
   968
        UNAME_MACHINE=i586
slouken@53
   969
        if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
slouken@53
   970
	    echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
slouken@53
   971
	else
slouken@53
   972
	    echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
slouken@53
   973
	fi
slouken@0
   974
	exit 0 ;;
slouken@0
   975
    i?86:*:3.2:*)
slouken@0
   976
	if test -f /usr/options/cb.name; then
slouken@0
   977
		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
slouken@0
   978
		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
slouken@0
   979
	elif /bin/uname -X 2>/dev/null >/dev/null ; then
slouken@0
   980
		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
slouken@0
   981
		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
slouken@0
   982
		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
slouken@0
   983
			&& UNAME_MACHINE=i586
slouken@0
   984
		(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
slouken@0
   985
			&& UNAME_MACHINE=i686
slouken@0
   986
		(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
slouken@0
   987
			&& UNAME_MACHINE=i686
slouken@0
   988
		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
slouken@0
   989
	else
slouken@0
   990
		echo ${UNAME_MACHINE}-pc-sysv32
slouken@0
   991
	fi
slouken@0
   992
	exit 0 ;;
slouken@53
   993
    i?86:*DOS:*:*)
slouken@53
   994
	echo ${UNAME_MACHINE}-pc-msdosdjgpp
slouken@53
   995
	exit 0 ;;
slouken@0
   996
    pc:*:*:*)
slouken@53
   997
	# Left here for compatibility:
slouken@0
   998
        # uname -m prints for DJGPP always 'pc', but it prints nothing about
slouken@0
   999
        # the processor, so we play safe by assuming i386.
slouken@0
  1000
	echo i386-pc-msdosdjgpp
slouken@0
  1001
        exit 0 ;;
slouken@0
  1002
    Intel:Mach:3*:*)
slouken@0
  1003
	echo i386-pc-mach3
slouken@0
  1004
	exit 0 ;;
slouken@0
  1005
    paragon:*:*:*)
slouken@0
  1006
	echo i860-intel-osf1
slouken@0
  1007
	exit 0 ;;
slouken@0
  1008
    i860:*:4.*:*) # i860-SVR4
slouken@0
  1009
	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
slouken@0
  1010
	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
slouken@0
  1011
	else # Add other i860-SVR4 vendors below as they are discovered.
slouken@0
  1012
	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
slouken@0
  1013
	fi
slouken@0
  1014
	exit 0 ;;
slouken@0
  1015
    mini*:CTIX:SYS*5:*)
slouken@0
  1016
	# "miniframe"
slouken@0
  1017
	echo m68010-convergent-sysv
slouken@0
  1018
	exit 0 ;;
slouken@0
  1019
    M68*:*:R3V[567]*:*)
slouken@0
  1020
	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
slouken@53
  1021
    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
slouken@0
  1022
	OS_REL=''
slouken@0
  1023
	test -r /etc/.relid \
slouken@0
  1024
	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
slouken@0
  1025
	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
slouken@0
  1026
	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
slouken@0
  1027
	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
slouken@0
  1028
	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
slouken@0
  1029
    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
slouken@0
  1030
        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
slouken@0
  1031
          && echo i486-ncr-sysv4 && exit 0 ;;
slouken@0
  1032
    m68*:LynxOS:2.*:*)
slouken@0
  1033
	echo m68k-unknown-lynxos${UNAME_RELEASE}
slouken@0
  1034
	exit 0 ;;
slouken@0
  1035
    mc68030:UNIX_System_V:4.*:*)
slouken@0
  1036
	echo m68k-atari-sysv4
slouken@0
  1037
	exit 0 ;;
slouken@0
  1038
    i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
slouken@0
  1039
	echo i386-unknown-lynxos${UNAME_RELEASE}
slouken@0
  1040
	exit 0 ;;
slouken@0
  1041
    TSUNAMI:LynxOS:2.*:*)
slouken@0
  1042
	echo sparc-unknown-lynxos${UNAME_RELEASE}
slouken@0
  1043
	exit 0 ;;
slouken@53
  1044
    rs6000:LynxOS:2.*:*)
slouken@0
  1045
	echo rs6000-unknown-lynxos${UNAME_RELEASE}
slouken@0
  1046
	exit 0 ;;
slouken@53
  1047
    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:*)
slouken@53
  1048
	echo powerpc-unknown-lynxos${UNAME_RELEASE}
slouken@53
  1049
	exit 0 ;;
slouken@0
  1050
    SM[BE]S:UNIX_SV:*:*)
slouken@0
  1051
	echo mips-dde-sysv${UNAME_RELEASE}
slouken@0
  1052
	exit 0 ;;
slouken@0
  1053
    RM*:ReliantUNIX-*:*:*)
slouken@0
  1054
	echo mips-sni-sysv4
slouken@0
  1055
	exit 0 ;;
slouken@0
  1056
    RM*:SINIX-*:*:*)
slouken@0
  1057
	echo mips-sni-sysv4
slouken@0
  1058
	exit 0 ;;
slouken@0
  1059
    *:SINIX-*:*:*)
slouken@0
  1060
	if uname -p 2>/dev/null >/dev/null ; then
slouken@0
  1061
		UNAME_MACHINE=`(uname -p) 2>/dev/null`
slouken@0
  1062
		echo ${UNAME_MACHINE}-sni-sysv4
slouken@0
  1063
	else
slouken@0
  1064
		echo ns32k-sni-sysv
slouken@0
  1065
	fi
slouken@0
  1066
	exit 0 ;;
slouken@0
  1067
    PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
slouken@0
  1068
                           # says <Richard.M.Bartel@ccMail.Census.GOV>
slouken@0
  1069
        echo i586-unisys-sysv4
slouken@0
  1070
        exit 0 ;;
slouken@0
  1071
    *:UNIX_System_V:4*:FTX*)
slouken@0
  1072
	# From Gerald Hewes <hewes@openmarket.com>.
slouken@0
  1073
	# How about differentiating between stratus architectures? -djm
slouken@0
  1074
	echo hppa1.1-stratus-sysv4
slouken@0
  1075
	exit 0 ;;
slouken@0
  1076
    *:*:*:FTX*)
slouken@0
  1077
	# From seanf@swdc.stratus.com.
slouken@0
  1078
	echo i860-stratus-sysv4
slouken@0
  1079
	exit 0 ;;
slouken@0
  1080
    mc68*:A/UX:*:*)
slouken@0
  1081
	echo m68k-apple-aux${UNAME_RELEASE}
slouken@0
  1082
	exit 0 ;;
slouken@53
  1083
    news*:NEWS-OS:6*:*)
slouken@0
  1084
	echo mips-sony-newsos6
slouken@0
  1085
	exit 0 ;;
slouken@0
  1086
    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
slouken@0
  1087
	if [ -d /usr/nec ]; then
slouken@0
  1088
	        echo mips-nec-sysv${UNAME_RELEASE}
slouken@0
  1089
	else
slouken@0
  1090
	        echo mips-unknown-sysv${UNAME_RELEASE}
slouken@0
  1091
	fi
slouken@0
  1092
        exit 0 ;;
slouken@0
  1093
    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
slouken@0
  1094
	echo powerpc-be-beos
slouken@0
  1095
	exit 0 ;;
slouken@0
  1096
    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
slouken@0
  1097
	echo powerpc-apple-beos
slouken@0
  1098
	exit 0 ;;
slouken@0
  1099
    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
slouken@0
  1100
	echo i586-pc-beos
slouken@0
  1101
	exit 0 ;;
slouken@0
  1102
    SX-4:SUPER-UX:*:*)
slouken@0
  1103
	echo sx4-nec-superux${UNAME_RELEASE}
slouken@0
  1104
	exit 0 ;;
slouken@0
  1105
    SX-5:SUPER-UX:*:*)
slouken@0
  1106
	echo sx5-nec-superux${UNAME_RELEASE}
slouken@0
  1107
	exit 0 ;;
slouken@0
  1108
    Power*:Rhapsody:*:*)
slouken@0
  1109
	echo powerpc-apple-rhapsody${UNAME_RELEASE}
slouken@0
  1110
	exit 0 ;;
slouken@0
  1111
    *:Rhapsody:*:*)
slouken@0
  1112
	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
slouken@0
  1113
	exit 0 ;;
slouken@53
  1114
    *:Darwin:*:*)
slouken@53
  1115
	echo `uname -p`-apple-darwin${UNAME_RELEASE}
slouken@53
  1116
	exit 0 ;;
slouken@53
  1117
    *:procnto*:*:* | *:QNX:[0123456789]*:*)
slouken@53
  1118
	if test "${UNAME_MACHINE}" = "x86pc"; then
slouken@53
  1119
		UNAME_MACHINE=pc
slouken@53
  1120
	fi
slouken@53
  1121
	echo `uname -p`-${UNAME_MACHINE}-nto-qnx
slouken@53
  1122
	exit 0 ;;
slouken@53
  1123
    *:QNX:*:4*)
slouken@53
  1124
	echo i386-pc-qnx
slouken@53
  1125
	exit 0 ;;
slouken@53
  1126
    NSR-[KW]:NONSTOP_KERNEL:*:*)
slouken@53
  1127
	echo nsr-tandem-nsk${UNAME_RELEASE}
slouken@53
  1128
	exit 0 ;;
slouken@53
  1129
    *:NonStop-UX:*:*)
slouken@53
  1130
	echo mips-compaq-nonstopux
slouken@53
  1131
	exit 0 ;;
slouken@53
  1132
    BS2000:POSIX*:*:*)
slouken@53
  1133
	echo bs2000-siemens-sysv
slouken@53
  1134
	exit 0 ;;
slouken@53
  1135
    DS/*:UNIX_System_V:*:*)
slouken@53
  1136
	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
slouken@53
  1137
	exit 0 ;;
slouken@53
  1138
    *:Plan9:*:*)
slouken@53
  1139
	# "uname -m" is not consistent, so use $cputype instead. 386
slouken@53
  1140
	# is converted to i386 for consistency with other x86
slouken@53
  1141
	# operating systems.
slouken@53
  1142
	if test "$cputype" = "386"; then
slouken@53
  1143
	    UNAME_MACHINE=i386
slouken@53
  1144
	else
slouken@53
  1145
	    UNAME_MACHINE="$cputype"
slouken@53
  1146
	fi
slouken@53
  1147
	echo ${UNAME_MACHINE}-unknown-plan9
slouken@53
  1148
	exit 0 ;;
slouken@53
  1149
    i?86:OS/2:*:*)
slouken@53
  1150
	# If we were able to find `uname', then EMX Unix compatibility
slouken@53
  1151
	# is probably installed.
slouken@53
  1152
	echo ${UNAME_MACHINE}-pc-os2-emx
slouken@53
  1153
	exit 0 ;;
slouken@53
  1154
    *:TOPS-10:*:*)
slouken@53
  1155
	echo pdp10-unknown-tops10
slouken@53
  1156
	exit 0 ;;
slouken@53
  1157
    *:TENEX:*:*)
slouken@53
  1158
	echo pdp10-unknown-tenex
slouken@53
  1159
	exit 0 ;;
slouken@53
  1160
    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
slouken@53
  1161
	echo pdp10-dec-tops20
slouken@53
  1162
	exit 0 ;;
slouken@53
  1163
    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
slouken@53
  1164
	echo pdp10-xkl-tops20
slouken@53
  1165
	exit 0 ;;
slouken@53
  1166
    *:TOPS-20:*:*)
slouken@53
  1167
	echo pdp10-unknown-tops20
slouken@53
  1168
	exit 0 ;;
slouken@53
  1169
    *:ITS:*:*)
slouken@53
  1170
	echo pdp10-unknown-its
slouken@53
  1171
	exit 0 ;;
slouken@0
  1172
esac
slouken@0
  1173
slouken@0
  1174
#echo '(No uname command or uname output not recognized.)' 1>&2
slouken@0
  1175
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
slouken@0
  1176
slouken@0
  1177
cat >$dummy.c <<EOF
slouken@0
  1178
#ifdef _SEQUENT_
slouken@0
  1179
# include <sys/types.h>
slouken@0
  1180
# include <sys/utsname.h>
slouken@0
  1181
#endif
slouken@0
  1182
main ()
slouken@0
  1183
{
slouken@0
  1184
#if defined (sony)
slouken@0
  1185
#if defined (MIPSEB)
slouken@0
  1186
  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
slouken@0
  1187
     I don't know....  */
slouken@0
  1188
  printf ("mips-sony-bsd\n"); exit (0);
slouken@0
  1189
#else
slouken@0
  1190
#include <sys/param.h>
slouken@0
  1191
  printf ("m68k-sony-newsos%s\n",
slouken@0
  1192
#ifdef NEWSOS4
slouken@0
  1193
          "4"
slouken@0
  1194
#else
slouken@0
  1195
	  ""
slouken@0
  1196
#endif
slouken@0
  1197
         ); exit (0);
slouken@0
  1198
#endif
slouken@0
  1199
#endif
slouken@0
  1200
slouken@0
  1201
#if defined (__arm) && defined (__acorn) && defined (__unix)
slouken@0
  1202
  printf ("arm-acorn-riscix"); exit (0);
slouken@0
  1203
#endif
slouken@0
  1204
slouken@0
  1205
#if defined (hp300) && !defined (hpux)
slouken@0
  1206
  printf ("m68k-hp-bsd\n"); exit (0);
slouken@0
  1207
#endif
slouken@0
  1208
slouken@0
  1209
#if defined (NeXT)
slouken@0
  1210
#if !defined (__ARCHITECTURE__)
slouken@0
  1211
#define __ARCHITECTURE__ "m68k"
slouken@0
  1212
#endif
slouken@0
  1213
  int version;
slouken@0
  1214
  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
slouken@0
  1215
  if (version < 4)
slouken@0
  1216
    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
slouken@0
  1217
  else
slouken@0
  1218
    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
slouken@0
  1219
  exit (0);
slouken@0
  1220
#endif
slouken@0
  1221
slouken@0
  1222
#if defined (MULTIMAX) || defined (n16)
slouken@0
  1223
#if defined (UMAXV)
slouken@0
  1224
  printf ("ns32k-encore-sysv\n"); exit (0);
slouken@0
  1225
#else
slouken@0
  1226
#if defined (CMU)
slouken@0
  1227
  printf ("ns32k-encore-mach\n"); exit (0);
slouken@0
  1228
#else
slouken@0
  1229
  printf ("ns32k-encore-bsd\n"); exit (0);
slouken@0
  1230
#endif
slouken@0
  1231
#endif
slouken@0
  1232
#endif
slouken@0
  1233
slouken@0
  1234
#if defined (__386BSD__)
slouken@0
  1235
  printf ("i386-pc-bsd\n"); exit (0);
slouken@0
  1236
#endif
slouken@0
  1237
slouken@0
  1238
#if defined (sequent)
slouken@0
  1239
#if defined (i386)
slouken@0
  1240
  printf ("i386-sequent-dynix\n"); exit (0);
slouken@0
  1241
#endif
slouken@0
  1242
#if defined (ns32000)
slouken@0
  1243
  printf ("ns32k-sequent-dynix\n"); exit (0);
slouken@0
  1244
#endif
slouken@0
  1245
#endif
slouken@0
  1246
slouken@0
  1247
#if defined (_SEQUENT_)
slouken@0
  1248
    struct utsname un;
slouken@0
  1249
slouken@0
  1250
    uname(&un);
slouken@0
  1251
slouken@0
  1252
    if (strncmp(un.version, "V2", 2) == 0) {
slouken@0
  1253
	printf ("i386-sequent-ptx2\n"); exit (0);
slouken@0
  1254
    }
slouken@0
  1255
    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
slouken@0
  1256
	printf ("i386-sequent-ptx1\n"); exit (0);
slouken@0
  1257
    }
slouken@0
  1258
    printf ("i386-sequent-ptx\n"); exit (0);
slouken@0
  1259
slouken@0
  1260
#endif
slouken@0
  1261
slouken@0
  1262
#if defined (vax)
slouken@53
  1263
# if !defined (ultrix)
slouken@53
  1264
#  include <sys/param.h>
slouken@53
  1265
#  if defined (BSD)
slouken@53
  1266
#   if BSD == 43
slouken@53
  1267
      printf ("vax-dec-bsd4.3\n"); exit (0);
slouken@53
  1268
#   else
slouken@53
  1269
#    if BSD == 199006
slouken@53
  1270
      printf ("vax-dec-bsd4.3reno\n"); exit (0);
slouken@53
  1271
#    else
slouken@53
  1272
      printf ("vax-dec-bsd\n"); exit (0);
slouken@53
  1273
#    endif
slouken@53
  1274
#   endif
slouken@53
  1275
#  else
slouken@53
  1276
    printf ("vax-dec-bsd\n"); exit (0);
slouken@53
  1277
#  endif
slouken@53
  1278
# else
slouken@53
  1279
    printf ("vax-dec-ultrix\n"); exit (0);
slouken@53
  1280
# endif
slouken@0
  1281
#endif
slouken@0
  1282
slouken@0
  1283
#if defined (alliant) && defined (i860)
slouken@0
  1284
  printf ("i860-alliant-bsd\n"); exit (0);
slouken@0
  1285
#endif
slouken@0
  1286
slouken@0
  1287
  exit (1);
slouken@0
  1288
}
slouken@0
  1289
EOF
slouken@0
  1290
slouken@53
  1291
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
slouken@0
  1292
rm -f $dummy.c $dummy
slouken@0
  1293
slouken@0
  1294
# Apollos put the system type in the environment.
slouken@0
  1295
slouken@0
  1296
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
slouken@0
  1297
slouken@0
  1298
# Convex versions that predate uname can use getsysinfo(1)
slouken@0
  1299
slouken@0
  1300
if [ -x /usr/convex/getsysinfo ]
slouken@0
  1301
then
slouken@0
  1302
    case `getsysinfo -f cpu_type` in
slouken@0
  1303
    c1*)
slouken@0
  1304
	echo c1-convex-bsd
slouken@0
  1305
	exit 0 ;;
slouken@0
  1306
    c2*)
slouken@0
  1307
	if getsysinfo -f scalar_acc
slouken@0
  1308
	then echo c32-convex-bsd
slouken@0
  1309
	else echo c2-convex-bsd
slouken@0
  1310
	fi
slouken@0
  1311
	exit 0 ;;
slouken@0
  1312
    c34*)
slouken@0
  1313
	echo c34-convex-bsd
slouken@0
  1314
	exit 0 ;;
slouken@0
  1315
    c38*)
slouken@0
  1316
	echo c38-convex-bsd
slouken@0
  1317
	exit 0 ;;
slouken@0
  1318
    c4*)
slouken@0
  1319
	echo c4-convex-bsd
slouken@0
  1320
	exit 0 ;;
slouken@0
  1321
    esac
slouken@0
  1322
fi
slouken@0
  1323
slouken@53
  1324
cat >&2 <<EOF
slouken@53
  1325
$0: unable to guess system type
slouken@53
  1326
slouken@53
  1327
This script, last modified $timestamp, has failed to recognize
slouken@53
  1328
the operating system you are using. It is advised that you
slouken@53
  1329
download the most up to date version of the config scripts from
slouken@53
  1330
slouken@53
  1331
    ftp://ftp.gnu.org/pub/gnu/config/
slouken@53
  1332
slouken@53
  1333
If the version you run ($0) is already up to date, please
slouken@53
  1334
send the following data and any information you think might be
slouken@53
  1335
pertinent to <config-patches@gnu.org> in order to provide the needed
slouken@53
  1336
information to handle your system.
slouken@53
  1337
slouken@53
  1338
config.guess timestamp = $timestamp
slouken@53
  1339
slouken@53
  1340
uname -m = `(uname -m) 2>/dev/null || echo unknown`
slouken@53
  1341
uname -r = `(uname -r) 2>/dev/null || echo unknown`
slouken@53
  1342
uname -s = `(uname -s) 2>/dev/null || echo unknown`
slouken@53
  1343
uname -v = `(uname -v) 2>/dev/null || echo unknown`
slouken@53
  1344
slouken@53
  1345
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
slouken@53
  1346
/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
slouken@53
  1347
slouken@53
  1348
hostinfo               = `(hostinfo) 2>/dev/null`
slouken@53
  1349
/bin/universe          = `(/bin/universe) 2>/dev/null`
slouken@53
  1350
/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
slouken@53
  1351
/bin/arch              = `(/bin/arch) 2>/dev/null`
slouken@53
  1352
/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
slouken@53
  1353
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
slouken@53
  1354
slouken@53
  1355
UNAME_MACHINE = ${UNAME_MACHINE}
slouken@53
  1356
UNAME_RELEASE = ${UNAME_RELEASE}
slouken@53
  1357
UNAME_SYSTEM  = ${UNAME_SYSTEM}
slouken@53
  1358
UNAME_VERSION = ${UNAME_VERSION}
slouken@53
  1359
EOF
slouken@0
  1360
slouken@0
  1361
exit 1
slouken@53
  1362
slouken@53
  1363
# Local variables:
slouken@53
  1364
# eval: (add-hook 'write-file-hooks 'time-stamp)
slouken@53
  1365
# time-stamp-start: "timestamp='"
slouken@53
  1366
# time-stamp-format: "%:y-%02m-%02d"
slouken@53
  1367
# time-stamp-end: "'"
slouken@53
  1368
# End: