config.guess
author Stephane Peter
Sat, 30 Oct 1999 22:57:49 +0000
changeset 11 3939a99bf422
parent 0 4ce2db4db959
child 56 62ed6b0665a3
permissions -rw-r--r--
Various bugfixes for music looping
slouken@0
     1
#! /bin/sh
slouken@0
     2
# Attempt to guess a canonical system name.
slouken@0
     3
#   Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
slouken@0
     4
#
slouken@0
     5
# This file is free software; you can redistribute it and/or modify it
slouken@0
     6
# under the terms of the GNU General Public License as published by
slouken@0
     7
# the Free Software Foundation; either version 2 of the License, or
slouken@0
     8
# (at your option) any later version.
slouken@0
     9
#
slouken@0
    10
# This program is distributed in the hope that it will be useful, but
slouken@0
    11
# WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@0
    13
# General Public License for more details.
slouken@0
    14
#
slouken@0
    15
# You should have received a copy of the GNU General Public License
slouken@0
    16
# along with this program; if not, write to the Free Software
slouken@0
    17
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
slouken@0
    18
#
slouken@0
    19
# As a special exception to the GNU General Public License, if you
slouken@0
    20
# distribute this file as part of a program that contains a
slouken@0
    21
# configuration script generated by Autoconf, you may include it under
slouken@0
    22
# the same distribution terms that you use for the rest of that program.
slouken@0
    23
slouken@0
    24
# Written by Per Bothner <bothner@cygnus.com>.
slouken@0
    25
# The master version of this file is at the FSF in /home/gd/gnu/lib.
slouken@0
    26
#
slouken@0
    27
# This script attempts to guess a canonical system name similar to
slouken@0
    28
# config.sub.  If it succeeds, it prints the system name on stdout, and
slouken@0
    29
# exits with 0.  Otherwise, it exits with 1.
slouken@0
    30
#
slouken@0
    31
# The plan is that this can be called by configure scripts if you
slouken@0
    32
# don't specify an explicit system type (host/target name).
slouken@0
    33
#
slouken@0
    34
# Only a few systems have been added to this list; please add others
slouken@0
    35
# (but try to keep the structure clean).
slouken@0
    36
#
slouken@0
    37
slouken@0
    38
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
slouken@0
    39
# (ghazi@noc.rutgers.edu 8/24/94.)
slouken@0
    40
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
slouken@0
    41
	PATH=$PATH:/.attbin ; export PATH
slouken@0
    42
fi
slouken@0
    43
slouken@0
    44
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
slouken@0
    45
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
slouken@0
    46
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
slouken@0
    47
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
slouken@0
    48
slouken@0
    49
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
slouken@0
    50
slouken@0
    51
# Note: order is significant - the case branches are not exclusive.
slouken@0
    52
slouken@0
    53
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
slouken@0
    54
    alpha:OSF1:*:*)
slouken@0
    55
	if test $UNAME_RELEASE = "V4.0"; then
slouken@0
    56
		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
slouken@0
    57
	fi
slouken@0
    58
	# A Vn.n version is a released version.
slouken@0
    59
	# A Tn.n version is a released field test version.
slouken@0
    60
	# A Xn.n version is an unreleased experimental baselevel.
slouken@0
    61
	# 1.2 uses "1.2" for uname -r.
slouken@0
    62
	cat <<EOF >dummy.s
slouken@0
    63
	.globl main
slouken@0
    64
	.ent main
slouken@0
    65
main:
slouken@0
    66
	.frame \$30,0,\$26,0
slouken@0
    67
	.prologue 0
slouken@0
    68
	.long 0x47e03d80 # implver $0
slouken@0
    69
	lda \$2,259
slouken@0
    70
	.long 0x47e20c21 # amask $2,$1
slouken@0
    71
	srl \$1,8,\$2
slouken@0
    72
	sll \$2,2,\$2
slouken@0
    73
	sll \$0,3,\$0
slouken@0
    74
	addl \$1,\$0,\$0
slouken@0
    75
	addl \$2,\$0,\$0
slouken@0
    76
	ret \$31,(\$26),1
slouken@0
    77
	.end main
slouken@0
    78
EOF
slouken@0
    79
	${CC-cc} dummy.s -o dummy 2>/dev/null
slouken@0
    80
	if test "$?" = 0 ; then
slouken@0
    81
		./dummy
slouken@0
    82
		case "$?" in
slouken@0
    83
			7)
slouken@0
    84
				UNAME_MACHINE="alpha"
slouken@0
    85
				;;
slouken@0
    86
			15)
slouken@0
    87
				UNAME_MACHINE="alphaev5"
slouken@0
    88
				;;
slouken@0
    89
			14)
slouken@0
    90
				UNAME_MACHINE="alphaev56"
slouken@0
    91
				;;
slouken@0
    92
			10)
slouken@0
    93
				UNAME_MACHINE="alphapca56"
slouken@0
    94
				;;
slouken@0
    95
			16)
slouken@0
    96
				UNAME_MACHINE="alphaev6"
slouken@0
    97
				;;
slouken@0
    98
		esac
slouken@0
    99
	fi
slouken@0
   100
	rm -f dummy.s dummy
slouken@0
   101
	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
slouken@0
   102
	exit 0 ;;
slouken@0
   103
    21064:Windows_NT:50:3)
slouken@0
   104
	echo alpha-dec-winnt3.5
slouken@0
   105
	exit 0 ;;
slouken@0
   106
    Amiga*:UNIX_System_V:4.0:*)
slouken@0
   107
	echo m68k-cbm-sysv4
slouken@0
   108
	exit 0;;
slouken@0
   109
    amiga:NetBSD:*:*)
slouken@0
   110
      echo m68k-cbm-netbsd${UNAME_RELEASE}
slouken@0
   111
      exit 0 ;;
slouken@0
   112
    amiga:OpenBSD:*:*)
slouken@0
   113
	echo m68k-unknown-openbsd${UNAME_RELEASE}
slouken@0
   114
	exit 0 ;;
slouken@0
   115
    *:[Aa]miga[Oo][Ss]:*:*)
slouken@0
   116
	echo ${UNAME_MACHINE}-unknown-amigaos
slouken@0
   117
	exit 0 ;;
slouken@0
   118
    arc64:OpenBSD:*:*)
