config.guess 47.3 KB
Newer Older
1
2
#! /bin/sh
# Attempt to guess a canonical system name.
3
#   Copyright 1992-2020 Free Software Foundation, Inc.
4

5
timestamp='2020-01-01'
6
7
8

# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
11
12
13
14
15
16
17
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
18
# along with this program; if not, see <https://www.gnu.org/licenses/>.
19
20
21
22
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
23
24
25
# the same distribution terms that you use for the rest of that
# program.  This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
26
#
27
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
28
#
29
# You can get the latest version of this script from:
30
# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
31
#
32
# Please send patches to <config-patches@gnu.org>.
33

34
35
36
37
38
39
40
41

me=`echo "$0" | sed -e 's,.*/,,'`

usage="\
Usage: $0 [OPTION]

Output the configuration name of the system \`$me' is run on.

42
Options:
43
44
45
46
47
48
49
50
51
52
  -h, --help         print this help, then exit
  -t, --time-stamp   print date of last modification, then exit
  -v, --version      print version number, then exit

Report bugs and patches to <config-patches@gnu.org>."

version="\
GNU config.guess ($timestamp)

Originally written by Per Bothner.
53
Copyright 1992-2020 Free Software Foundation, Inc.
54
55
56
57
58
59
60
61
62
63
64

This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."

help="
Try \`$me --help' for more information."

# Parse command line
while test $# -gt 0 ; do
  case $1 in
    --time-stamp | --time* | -t )
65
       echo "$timestamp" ; exit ;;
66
    --version | -v )
67
       echo "$version" ; exit ;;
68
    --help | --h* | -h )
69
       echo "$usage"; exit ;;
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
    -- )     # Stop option processing
       shift; break ;;
    - )	# Use stdin as input.
       break ;;
    -* )
       echo "$me: invalid option $1$help" >&2
       exit 1 ;;
    * )
       break ;;
  esac
done

if test $# != 0; then
  echo "$me: too many arguments$help" >&2
  exit 1
fi

# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.

# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.

# Portable tmp directory creation inspired by the Autoconf team.

97
98
99
100
101
tmp=
# shellcheck disable=SC2172
trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15

set_cc_for_build() {
102
103
    # prevent multiple calls if $tmp is already set
    test "$tmp" && return 0
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
    : "${TMPDIR=/tmp}"
    # shellcheck disable=SC2039
    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
    dummy=$tmp/dummy
    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
	,,)    echo "int x;" > "$dummy.c"
	       for driver in cc gcc c89 c99 ; do
		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
		       CC_FOR_BUILD="$driver"
		       break
		   fi
	       done
	       if test x"$CC_FOR_BUILD" = x ; then
		   CC_FOR_BUILD=no_compiler_found
	       fi
	       ;;
	,,*)   CC_FOR_BUILD=$CC ;;
	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
    esac
}
127
128
129

# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
130
if test -f /.attbin/uname ; then
131
132
133
134
135
136
137
138
	PATH=$PATH:/.attbin ; export PATH
fi

UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown

139
case "$UNAME_SYSTEM" in
140
141
142
143
144
Linux|GNU|GNU/*)
	# If the system lacks a compiler, then just pick glibc.
	# We could probably try harder.
	LIBC=gnu

145
146
	set_cc_for_build
	cat <<-EOF > "$dummy.c"
147
148
149
150
151
152
153
154
155
	#include <features.h>
	#if defined(__UCLIBC__)
	LIBC=uclibc
	#elif defined(__dietlibc__)
	LIBC=dietlibc
	#else
	LIBC=gnu
	#endif
	EOF
156
157
158
159
160
161
162
163
	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"

	# If ldd exists, use it to detect musl libc.
	if command -v ldd >/dev/null && \
		ldd --version 2>&1 | grep -q ^musl
	then
	    LIBC=musl
	fi
164
165
166
	;;
esac

167
168
# Note: order is significant - the case branches are not exclusive.

169
case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
170
171
    *:NetBSD:*:*)
	# NetBSD (nbsd) targets should (where applicable) match one or
172
	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
173
174
175
176
177
178
179
180
181
	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
	# switched to ELF, *-*-netbsd* would select the old
	# object file format.  This provides both forward
	# compatibility and a consistent mechanism for selecting the
	# object file format.
	#
	# Note: NetBSD doesn't particularly care about the vendor
	# portion of the name.  We always set it to "unknown".
	sysctl="sysctl -n hw.machine_arch"
182
183
184
185
186
	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
	    "/sbin/$sysctl" 2>/dev/null || \
	    "/usr/sbin/$sysctl" 2>/dev/null || \
	    echo unknown)`
	case "$UNAME_MACHINE_ARCH" in