slouken@0
   119
	echo mips64el-unknown-openbsd${UNAME_RELEASE}
slouken@0
   120
	exit 0 ;;
slouken@0
   121
    arc:OpenBSD:*:*)
slouken@0
   122
	echo mipsel-unknown-openbsd${UNAME_RELEASE}
slouken@0
   123
	exit 0 ;;
slouken@0
   124
    hkmips:OpenBSD:*:*)
slouken@0
   125
	echo mips-unknown-openbsd${UNAME_RELEASE}
slouken@0
   126
	exit 0 ;;
slouken@0
   127
    pmax:OpenBSD:*:*)
slouken@0
   128
	echo mipsel-unknown-openbsd${UNAME_RELEASE}
slouken@0
   129
	exit 0 ;;
slouken@0
   130
    sgi:OpenBSD:*:*)
slouken@0
   131
	echo mips-unknown-openbsd${UNAME_RELEASE}
slouken@0
   132
	exit 0 ;;
slouken@0
   133
    wgrisc:OpenBSD:*:*)
slouken@0
   134
	echo mipsel-unknown-openbsd${UNAME_RELEASE}
slouken@0
   135
	exit 0 ;;
slouken@0
   136
    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
slouken@0
   137
	echo arm-acorn-riscix${UNAME_RELEASE}
slouken@0
   138
	exit 0;;
slouken@0
   139
    arm32:NetBSD:*:*)
slouken@0
   140
	echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
slouken@0
   141
	exit 0 ;;
slouken@0
   142
    SR2?01:HI-UX/MPP:*:*)
slouken@0
   143
	echo hppa1.1-hitachi-hiuxmpp
slouken@0
   144
	exit 0;;
slouken@0
   145
    Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*)
slouken@0
   146
	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
slouken@0
   147
	if test "`(/bin/universe) 2>/dev/null`" = att ; then
slouken@0
   148
		echo pyramid-pyramid-sysv3
slouken@0
   149
	else
slouken@0
   150
		echo pyramid-pyramid-bsd
slouken@0
   151
	fi
slouken@0
   152
	exit 0 ;;
slouken@0
   153
    NILE:*:*:dcosx)
slouken@0
   154
	echo pyramid-pyramid-svr4
slouken@0
   155
	exit 0 ;;
slouken@0
   156
    sun4H:SunOS:5.*:*)
slouken@0
   157
	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
slouken@0
   158
	exit 0 ;;
slouken@0
   159
    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
slouken@0
   160
	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
slouken@0
   161
	exit 0 ;;
slouken@0
   162
    i86pc:SunOS:5.*:*)
slouken@0
   163
	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
slouken@0
   164
	exit 0 ;;
slouken@0
   165
    sun4*:SunOS:6*:*)
slouken@0
   166
	# According to config.sub, this is the proper way to canonicalize
slouken@0
   167
	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
slouken@0
   168
	# it's likely to be more like Solaris than SunOS4.
slouken@0
   169
	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
slouken@0
   170
	exit 0 ;;
slouken@0
   171
    sun4*:SunOS:*:*)
slouken@0
   172
	case "`/usr/bin/arch -k`" in
slouken@0
   173
	    Series*|S4*)
slouken@0
   174
		UNAME_RELEASE=`uname -v`
slouken@0
   175
		;;
slouken@0
   176
	esac
slouken@0
   177
	# Japanese Language versions have a version number like `4.1.3-JL'.
slouken@0
   178
	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
slouken@0
   179
	exit 0 ;;
slouken@0
   180
    sun3*:SunOS:*:*)
slouken@0
   181
	echo m68k-sun-sunos${UNAME_RELEASE}
slouken@0
   182
	exit 0 ;;
slouken@0
   183
    sun*:*:4.2BSD:*)
slouken@0
   184
	UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
slouken@0
   185
	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
slouken@0
   186
	case "`/bin/arch`" in
slouken@0
   187
	    sun3)
slouken@0
   188
		echo m68k-sun-sunos${UNAME_RELEASE}
slouken@0
   189
		;;
slouken@0
   190
	    sun4)
slouken@0
   191
		echo sparc-sun-sunos${UNAME_RELEASE}
slouken@0
   192
		;;
slouken@0
   193
	esac
slouken@0
   194
	exit 0 ;;
slouken@0
   195
    aushp:SunOS:*:*)
slouken@0
   196
	echo sparc-auspex-sunos${UNAME_RELEASE}
slouken@0
   197
	exit 0 ;;
slouken@0
   198
    atari*:NetBSD:*:*)
slouken@0
   199
	echo m68k-atari-netbsd${UNAME_RELEASE}
slouken@0
   200
	exit 0 ;;
slouken@0
   201
    atari*:OpenBSD:*:*)
slouken@0
   202
	echo m68k-unknown-openbsd${UNAME_RELEASE}
slouken@0
   203
	exit 0 ;;
slouken@0
   204
    sun3*:NetBSD:*:*)
slouken@0
   205
	echo m68k-sun-netbsd${UNAME_RELEASE}
slouken@0
   206
	exit 0 ;;
slouken@0
   207
    sun3*:OpenBSD:*:*)
slouken@0
   208
	echo m68k-unknown-openbsd${UNAME_RELEASE}
slouken@0
   209
	exit 0 ;;
slouken@0
   210
    mac68k:NetBSD:*:*)
slouken@0
   211
	echo m68k-apple-netbsd${UNAME_RELEASE}
slouken@0
   212
	exit 0 ;;
slouken@0
   213
    mac68k:OpenBSD:*:*)
slouken@0
   214
	echo m68k-unknown-openbsd${UNAME_RELEASE}
slouken@0
   215
	exit 0 ;;
slouken@0
   216
    mvme68k:OpenBSD:*:*)
slouken@0
   217
	echo m68k-unknown-openbsd${UNAME_RELEASE}
slouken@0
   218
	exit 0 ;;
slouken@0
   219
    mvme88k:OpenBSD:*:*)
slouken@0
   220
	echo m88k-unknown-openbsd${UNAME_RELEASE}
slouken@0
   221
	exit 0 ;;
slouken@0
   222
    powerpc:machten:*:*)
slouken@0
   223
	echo powerpc-apple-machten${UNAME_RELEASE}
slouken@0
   224
	exit 0 ;;
slouken@0
   225
    macppc:NetBSD:*:*)
slouken@0
   226
        echo powerpc-apple-netbsd${UNAME_RELEASE}
slouken@0
   227
        exit 0 ;;
slouken@0
   228
    RISC*:Mach:*:*)
slouken@0
   229
	echo mips-dec-mach_bsd4.3
slouken@0
   230
	exit 0 ;;
slouken@0
   231
    RISC*:ULTRIX:*:*)
slouken@0
   232
	echo mips-dec-ultrix${UNAME_RELEASE}
slouken@0
   233
	exit 0 ;;
slouken@0
   234
    VAX*:ULTRIX*:*:*)
slouken@0
   235
	echo vax-dec-ultrix${UNAME_RELEASE}
slouken@0
   236
	exit 0 ;;
slouken@0
   237
    2020:CLIX:*:*)
slouken@0
   238
	echo clipper-intergraph-clix${UNAME_RELEASE}
slouken@0
   239
	exit 0 ;;
slouken@0
   240
    mips:*:*:UMIPS | mips:*:*:RISCos)
slouken@0
   241
	sed 's/^	//' << EOF >dummy.c
slouken@0
   242
	int main (argc, argv) int argc; char **argv; {
slouken@0
   243
	#if defined (host_mips) && defined (MIPSEB)
slouken@0
   244
	#if defined (SYSTYPE_SYSV)
slouken@0
   245
	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
slouken@0
   246
	#endif
slouken@0
   247
	#if defined (SYSTYPE_SVR4)
slouken@0
   248
	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
slouken@0
   249
	#endif
slouken@0
   250
	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
slouken@0
   251
	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
slouken@0
   252
	#endif
slouken@0
   253
	#endif
slouken@0
   254
	  exit (-1);
slouken@0
   255
	}
slouken@0
   256
EOF
slouken@0
   257
	${CC-cc} dummy.c -o dummy \
slouken@0
   258
	  && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
slouken@0
   259
	  && rm dummy.c dummy && exit 0
slouken@0
   260
	rm -f dummy.c dummy
slouken@0
   261
	echo mips-mips-riscos${UNAME_RELEASE}
slouken@0
   262
	exit 0 ;;
slouken@0
   263
    Night_Hawk:Power_UNIX:*:*)
slouken@0
   264
	echo powerpc-harris-powerunix
slouken@0
   265
	exit 0 ;;
slouken@0
   266
    m88k:CX/UX:7*:*)
slouken@0
   267
	echo m88k-harris-cxux7
slouken@0
   268
	exit 0 ;;
slouken@0
   269
    m88k:*:4*:R4*)
slouken@0
   270
	echo m88k-motorola-sysv4
slouken@0
   271
	exit 0 ;;
slouken@0
   272
    m88k:*:3*:R3*)
slouken@0
   273
	echo m88k-motorola-sysv3
slouken@0
   274
	exit 0 ;;
slouken@0
   275
    AViiON:dgux:*:*)
slouken@0
   276
        # DG/UX returns AViiON for all architectures
slouken@0
   277
        UNAME_PROCESSOR=`/usr/bin/uname -p`
slouken@0
   278
        if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
slouken@0
   279
	if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
slouken@0
   280
	     -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
slouken@0
   281
		echo m88k-dg-dgux${UNAME_RELEASE}
slouken@0
   282
	else
slouken@0
   283
		echo m88k-dg-dguxbcs${UNAME_RELEASE}
slouken@0
   284
	fi
slouken@0
   285
        else echo i586-dg-dgux${UNAME_RELEASE}
slouken@0
   286
        fi
slouken@0
   287
 	exit 0 ;;
slouken@0
   288
    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
slouken@0
   289
	echo m88k-dolphin-sysv3
slouken@0
   290
	exit 0 ;;
slouken@0
   291
    M88*:*:R3*:*)
slouken@0
   292
	# Delta 88k system running SVR3
slouken@0
   293
	echo m88k-motorola-sysv3
slouken@0
   294
	exit 0 ;;
slouken@0
   295
    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
slouken@0
   296
	echo m88k-tektronix-sysv3
slouken@0
   297
	exit 0 ;;
slouken@0
   298
    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
slouken@0
   299
	echo m68k-tektronix-bsd
slouken@0
   300
	exit 0 ;;
slouken@0
   301
    *:IRIX*:*:*)
slouken@0
   302
	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
slouken@0
   303
	exit 0 ;;
slouken@0
   304
    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
slouken@0
   305
	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
slouken@0
   306
	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
slouken@0
   307
    i?86:AIX:*:*)
slouken@0
   308
	echo i386-ibm-aix
slouken@0
   309
	exit 0 ;;
slouken@0
   310
    *:AIX:2:3)
slouken@0
   311
	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
slouken@0
   312
		sed 's/^		//' << EOF >dummy.c
slouken@0
   313
		#include <sys/systemcfg.h>
slouken@0
   314
slouken@0
   315
		main()
slouken@0
   316
			{
slouken@0
   317
			if (!__power_pc())
slouken@0
   318
				exit(1);
slouken@0
   319
			puts("powerpc-ibm-aix3.2.5");
slouken@0
   320
			exit(0);
slouken@0
   321
			}
slouken@0
   322
EOF
slouken@0
   323
		${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
slouken@0
   324
		rm -f dummy.c dummy
slouken@0
   325
		echo rs6000-ibm-aix3.2.5
slouken@0
   326
	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
slouken@0
   327
		echo rs6000-ibm-aix3.2.4
slouken@0
   328
	else
slouken@0
   329
		echo rs6000-ibm-aix3.2
slouken@0
   330
	fi
slouken@0
   331
	exit 0 ;;
slouken@0
   332
    *:AIX:*:4)
slouken@0
   333
	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
slouken@0
   334
	if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
slouken@0
   335
		IBM_ARCH=rs6000
slouken@0
   336
	else
slouken@0
   337
		IBM_ARCH=powerpc
slouken@0
   338
	fi
slouken@0
   339
	if [ -x /usr/bin/oslevel ] ; then
slouken@0
   340
		IBM_REV=`/usr/bin/oslevel`
slouken@0
   341
	else