187
188
189
190
	    armeb) machine=armeb-unknown ;;
	    arm*) machine=arm-unknown ;;
	    sh3el) machine=shl-unknown ;;
	    sh3eb) machine=sh-unknown ;;
191
	    sh5el) machine=sh5le-unknown ;;
192
193
194
195
196
197
	    earmv*)
		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
		machine="${arch}${endian}"-unknown
		;;
	    *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
198
199
	esac
	# The Operating System including object format, if it has switched
200
201
202
203
204
	# to ELF recently (or will in the future) and ABI.
	case "$UNAME_MACHINE_ARCH" in
	    earm*)
		os=netbsdelf
		;;
205
	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
206
		set_cc_for_build
207
		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
208
			| grep -q __ELF__
209
210
211
212
213
214
215
216
217
		then
		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
		    # Return netbsd for either.  FIX?
		    os=netbsd
		else
		    os=netbsdelf
		fi
		;;
	    *)
218
		os=netbsd
219
220
		;;
	esac
221
222
223
224
225
226
227
	# Determine ABI tags.
	case "$UNAME_MACHINE_ARCH" in
	    earm*)
		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
		;;
	esac
228
229
230
231
232
	# The OS release
	# Debian GNU/NetBSD machines have a different userland, and
	# thus, need a distinct triplet. However, they do not need
	# kernel version information, so it can be replaced with a
	# suitable tag, in the style of linux-gnu.
233
	case "$UNAME_VERSION" in
234
235
236
237
	    Debian*)
		release='-gnu'
		;;
	    *)
238
		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
239
240
241
242
243
		;;
	esac
	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
	# contains redundant information, the shorter form:
	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
244
	echo "$machine-${os}${release}${abi-}"
245
	exit ;;
246
247
    *:Bitrig:*:*)
	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
248
	echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
249
	exit ;;
250
    *:OpenBSD:*:*)
251
	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
252
253
254
255
256
257
258
259
	echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
	exit ;;
    *:LibertyBSD:*:*)
	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
	echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
	exit ;;
    *:MidnightBSD:*:*)
	echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
260
261
	exit ;;
    *:ekkoBSD:*:*)
262
	echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
263
264
	exit ;;
    *:SolidBSD:*:*)
265
266
267
268
	echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
	exit ;;
    *:OS108:*:*)
	echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
269
270
	exit ;;
    macppc:MirBSD:*:*)
271
	echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
272
273
	exit ;;
    *:MirBSD:*:*)
274
275
276
277
278
	echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
	exit ;;
    *:Sortix:*:*)
	echo "$UNAME_MACHINE"-unknown-sortix
	exit ;;
279
280
281
    *:Twizzler:*:*)
	echo "$UNAME_MACHINE"-unknown-twizzler
	exit ;;
282
283
    *:Redox:*:*)
	echo "$UNAME_MACHINE"-unknown-redox
284
	exit ;;
285
    mips:OSF1:*.*)
286
287
	echo mips-dec-osf1
	exit ;;
288
    alpha:OSF1:*:*)
289
290
	case $UNAME_RELEASE in
	*4.0)
291
		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
292
293
294
295
296
		;;
	*5.*)
		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
		;;
	esac
297
298
299
300
301
302
303
	# According to Compaq, /usr/sbin/psrinfo has been available on
	# OSF/1 and Tru64 systems produced since 1995.  I hope that
	# covers most systems running today.  This code pipes the CPU
	# types through head -n 1, so we only detect the type of CPU 0.
	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
	case "$ALPHA_CPU_TYPE" in
	    "EV4 (21064)")
304
		UNAME_MACHINE=alpha ;;
305
	    "EV4.5 (21064)")
306
		UNAME_MACHINE=alpha ;;
307
	    "LCA4 (21066/21068)")
308
		UNAME_MACHINE=alpha ;;
309
	    "EV5 (21164)")
310
		UNAME_MACHINE=alphaev5 ;;
311
	    "EV5.6 (21164A)")
312
		UNAME_MACHINE=alphaev56 ;;