slouken@0
   342
		IBM_REV=4.${UNAME_RELEASE}
slouken@0
   343
	fi
slouken@0
   344
	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
slouken@0
   345
	exit 0 ;;
slouken@0
   346
    *:AIX:*:*)
slouken@0
   347
	echo rs6000-ibm-aix
slouken@0
   348
	exit 0 ;;
slouken@0
   349
    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
slouken@0
   350
	echo romp-ibm-bsd4.4
slouken@0
   351
	exit 0 ;;
slouken@0
   352
    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC NetBSD and
slouken@0
   353
	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
slouken@0
   354
	exit 0 ;;                           # report: romp-ibm BSD 4.3
slouken@0
   355
    *:BOSX:*:*)
slouken@0
   356
	echo rs6000-bull-bosx
slouken@0
   357
	exit 0 ;;
slouken@0
   358
    DPX/2?00:B.O.S.:*:*)
slouken@0
   359
	echo m68k-bull-sysv3
slouken@0
   360
	exit 0 ;;
slouken@0
   361
    9000/[34]??:4.3bsd:1.*:*)
slouken@0
   362
	echo m68k-hp-bsd
slouken@0
   363
	exit 0 ;;
slouken@0
   364
    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
slouken@0
   365
	echo m68k-hp-bsd4.4
slouken@0
   366
	exit 0 ;;
slouken@0
   367
    9000/[34678]??:HP-UX:*:*)
slouken@0
   368
	case "${UNAME_MACHINE}" in
slouken@0
   369
	    9000/31? )            HP_ARCH=m68000 ;;
slouken@0
   370
	    9000/[34]?? )         HP_ARCH=m68k ;;
slouken@0
   371
	    9000/6?? | 9000/7?? | 9000/80[24] | 9000/8?[13679] | 9000/892 )
slouken@0
   372
              sed 's/^              //' << EOF >dummy.c
slouken@0
   373
              #include <stdlib.h>
slouken@0
   374
              #include <unistd.h>
slouken@0
   375
              
slouken@0
   376
              int main ()
slouken@0
   377
              {
slouken@0
   378
              #if defined(_SC_KERNEL_BITS)
slouken@0
   379
                  long bits = sysconf(_SC_KERNEL_BITS);
slouken@0
   380
              #endif 
slouken@0
   381
                  long cpu  = sysconf (_SC_CPU_VERSION);
slouken@0
   382
              
slouken@0
   383
                  switch (cpu) 
slouken@0
   384
              	{
slouken@0
   385
              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
slouken@0
   386
              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
slouken@0
   387
              	case CPU_PA_RISC2_0: 
slouken@0
   388
              #if defined(_SC_KERNEL_BITS)
slouken@0
   389
              	    switch (bits) 
slouken@0
   390
              		{
slouken@0
   391
              		case 64: puts ("hppa2.0w"); break;
slouken@0
   392
              		case 32: puts ("hppa2.0n"); break;
slouken@0
   393
              		default: puts ("hppa2.0"); break;
slouken@0
   394
              		} break;
slouken@0
   395
              #else  /* !defined(_SC_KERNEL_BITS) */
slouken@0
   396
              	    puts ("hppa2.0"); break;
slouken@0
   397
              #endif 
slouken@0
   398
              	default: puts ("hppa1.0"); break;
slouken@0
   399
              	}
slouken@0
   400
                  exit (0);
slouken@0
   401
              }
slouken@0
   402
EOF
slouken@0
   403
	(${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy`
slouken@0
   404
	rm -f dummy.c dummy
slouken@0
   405
	esac
slouken@0
   406
	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
slouken@0
   407
	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
slouken@0
   408
	exit 0 ;;
slouken@0
   409
    3050*:HI-UX:*:*)
slouken@0
   410
	sed 's/^	//' << EOF >dummy.c
slouken@0
   411
	#include <unistd.h>
slouken@0
   412
	int
slouken@0
   413
	main ()
slouken@0
   414
	{
slouken@0
   415
	  long cpu = sysconf (_SC_CPU_VERSION);
slouken@0
   416
	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
slouken@0
   417
	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
slouken@0
   418
	     results, however.  */
slouken@0
   419
	  if (CPU_IS_PA_RISC (cpu))
slouken@0
   420
	    {
slouken@0
   421
	      switch (cpu)
slouken@0
   422
		{
slouken@0
   423
		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
slouken@0
   424
		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
slouken@0
   425
		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
slouken@0
   426
		  default: puts ("hppa-hitachi-hiuxwe2"); break;
slouken@0
   427
		}
slouken@0
   428
	    }
slouken@0
   429
	  else if (CPU_IS_HP_MC68K (cpu))
slouken@0
   430
	    puts ("m68k-hitachi-hiuxwe2");
slouken@0
   431
	  else puts ("unknown-hitachi-hiuxwe2");
slouken@0
   432
	  exit (0);
slouken@0
   433
	}
slouken@0
   434
EOF
slouken@0
   435
	${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
slouken@0
   436
	rm -f dummy.c dummy
slouken@0
   437
	echo unknown-hitachi-hiuxwe2
slouken@0
   438
	exit 0 ;;
slouken@0
   439
    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
slouken@0
   440
	echo hppa1.1-hp-bsd
slouken@0
   441
	exit 0 ;;
slouken@0
   442
    9000/8??:4.3bsd:*:*)
slouken@0
   443
	echo hppa1.0-hp-bsd
slouken@0
   444
	exit 0 ;;
slouken@0
   445
    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
slouken@0
   446
	echo hppa1.1-hp-osf
slouken@0
   447
	exit 0 ;;
slouken@0
   448
    hp8??:OSF1:*:*)
slouken@0
   449
	echo hppa1.0-hp-osf
slouken@0
   450
	exit 0 ;;
slouken@0
   451
    i?86:OSF1:*:*)
slouken@0
   452
	if [ -x /usr/sbin/sysversion ] ; then
slouken@0
   453
	    echo ${UNAME_MACHINE}-unknown-osf1mk
slouken@0
   454
	else
slouken@0
   455
	    echo ${UNAME_MACHINE}-unknown-osf1
slouken@0
   456
	fi
slouken@0
   457
	exit 0 ;;
slouken@0
   458
    parisc*:Lites*:*:*)
slouken@0
   459
	echo hppa1.1-hp-lites
slouken@0
   460
	exit 0 ;;
slouken@0
   461
    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
slouken@0
   462
	echo c1-convex-bsd
slouken@0
   463
        exit 0 ;;
slouken@0
   464
    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
slouken@0
   465
	if getsysinfo -f scalar_acc
slouken@0
   466
	then echo c32-convex-bsd
slouken@0
   467
	else echo c2-convex-bsd
slouken@0
   468
	fi
slouken@0
   469
        exit 0 ;;
slouken@0
   470
    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
slouken@0
   471
	echo c34-convex-bsd
slouken@0
   472
        exit 0 ;;
slouken@0
   473
    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
slouken@0
   474
	echo c38-convex-bsd
slouken@0
   475
        exit 0 ;;
slouken@0
   476
    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
slouken@0
   477
	echo c4-convex-bsd
slouken@0
   478
        exit 0 ;;
slouken@0
   479
    CRAY*X-MP:*:*:*)
slouken@0
   480
	echo xmp-cray-unicos
slouken@0
   481
        exit 0 ;;
slouken@0
   482
    CRAY*Y-MP:*:*:*)
slouken@0
   483
	echo ymp-cray-unicos${UNAME_RELEASE}
slouken@0
   484
	exit 0 ;;
slouken@0
   485
    CRAY*[A-Z]90:*:*:*)
slouken@0
   486
	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
slouken@0
   487
	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
slouken@0
   488
	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
slouken@0
   489
	exit 0 ;;
slouken@0
   490
    CRAY*TS:*:*:*)
slouken@0
   491
	echo t90-cray-unicos${UNAME_RELEASE}
slouken@0
   492
	exit 0 ;;
slouken@0
   493
    CRAY-2:*:*:*)
slouken@0
   494
	echo cray2-cray-unicos
slouken@0
   495
        exit 0 ;;
slouken@0
   496
    F300:UNIX_System_V:*:*)
slouken@0
   497
        FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
slouken@0
   498
        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
slouken@0
   499
        echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
slouken@0
   500
        exit 0 ;;
slouken@0
   501
    F301:UNIX_System_V:*:*)
slouken@0
   502
       echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
slouken@0
   503
       exit 0 ;;
slouken@0
   504
    hp3[0-9][05]:NetBSD:*:*)
slouken@0
   505
	echo m68k-hp-netbsd${UNAME_RELEASE}
slouken@0
   506
	exit 0 ;;
slouken@0
   507
    hp300:OpenBSD:*:*)
slouken@0
   508
	echo m68k-unknown-openbsd${UNAME_RELEASE}
slouken@0
   509
	exit 0 ;;
slouken@0
   510
    sparc*:BSD/OS:*:*)
slouken@0
   511
	echo sparc-unknown-bsdi${UNAME_RELEASE}
slouken@0
   512
	exit 0 ;;
slouken@0
   513
    i?86:BSD/386:*:* | *:BSD/OS:*:*)
slouken@0
   514
	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
slouken@0
   515
	exit 0 ;;
slouken@0
   516
    *:FreeBSD:*:*)
slouken@0
   517
	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
slouken@0
   518
	exit 0 ;;
slouken@0
   519
    *:NetBSD:*:*)
slouken@0
   520
	echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
slouken@0
   521
	exit 0 ;;
slouken@0
   522
    *:OpenBSD:*:*)
slouken@0
   523
	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
slouken@0
   524
	exit 0 ;;
slouken@0
   525
    i*:CYGWIN*:*)
slouken@0
   526
	echo ${UNAME_MACHINE}-pc-cygwin32
slouken@0
   527
	exit 0 ;;
slouken@0
   528
    i*:MINGW*:*)
slouken@0
   529
	echo ${UNAME_MACHINE}-pc-mingw32
slouken@0
   530
	exit 0 ;;
slouken@0
   531
    p*:CYGWIN*:*)
slouken@0
   532
	echo powerpcle-unknown-cygwin32
slouken@0
   533
	exit 0 ;;
slouken@0
   534
    prep*:SunOS:5.*:*)
slouken@0
   535
	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
slouken@0
   536
	exit 0 ;;
slouken@0
   537
    *:GNU:*:*)
slouken@0
   538
	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
slouken@0
   539
	exit 0 ;;
slouken@0
   540
    *:Linux:*:*)
slouken@0
   541
	# uname on the ARM produces all sorts of strangeness, and we need to
slouken@0
   542
	# filter it out.
slouken@0
   543
	case "$UNAME_MACHINE" in
slouken@0
   544
	  arm* | sa110*)	      UNAME_MACHINE="arm" ;;
slouken@0
   545
	esac
slouken@0
   546
slouken@0
   547
	# The BFD linker knows what the default object file format is, so
slouken@0
   548
	# first see if it will tell us.
slouken@0
   549
	ld_help_string=`ld --help 2>&1`
slouken@0
   550
	ld_supported_emulations=`echo $ld_help_string \
slouken@0
   551
			 | sed -ne '/supported emulations:/!d
slouken@0
   552
				    s/[ 	][ 	]*/ /g
slouken@0
   553
				    s/.*supported emulations: *//
slouken@0
   554
				    s/ .*//
slouken@0
   555
				    p'`
slouken@0
   556
        case "$ld_supported_emulations" in
slouken@0
   557
	  i?86linux)  echo "${UNAME_MACHINE}-pc-linux-gnuaout"      ; exit 0 ;;
slouken@0
   558
	  i?86coff)   echo "${UNAME_MACHINE}-pc-linux-gnucoff"      ; exit 0 ;;
slouken@0
   559
	  sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
slouken@0
   560
	  armlinux)   echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
slouken@0
   561
	  m68klinux)  echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
slouken@0
   562
	  elf32ppc)   echo "powerpc-unknown-linux-gnu"              ; exit 0 ;;
slouken@0
   563
	esac
slouken@0
   564
slouken@0
   565
	if test "${UNAME_MACHINE}" = "alpha" ; then
slouken@0
   566
		sed 's/^	//'  <<EOF >dummy.s
slouken@0
   567
		.globl main
slouken@0
   568
		.ent main
slouken@0
   569
	main:
slouken@0
   570
		.frame \$30,0,\$26,0