313
	    "EV5.6 (21164PC)")
314
		UNAME_MACHINE=alphapca56 ;;
315
	    "EV5.7 (21164PC)")
316
		UNAME_MACHINE=alphapca57 ;;
317
	    "EV6 (21264)")
318
		UNAME_MACHINE=alphaev6 ;;
319
	    "EV6.7 (21264A)")
320
		UNAME_MACHINE=alphaev67 ;;
321
	    "EV6.8CB (21264C)")
322
		UNAME_MACHINE=alphaev68 ;;
323
	    "EV6.8AL (21264B)")
324
		UNAME_MACHINE=alphaev68 ;;
325
	    "EV6.8CX (21264D)")
326
		UNAME_MACHINE=alphaev68 ;;
327
	    "EV6.9A (21264/EV69A)")
328
		UNAME_MACHINE=alphaev69 ;;
329
	    "EV7 (21364)")
330
		UNAME_MACHINE=alphaev7 ;;
331
	    "EV7.9 (21364A)")
332
		UNAME_MACHINE=alphaev79 ;;
333
	esac
334
	# A Pn.n version is a patched version.
335
336
337
338
	# A Vn.n version is a released version.
	# A Tn.n version is a released field test version.
	# A Xn.n version is an unreleased experimental baselevel.
	# 1.2 uses "1.2" for uname -r.
339
	echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
340
341
342
343
	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
	exitcode=$?
	trap '' 0
	exit $exitcode ;;
344
345
    Amiga*:UNIX_System_V:4.0:*)
	echo m68k-unknown-sysv4
346
	exit ;;
347
    *:[Aa]miga[Oo][Ss]:*:*)
348
	echo "$UNAME_MACHINE"-unknown-amigaos
349
	exit ;;
350
    *:[Mm]orph[Oo][Ss]:*:*)
351
	echo "$UNAME_MACHINE"-unknown-morphos
352
	exit ;;
353
354
    *:OS/390:*:*)
	echo i370-ibm-openedition
355
356
357
358
	exit ;;
    *:z/VM:*:*)
	echo s390-ibm-zvmoe
	exit ;;
359
    *:OS400:*:*)
360
361
	echo powerpc-ibm-os400
	exit ;;
362
    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
363
	echo arm-acorn-riscix"$UNAME_RELEASE"
364
	exit ;;
365
    arm*:riscos:*:*|arm*:RISCOS:*:*)
366
367
	echo arm-unknown-riscos
	exit ;;
368
369
    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
	echo hppa1.1-hitachi-hiuxmpp
370
	exit ;;
371
372
373
374
375
376
377
    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
	if test "`(/bin/universe) 2>/dev/null`" = att ; then
		echo pyramid-pyramid-sysv3
	else
		echo pyramid-pyramid-bsd
	fi
378
	exit ;;
379
380
    NILE*:*:*:dcosx)
	echo pyramid-pyramid-svr4
381
	exit ;;
382
383
    DRS?6000:unix:4.0:6*)
	echo sparc-icl-nx6
384
385
	exit ;;
    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
386
	case `/usr/bin/uname -p` in
387
	    sparc) echo sparc-icl-nx7; exit ;;
388
	esac ;;
389
    s390x:SunOS:*:*)
390
	echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
391
	exit ;;
392
    sun4H:SunOS:5.*:*)
393
	echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
394
	exit ;;
395
    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
396
	echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
397
398
	exit ;;
    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
399
	echo i386-pc-auroraux"$UNAME_RELEASE"
400
401
	exit ;;
    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
402
403
	set_cc_for_build
	SUN_ARCH=i386
404
405
406
	# If there is a compiler, see if it is configured for 64-bit objects.
	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
	# This test works for both compilers.
407
	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
408
	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
409
		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
410
411
		grep IS_64BIT_ARCH >/dev/null
	    then
412
		SUN_ARCH=x86_64
413
414
	    fi
	fi
415
	echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
416
	exit ;;
417
418
419
420
    sun4*:SunOS:6*:*)
	# According to config.sub, this is the proper way to canonicalize
	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
	# it's likely to be more like Solaris than SunOS4.
421
	echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
422
	exit ;;
423
424
425
426
427
428
429
    sun4*:SunOS:*:*)
	case "`/usr/bin/arch -k`" in
	    Series*|S4*)
		UNAME_RELEASE=`uname -v`
		;;
	esac
	# Japanese Language versions have a version number like `4.1.3-JL'.
430
	echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
431
	exit ;;
432
    sun3*:SunOS:*:*)
433
	echo m68k-sun-sunos"$UNAME_RELEASE"
434
	exit ;;
435
436
    sun*:*:4.2BSD:*)
	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
437
	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
438
439
	case "`/bin/arch`" in
	    sun3)
440
		echo m68k-sun-sunos"$UNAME_RELEASE"
441
442
		;;
	    sun4)
443
		echo sparc-sun-sunos"$UNAME_RELEASE"
444
445
		;;
	esac
446
	exit ;;
447
    aushp:SunOS:*:*)
448
	echo sparc-auspex-sunos"$UNAME_RELEASE"
449
	exit ;;
450
451
452
453
454
455
456
457
458
    # The situation for MiNT is a little confusing.  The machine name
    # can be virtually everything (everything which is not
    # "atarist" or "atariste" at least should have a processor
    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
    # to the lowercase version "mint" (or "freemint").  Finally
    # the system name "TOS" denotes a system which is actually not
    # MiNT.  But MiNT is downward compatible to TOS, so this should
    # be no problem.
    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
459
	echo m68k-atari-mint"$UNAME_RELEASE"
460
	exit ;;
461
    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
462
	echo m68k-atari-mint"$UNAME_RELEASE"
463
	exit ;;
464
    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
465
	echo m68k-atari-mint"$UNAME_RELEASE"
466
	exit ;;
467
    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
468
	echo m68k-milan-mint"$UNAME_RELEASE"
469
	exit ;;
470
    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
471
	echo m68k-hades-mint"$UNAME_RELEASE"
472
	exit ;;
473
    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
474
	echo m68k-unknown-mint"$UNAME_RELEASE"
475
476
	exit ;;
    m68k:machten:*:*)
477
	echo m68k-apple-machten"$UNAME_RELEASE"
478
	exit ;;
479
    powerpc:machten:*:*)
480
	echo powerpc-apple-machten"$UNAME_RELEASE"
481
	exit ;;
482
483
    RISC*:Mach:*:*)
	echo mips-dec-mach_bsd4.3
484
	exit ;;
485
    RISC*:ULTRIX:*:*)
486
	echo mips-dec-ultrix"$UNAME_RELEASE"
487
	exit ;;
488
    VAX*:ULTRIX*:*:*)
489
	echo vax-dec-ultrix"$UNAME_RELEASE"
490
	exit ;;
491
    2020:CLIX:*:* | 2430:CLIX:*:*)
492
	echo clipper-intergraph-clix"$UNAME_RELEASE"
493
	exit ;;
494
    mips:*:*:UMIPS | mips:*:*:RISCos)
495
496
	set_cc_for_build
	sed 's/^	//' << EOF > "$dummy.c"
497
498
499
500
501
502
503
504
#ifdef __cplusplus
#include <stdio.h>  /* for printf() prototype */
	int main (int argc, char *argv[]) {
#else
	int main (argc, argv) int argc; char *argv[]; {
#endif
	#if defined (host_mips) && defined (MIPSEB)
	#if defined (SYSTYPE_SYSV)
505
	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
506
507
	#endif
	#if defined (SYSTYPE_SVR4)
508
	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
509
510
	#endif
	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
511
	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
512
513
514
515
516
	#endif
	#endif
	  exit (-1);
	}
EOF
517
518
519
	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
520
	    { echo "$SYSTEM_NAME"; exit; }
521
	echo mips-mips-riscos"$UNAME_RELEASE"
522
	exit ;;
523
524
    Motorola:PowerMAX_OS:*:*)
	echo powerpc-motorola-powermax
525
	exit ;;
526
527
    Motorola:*:4.3:PL8-*)
	echo powerpc-harris-powermax
528
	exit ;;
529
530
    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
	echo powerpc-harris-powermax
531
	exit ;;
532
533
    Night_Hawk:Power_UNIX:*:*)
	echo powerpc-harris-powerunix
534
	exit ;;
535
536
    m88k:CX/UX:7*:*)
	echo m88k-harris-cxux7
537
	exit ;;
538
539
    m88k:*:4*:R4*)
	echo m88k-motorola-sysv4
540
	exit ;;