slouken@0
   571
		.prologue 0
slouken@0
   572
		.long 0x47e03d80 # implver $0
slouken@0
   573
		lda \$2,259
slouken@0
   574
		.long 0x47e20c21 # amask $2,$1
slouken@0
   575
		srl \$1,8,\$2
slouken@0
   576
		sll \$2,2,\$2
slouken@0
   577
		sll \$0,3,\$0
slouken@0
   578
		addl \$1,\$0,\$0
slouken@0
   579
		addl \$2,\$0,\$0
slouken@0
   580
		ret \$31,(\$26),1
slouken@0
   581
		.end main
slouken@0
   582
EOF
slouken@0
   583
		LIBC=""
slouken@0
   584
		${CC-cc} dummy.s -o dummy 2>/dev/null
slouken@0
   585
		if test "$?" = 0 ; then
slouken@0
   586
			./dummy
slouken@0
   587
			case "$?" in
slouken@0
   588
			7)
slouken@0
   589
				UNAME_MACHINE="alpha"
slouken@0
   590
				;;
slouken@0
   591
			15)
slouken@0
   592
				UNAME_MACHINE="alphaev5"
slouken@0
   593
				;;
slouken@0
   594
			14)
slouken@0
   595
				UNAME_MACHINE="alphaev56"
slouken@0
   596
				;;
slouken@0
   597
			10)
slouken@0
   598
				UNAME_MACHINE="alphapca56"
slouken@0
   599
				;;
slouken@0
   600
			16)
slouken@0
   601
				UNAME_MACHINE="alphaev6"
slouken@0
   602
				;;
slouken@0
   603
			esac	
slouken@0
   604
slouken@0
   605
			objdump --private-headers dummy | \
slouken@0
   606
			  grep ld.so.1 > /dev/null
slouken@0
   607
			if test "$?" = 0 ; then
slouken@0
   608
				LIBC="libc1"
slouken@0
   609
			fi
slouken@0
   610
		fi	
slouken@0
   611
		rm -f dummy.s dummy
slouken@0
   612
		echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
slouken@0
   613
	elif test "${UNAME_MACHINE}" = "mips" ; then
slouken@0
   614
	  cat >dummy.c <<EOF
slouken@0
   615
main(argc, argv)
slouken@0
   616
     int argc;
slouken@0
   617
     char *argv[];
slouken@0
   618
{
slouken@0
   619
#ifdef __MIPSEB__
slouken@0
   620
  printf ("%s-unknown-linux-gnu\n", argv[1]);
slouken@0
   621
#endif
slouken@0
   622
#ifdef __MIPSEL__
slouken@0
   623
  printf ("%sel-unknown-linux-gnu\n", argv[1]);
slouken@0
   624
#endif
slouken@0
   625
  return 0;
slouken@0
   626
}
slouken@0
   627
EOF
slouken@0
   628
	  ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
slouken@0
   629
	  rm -f dummy.c dummy
slouken@0
   630
	else
slouken@0
   631
	  # Either a pre-BFD a.out linker (linux-gnuoldld)
slouken@0
   632
	  # or one that does not give us useful --help.
slouken@0
   633
	  # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
slouken@0
   634
	  # If ld does not provide *any* "supported emulations:"
slouken@0
   635
	  # that means it is gnuoldld.
slouken@0
   636
	  echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
slouken@0
   637
	  test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
slouken@0
   638
slouken@0
   639
	  case "${UNAME_MACHINE}" in
slouken@0
   640
	  i?86)
slouken@0
   641
	    VENDOR=pc;
slouken@0
   642
	    ;;
slouken@0
   643
	  *)
slouken@0
   644
	    VENDOR=unknown;
slouken@0
   645
	    ;;
slouken@0
   646
	  esac
slouken@0
   647
	  # Determine whether the default compiler is a.out or elf
slouken@0
   648
	  cat >dummy.c <<EOF
slouken@0
   649
#include <features.h>
slouken@0
   650
main(argc, argv)
slouken@0
   651
     int argc;
slouken@0
   652
     char *argv[];
slouken@0
   653
{
slouken@0
   654
#ifdef __ELF__
slouken@0
   655
# ifdef __GLIBC__
slouken@0
   656
#  if __GLIBC__ >= 2
slouken@0
   657
    printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
slouken@0
   658
#  else
slouken@0
   659
    printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
slouken@0
   660
#  endif
slouken@0
   661
# else
slouken@0
   662
   printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
slouken@0
   663
# endif
slouken@0
   664
#else
slouken@0
   665
  printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
slouken@0
   666
#endif
slouken@0
   667
  return 0;
slouken@0
   668
}
slouken@0
   669
EOF
slouken@0
   670
	  ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
slouken@0
   671
	  rm -f dummy.c dummy
slouken@0
   672
	fi ;;
slouken@0
   673
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
slouken@0
   674
# are messed up and put the nodename in both sysname and nodename.
slouken@0
   675
    i?86:DYNIX/ptx:4*:*)
slouken@0
   676
	echo i386-sequent-sysv4
slouken@0
   677
	exit 0 ;;
slouken@0
   678
    i?86:UNIX_SV:4.2MP:2.*)
slouken@0
   679
        # Unixware is an offshoot of SVR4, but it has its own version
slouken@0
   680
        # number series starting with 2...
slouken@0
   681
        # I am not positive that other SVR4 systems won't match this,
slouken@0
   682
	# I just have to hope.  -- rms.
slouken@0
   683
        # Use sysv4.2uw... so that sysv4* matches it.
slouken@0
   684
	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
slouken@0
   685
	exit 0 ;;
slouken@0
   686
    i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
slouken@0
   687
	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
slouken@0
   688
		echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
slouken@0
   689
	else
slouken@0
   690
		echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
slouken@0
   691
	fi
slouken@0
   692
	exit 0 ;;
slouken@0
   693
    i?86:*:3.2:*)
slouken@0
   694
	if test -f /usr/options/cb.name; then
slouken@0
   695
		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
slouken@0
   696
		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
slouken@0
   697
	elif /bin/uname -X 2>/dev/null >/dev/null ; then
slouken@0
   698
		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
slouken@0
   699
		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
slouken@0
   700
		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
slouken@0
   701
			&& UNAME_MACHINE=i586
slouken@0
   702
		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
slouken@0
   703
	else
slouken@0
   704
		echo ${UNAME_MACHINE}-pc-sysv32
slouken@0
   705
	fi
slouken@0
   706
	exit 0 ;;
slouken@0
   707
    i?86:UnixWare:*:*)
slouken@0
   708
	if /bin/uname -X 2>/dev/null >/dev/null ; then
slouken@0
   709
	  (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
slouken@0
   710
	    && UNAME_MACHINE=i586
slouken@0
   711
	fi
slouken@0
   712
	echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION}
slouken@0
   713
	exit 0 ;;
slouken@0
   714
    pc:*:*:*)
slouken@0
   715
        # uname -m prints for DJGPP always 'pc', but it prints nothing about
slouken@0
   716
        # the processor, so we play safe by assuming i386.
slouken@0
   717
	echo i386-pc-msdosdjgpp
slouken@0
   718
        exit 0 ;;
slouken@0
   719
    Intel:Mach:3*:*)
slouken@0
   720
	echo i386-pc-mach3
slouken@0
   721
	exit 0 ;;
slouken@0
   722
    paragon:*:*:*)
slouken@0
   723
	echo i860-intel-osf1
slouken@0
   724
	exit 0 ;;
slouken@0
   725
    i860:*:4.*:*) # i860-SVR4
slouken@0
   726
	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
slouken@0
   727
	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
slouken@0
   728
	else # Add other i860-SVR4 vendors below as they are discovered.
slouken@0
   729
	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
slouken@0
   730
	fi
slouken@0
   731
	exit 0 ;;
slouken@0
   732
    mini*:CTIX:SYS*5:*)
slouken@0
   733
	# "miniframe"
slouken@0
   734
	echo m68010-convergent-sysv
slouken@0
   735
	exit 0 ;;
slouken@0
   736
    M68*:*:R3V[567]*:*)
slouken@0
   737
	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
slouken@0
   738
    3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
slouken@0
   739
	OS_REL=''
slouken@0
   740
	test -r /etc/.relid \
slouken@0
   741
	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
slouken@0
   742
	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
slouken@0
   743
	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
slouken@0
   744
	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
slouken@0
   745
	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
slouken@0
   746
    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
slouken@0
   747
        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
slouken@0
   748
          && echo i486-ncr-sysv4 && exit 0 ;;
slouken@0
   749
    m68*:LynxOS:2.*:*)
slouken@0
   750
	echo m68k-unknown-lynxos${UNAME_RELEASE}
slouken@0
   751
	exit 0 ;;
slouken@0
   752
    mc68030:UNIX_System_V:4.*:*)
slouken@0
   753
	echo m68k-atari-sysv4
slouken@0
   754
	exit 0 ;;
slouken@0
   755
    i?86:LynxOS:2.*:*)
slouken@0
   756
	echo i386-unknown-lynxos${UNAME_RELEASE}
slouken@0
   757
	exit 0 ;;
slouken@0
   758
    TSUNAMI:LynxOS:2.*:*)
slouken@0
   759
	echo sparc-unknown-lynxos${UNAME_RELEASE}
slouken@0
   760
	exit 0 ;;
slouken@0
   761
    rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
slouken@0
   762
	echo rs6000-unknown-lynxos${UNAME_RELEASE}
slouken@0
   763
	exit 0 ;;
slouken@0
   764
    SM[BE]S:UNIX_SV:*:*)
slouken@0
   765
	echo mips-dde-sysv${UNAME_RELEASE}
slouken@0
   766
	exit 0 ;;
slouken@0
   767
    RM*:SINIX-*:*:*)
slouken@0
   768
	echo mips-sni-sysv4
slouken@0
   769
	exit 0 ;;
slouken@0
   770
    *:SINIX-*:*:*)
slouken@0
   771
	if uname -p 2>/dev/null >/dev/null ; then
slouken@0
   772
		UNAME_MACHINE=`(uname -p) 2>/dev/null`
slouken@0
   773
		echo ${UNAME_MACHINE}-sni-sysv4
slouken@0
   774
	else
slouken@0
   775
		echo ns32k-sni-sysv
slouken@0
   776
	fi
slouken@0
   777
	exit 0 ;;
slouken@0
   778
    PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
slouken@0
   779
                           # says <Richard.M.Bartel@ccMail.Census.GOV>
slouken@0
   780
        echo i586-unisys-sysv4
slouken@0
   781
        exit 0 ;;
slouken@0
   782
    *:UNIX_System_V:4*:FTX*)
slouken@0
   783
	# From Gerald Hewes <hewes@openmarket.com>.
slouken@0
   784
	# How about differentiating between stratus architectures? -djm
slouken@0
   785
	echo hppa1.1-stratus-sysv4
slouken@0
   786
	exit 0 ;;
slouken@0
   787
    *:*:*:FTX*)
slouken@0
   788
	# From seanf@swdc.stratus.com.
slouken@0
   789
	echo i860-stratus-sysv4
slouken@0
   790
	exit 0 ;;
slouken@0
   791
    mc68*:A/UX:*:*)
slouken@0
   792
	echo m68k-apple-aux${UNAME_RELEASE}
slouken@0
   793
	exit 0 ;;
slouken@0
   794
    news*:NEWS-OS:*:6*)
slouken@0
   795
	echo mips-sony-newsos6
slouken@0
   796
	exit 0 ;;
slouken@0
   797
    R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*)
slouken@0
   798
	if [ -d /usr/nec ]; then
slouken@0
   799
	        echo mips-nec-sysv${UNAME_RELEASE}
slouken@0
   800
	else
slouken@0
   801
	        echo mips-unknown-sysv${UNAME_RELEASE}
slouken@0
   802
	fi
slouken@0
   803
        exit 0 ;;
slouken@0
   804
    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
slouken@0
   805
	echo powerpc-be-beos
slouken@0
   806
	exit 0 ;;
slouken@0
   807
    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
slouken@0
   808
	echo powerpc-apple-beos
slouken@0
   809
	exit 0 ;;
slouken@0
   810
    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
slouken@0
   811
	echo i586-pc-beos
slouken@0
   812
	exit 0 ;;
slouken@0
   813
esac
slouken@0
   814
slouken@0
   815