541
542
    m88k:*:3*:R3*)
	echo m88k-motorola-sysv3
543
	exit ;;
544
    AViiON:dgux:*:*)
545
546
	# DG/UX returns AViiON for all architectures
	UNAME_PROCESSOR=`/usr/bin/uname -p`
547
	if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
548
	then
549
550
	    if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
	       [ "$TARGET_BINARY_INTERFACE"x = x ]
551
	    then
552
		echo m88k-dg-dgux"$UNAME_RELEASE"
553
	    else
554
		echo m88k-dg-dguxbcs"$UNAME_RELEASE"
555
556
	    fi
	else
557
	    echo i586-dg-dgux"$UNAME_RELEASE"
558
	fi
559
	exit ;;
560
561
    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
	echo m88k-dolphin-sysv3
562
	exit ;;
563
564
565
    M88*:*:R3*:*)
	# Delta 88k system running SVR3
	echo m88k-motorola-sysv3
566
	exit ;;
567
568
    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
	echo m88k-tektronix-sysv3
569
	exit ;;
570
571
    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
	echo m68k-tektronix-bsd
572
	exit ;;
573
    *:IRIX*:*:*)
574
	echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
575
	exit ;;
576
    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
577
578
	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
579
580
    i*86:AIX:*:*)
	echo i386-ibm-aix
581
	exit ;;
582
583
584
585
    ia64:AIX:*:*)
	if [ -x /usr/bin/oslevel ] ; then
		IBM_REV=`/usr/bin/oslevel`
	else
586
		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
587
	fi
588
	echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
589
	exit ;;
590
591
    *:AIX:2:3)
	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
592
593
		set_cc_for_build
		sed 's/^		//' << EOF > "$dummy.c"
594
595
596
597
598
599
600
601
602
603
		#include <sys/systemcfg.h>

		main()
			{
			if (!__power_pc())
				exit(1);
			puts("powerpc-ibm-aix3.2.5");
			exit(0);
			}
EOF
604
		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
605
606
607
608
609
		then
			echo "$SYSTEM_NAME"
		else
			echo rs6000-ibm-aix3.2.5
		fi
610
611
612
613
614
	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
		echo rs6000-ibm-aix3.2.4
	else
		echo rs6000-ibm-aix3.2
	fi
615
616
	exit ;;
    *:AIX:*:[4567])
617
	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
618
	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
619
620
621
622
		IBM_ARCH=rs6000
	else
		IBM_ARCH=powerpc
	fi
623
624
625
	if [ -x /usr/bin/lslpp ] ; then
		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
626
	else
627
		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
628
	fi
629
	echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
630
	exit ;;
631
632
    *:AIX:*:*)
	echo rs6000-ibm-aix
633
	exit ;;
634
    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
635
	echo romp-ibm-bsd4.4
636
	exit ;;
637
    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
638
	echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
639
	exit ;;                             # report: romp-ibm BSD 4.3
640
641
    *:BOSX:*:*)
	echo rs6000-bull-bosx
642
	exit ;;
643
644
    DPX/2?00:B.O.S.:*:*)
	echo m68k-bull-sysv3
645
	exit ;;
646
647
    9000/[34]??:4.3bsd:1.*:*)
	echo m68k-hp-bsd
648
	exit ;;
649
650
    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
	echo m68k-hp-bsd4.4
651
	exit ;;
652
    9000/[34678]??:HP-UX:*:*)
653
654
655
656
	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
	case "$UNAME_MACHINE" in
	    9000/31?)            HP_ARCH=m68000 ;;
	    9000/[34]??)         HP_ARCH=m68k ;;
657
658
659
	    9000/[678][0-9][0-9])
		if [ -x /usr/bin/getconf ]; then
		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
660
		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
661
662
663
		    case "$sc_cpu_version" in
		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
664
		      532)                      # CPU_PA_RISC2_0
665
666
667
668
			case "$sc_kernel_bits" in
			  32) HP_ARCH=hppa2.0n ;;
			  64) HP_ARCH=hppa2.0w ;;
			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
669
670
			esac ;;
		    esac
671
		fi
672
673
674
		if [ "$HP_ARCH" = "" ]; then
		    set_cc_for_build
		    sed 's/^		//' << EOF > "$dummy.c"
675

676
677
678
		#define _HPUX_SOURCE
		#include <stdlib.h>
		#include <unistd.h>
679

680
681
682
683
684
685
		int main ()
		{
		#if defined(_SC_KERNEL_BITS)
		    long bits = sysconf(_SC_KERNEL_BITS);
		#endif
		    long cpu  = sysconf (_SC_CPU_VERSION);
686

687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
		    switch (cpu)
			{
			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
			case CPU_PA_RISC2_0:
		#if defined(_SC_KERNEL_BITS)
			    switch (bits)
				{
				case 64: puts ("hppa2.0w"); break;
				case 32: puts ("hppa2.0n"); break;
				default: puts ("hppa2.0"); break;
				} break;
		#else  /* !defined(_SC_KERNEL_BITS) */
			    puts ("hppa2.0"); break;
		#endif
			default: puts ("hppa1.0"); break;
			}
		    exit (0);
		}
706
EOF
707
		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
708
709
710
		    test -z "$HP_ARCH" && HP_ARCH=hppa
		fi ;;
	esac
711
	if [ "$HP_ARCH" = hppa2.0w ]
712
	then
713
	    set_cc_for_build
714
715
716
717
718
719
720
721
722
723

	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
	    # generating 64-bit code.  GNU and HP use different nomenclature:
	    #
	    # $ CC_FOR_BUILD=cc ./config.guess
	    # => hppa2.0w-hp-hpux11.23
	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
	    # => hppa64-hp-hpux11.23

724
	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
725
		grep -q __LP64__
726
	    then
727
		HP_ARCH=hppa2.0w
728
	    else
729
		HP_ARCH=hppa64
730
731
	    fi
	fi
732
	echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
733
	exit ;;
734
    ia64:HP-UX:*:*)
735
736
	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
	echo ia64-hp-hpux"$HPUX_REV"
737
	exit ;;
738
    3050*:HI-UX:*:*)
739
740
	set_cc_for_build
	sed 's/^	//' << EOF > "$dummy.c"
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
	#include <unistd.h>
	int
	main ()
	{
	  long cpu = sysconf (_SC_CPU_VERSION);
	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
	     results, however.  */
	  if (CPU_IS_PA_RISC (cpu))
	    {
	      switch (cpu)
		{
		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
		  default: puts ("hppa-hitachi-hiuxwe2"); break;
		}
	    }
	  else if (CPU_IS_HP_MC68K (cpu))
	    puts ("m68k-hitachi-hiuxwe2");
	  else puts ("unknown-hitachi-hiuxwe2");
	  exit (0);
	}
EOF
765
	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
766
		{ echo "$SYSTEM_NAME"; exit; }
767
	echo unknown-hitachi-hiuxwe2
768
	exit ;;
769
    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
770
	echo hppa1.1-hp-bsd
771
	exit ;;
772
773
    9000/8??:4.3bsd:*:*)
	echo hppa1.0-hp-bsd
774
	exit ;;
775
776
    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
	echo hppa1.0-hp-mpeix
777
	exit ;;
778
    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
779
	echo hppa1.1-hp-osf
780
	exit ;;
781
782
    hp8??:OSF1:*:*)
	echo hppa1.0-hp-osf
783
	exit ;;
784
785
    i*86:OSF1:*:*)
	if [ -x /usr/sbin/sysversion ] ; then
786
	    echo "$UNAME_MACHINE"-unknown-osf1mk
787
	else
788
	    echo "$UNAME_MACHINE"-unknown-osf1
789
	fi
790
	exit ;;
791
792
    parisc*:Lites*:*:*)
	echo hppa1.1-hp-lites
793
	exit ;;
794
795
    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
	echo c1-convex-bsd
796
	exit ;;
797
798
799
800
801
    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
	if getsysinfo -f scalar_acc
	then echo c32-convex-bsd
	else echo c2-convex-bsd
	fi
802
	exit ;;
803
804
    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
	echo c34-convex-bsd
805
	exit ;;
806
807
    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
	echo c38-convex-bsd
808
	exit ;;
809
810
    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
	echo c4-convex-bsd
811
	exit ;;
812
    CRAY*Y-MP:*:*:*)
813
	echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
814
	exit ;;
815
    CRAY*[A-Z]90:*:*:*)
816
	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
817
818
819
	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
	      -e 's/\.[^.]*$/.X/'
820
	exit ;;
821
    CRAY*TS:*:*:*)
822
	echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
823
	exit ;;
824
    CRAY*T3E:*:*:*)