#echo '(No uname command or uname output not recognized.)' 1>&2
slouken@0
   816
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
slouken@0
   817
slouken@0
   818
cat >dummy.c <<EOF
slouken@0
   819
#ifdef _SEQUENT_
slouken@0
   820
# include <sys/types.h>
slouken@0
   821
# include <sys/utsname.h>
slouken@0
   822
#endif
slouken@0
   823
main ()
slouken@0
   824
{
slouken@0
   825
#if defined (sony)
slouken@0
   826
#if defined (MIPSEB)
slouken@0
   827
  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
slouken@0
   828
     I don't know....  */
slouken@0
   829
  printf ("mips-sony-bsd\n"); exit (0);
slouken@0
   830
#else
slouken@0
   831
#include <sys/param.h>
slouken@0
   832
  printf ("m68k-sony-newsos%s\n",
slouken@0
   833
#ifdef NEWSOS4
slouken@0
   834
          "4"
slouken@0
   835
#else
slouken@0
   836
	  ""
slouken@0
   837
#endif
slouken@0
   838
         ); exit (0);
slouken@0
   839
#endif
slouken@0
   840
#endif
slouken@0
   841
slouken@0
   842
#if defined (__arm) && defined (__acorn) && defined (__unix)
slouken@0
   843
  printf ("arm-acorn-riscix"); exit (0);
slouken@0
   844
#endif
slouken@0
   845
slouken@0
   846
#if defined (hp300) && !defined (hpux)
slouken@0
   847
  printf ("m68k-hp-bsd\n"); exit (0);
slouken@0
   848
#endif
slouken@0
   849
slouken@0
   850
#if defined (NeXT)
slouken@0
   851
#if !defined (__ARCHITECTURE__)
slouken@0
   852
#define __ARCHITECTURE__ "m68k"
slouken@0
   853
#endif
slouken@0
   854
  int version;
slouken@0
   855
  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
slouken@0
   856
  printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
slouken@0
   857
  exit (0);
slouken@0
   858
#endif
slouken@0
   859
slouken@0
   860
#if defined (MULTIMAX) || defined (n16)
slouken@0
   861
#if defined (UMAXV)
slouken@0
   862
  printf ("ns32k-encore-sysv\n"); exit (0);
slouken@0
   863
#else
slouken@0
   864
#if defined (CMU)
slouken@0
   865
  printf ("ns32k-encore-mach\n"); exit (0);
slouken@0
   866
#else
slouken@0
   867
  printf ("ns32k-encore-bsd\n"); exit (0);
slouken@0
   868
#endif
slouken@0
   869
#endif
slouken@0
   870
#endif
slouken@0
   871
slouken@0
   872
#if defined (__386BSD__)
slouken@0
   873
  printf ("i386-pc-bsd\n"); exit (0);
slouken@0
   874
#endif
slouken@0
   875
slouken@0
   876
#if defined (sequent)
slouken@0
   877
#if defined (i386)
slouken@0
   878
  printf ("i386-sequent-dynix\n"); exit (0);
slouken@0
   879
#endif
slouken@0
   880
#if defined (ns32000)
slouken@0
   881
  printf ("ns32k-sequent-dynix\n"); exit (0);
slouken@0
   882
#endif
slouken@0
   883
#endif
slouken@0
   884
slouken@0
   885
#if defined (_SEQUENT_)
slouken@0
   886
    struct utsname un;
slouken@0
   887
slouken@0
   888
    uname(&un);
slouken@0
   889
slouken@0
   890
    if (strncmp(un.version, "V2", 2) == 0) {
slouken@0
   891
	printf ("i386-sequent-ptx2\n"); exit (0);
slouken@0
   892
    }
slouken@0
   893
    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
slouken@0
   894
	printf ("i386-sequent-ptx1\n"); exit (0);
slouken@0
   895
    }
slouken@0
   896
    printf ("i386-sequent-ptx\n"); exit (0);
slouken@0
   897
slouken@0
   898
#endif
slouken@0
   899
slouken@0
   900
#if defined (vax)
slouken@0
   901
#if !defined (ultrix)
slouken@0
   902
  printf ("vax-dec-bsd\n"); exit (0);
slouken@0
   903
#else
slouken@0
   904
  printf ("vax-dec-ultrix\n"); exit (0);
slouken@0
   905
#endif
slouken@0
   906
#endif
slouken@0
   907
slouken@0
   908
#if defined (alliant) && defined (i860)
slouken@0
   909
  printf ("i860-alliant-bsd\n"); exit (0);
slouken@0
   910
#endif
slouken@0
   911
slouken@0
   912
  exit (1);
slouken@0
   913
}
slouken@0
   914
EOF
slouken@0
   915
slouken@0
   916
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
slouken@0
   917
rm -f dummy.c dummy
slouken@0
   918
slouken@0
   919
# Apollos put the system type in the environment.
slouken@0
   920
slouken@0
   921
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
slouken@0
   922
slouken@0
   923
# Convex versions that predate uname can use getsysinfo(1)
slouken@0
   924
slouken@0
   925
if [ -x /usr/convex/getsysinfo ]
slouken@0
   926
then
slouken@0
   927
    case `getsysinfo -f cpu_type` in
slouken@0
   928
    c1*)
slouken@0
   929
	echo c1-convex-bsd
slouken@0
   930
	exit 0 ;;
slouken@0
   931
    c2*)
slouken@0
   932
	if getsysinfo -f scalar_acc
slouken@0
   933
	then echo c32-convex-bsd
slouken@0
   934
	else echo c2-convex-bsd
slouken@0
   935
	fi
slouken@0
   936
	exit 0 ;;
slouken@0
   937
    c34*)
slouken@0
   938
	echo c34-convex-bsd
slouken@0
   939
	exit 0 ;;
slouken@0
   940
    c38*)
slouken@0
   941
	echo c38-convex-bsd
slouken@0
   942
	exit 0 ;;
slouken@0
   943
    c4*)
slouken@0
   944
	echo c4-convex-bsd
slouken@0
   945
	exit 0 ;;
slouken@0
   946
    esac
slouken@0
   947
fi
slouken@0
   948
slouken@0
   949
#echo '(Unable to guess system type)' 1>&2
slouken@0
   950
slouken@0
   951
exit 1