825
	echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
826
	exit ;;
827
    CRAY*SV1:*:*:*)
828
	echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
829
	exit ;;
830
    *:UNICOS/mp:*:*)
831
	echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
832
	exit ;;
833
    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
834
835
836
	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
837
838
	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
	exit ;;
839
    5000:UNIX_System_V:4.*:*)
840
841
	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
842
843
	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
	exit ;;
844
    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
845
	echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
846
	exit ;;
847
    sparc*:BSD/OS:*:*)
848
	echo sparc-unknown-bsdi"$UNAME_RELEASE"
849
	exit ;;
850
    *:BSD/OS:*:*)
851
852
853
854
855
856
857
858
859
860
861
862
	echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
	exit ;;
    arm:FreeBSD:*:*)
	UNAME_PROCESSOR=`uname -p`
	set_cc_for_build
	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
	    | grep -q __ARM_PCS_VFP
	then
	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi
	else
	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf
	fi
863
	exit ;;
864
    *:FreeBSD:*:*)
865
	UNAME_PROCESSOR=`/usr/bin/uname -p`
866
	case "$UNAME_PROCESSOR" in
867
	    amd64)
868
869
870
		UNAME_PROCESSOR=x86_64 ;;
	    i386)
		UNAME_PROCESSOR=i586 ;;
871
	esac
872
	echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
873
	exit ;;
874
    i*:CYGWIN*:*)
875
	echo "$UNAME_MACHINE"-pc-cygwin
876
	exit ;;
877
    *:MINGW64*:*)
878
	echo "$UNAME_MACHINE"-pc-mingw64
879
	exit ;;
880
    *:MINGW*:*)
881
	echo "$UNAME_MACHINE"-pc-mingw32
882
	exit ;;
883
884
    *:MSYS*:*)
	echo "$UNAME_MACHINE"-pc-msys
885
	exit ;;
886
    i*:PW*:*)
887
	echo "$UNAME_MACHINE"-pc-pw32
888
889
	exit ;;
    *:Interix*:*)
890
	case "$UNAME_MACHINE" in
891
	    x86)
892
		echo i586-pc-interix"$UNAME_RELEASE"
893
894
		exit ;;
	    authenticamd | genuineintel | EM64T)
895
		echo x86_64-unknown-interix"$UNAME_RELEASE"
896
897
		exit ;;
	    IA64)
898
		echo ia64-unknown-interix"$UNAME_RELEASE"
899
900
		exit ;;
	esac ;;
901
    i*:UWIN*:*)
902
	echo "$UNAME_MACHINE"-pc-uwin
903
904
	exit ;;
    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
905
	echo x86_64-pc-cygwin
906
	exit ;;
907
    prep*:SunOS:5.*:*)
908
	echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
909
	exit ;;
910
911
    *:GNU:*:*)
	# the GNU system
912
	echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
913
	exit ;;
914
915
    *:GNU/*:*:*)
	# other systems with GNU libc and userland
916
	echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
917
	exit ;;
918
919
    *:Minix:*:*)
	echo "$UNAME_MACHINE"-unknown-minix
920
	exit ;;
921
    aarch64:Linux:*:*)
922
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
923
924
925
	exit ;;
    aarch64_be:Linux:*:*)
	UNAME_MACHINE=aarch64_be
926
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
927
	exit ;;
928
    alpha:Linux:*:*)
929
	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
930
931
932
933
934
935
936
937
938
	  EV5)   UNAME_MACHINE=alphaev5 ;;
	  EV56)  UNAME_MACHINE=alphaev56 ;;
	  PCA56) UNAME_MACHINE=alphapca56 ;;
	  PCA57) UNAME_MACHINE=alphapca56 ;;
	  EV6)   UNAME_MACHINE=alphaev6 ;;
	  EV67)  UNAME_MACHINE=alphaev67 ;;
	  EV68*) UNAME_MACHINE=alphaev68 ;;
	esac
	objdump --private-headers /bin/sh | grep -q ld.so.1
939
940
	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
941
942
	exit ;;
    arc:Linux:*:* | arceb:Linux:*:*)
943
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
944
	exit ;;
945
    arm*:Linux:*:*)
946
	set_cc_for_build
947
948
949
	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
	    | grep -q __ARM_EABI__
	then
950
	    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
951
952
953
954
	else
	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
		| grep <