1#! /bin/sh
2# Attempt to guess a canonical system name.
3#   Copyright 1992-2020 Free Software Foundation, Inc.
4
5timestamp='2020-01-01'
6
7# This file is free software; you can redistribute it and/or modify it
8# 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# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15# General Public License for more details.
16#
17# 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# As a special exception to the GNU General Public License, if you
21# distribute this file as part of a program that contains a
22# configuration script generated by Autoconf, you may include it under
23# the same distribution terms that you use for the rest of that
24# program.  This Exception is an additional permission under section 7
25# 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
35me=`echo "$0" | sed -e 's,.*/,,'`
36
37usage="\
38Usage: $0 [OPTION]
39
40Output the configuration name of the system \`$me' is run on.
41
42Options:
43  -h, --help         print this help, then exit
44  -t, --time-stamp   print date of last modification, then exit
45  -v, --version      print version number, then exit
46
47Report bugs and patches to <config-patches@gnu.org>."
48
49version="\
50GNU config.guess ($timestamp)
51
52Originally written by Per Bothner.
53Copyright 1992-2020 Free Software Foundation, Inc.
54
55This is free software; see the source for copying conditions.  There is NO
56warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
57
58help="
59Try \`$me --help' for more information."
60
61# Parse command line
62while test $# -gt 0 ; do
63  case $1 in
64    --time-stamp | --time* | -t )
65       echo "$timestamp" ; exit ;;
66    --version | -v )
67       echo "$version" ; exit ;;
68    --help | --h* | -h )
69       echo "$usage"; exit ;;
70    -- )     # Stop option processing
71       shift; break ;;
72    - )   # Use stdin as input.
73       break ;;
74    -* )
75       echo "$me: invalid option $1$help" >&2
76       exit 1 ;;
77    * )
78       break ;;
79  esac
80done
81
82if test $# != 0; then
83  echo "$me: too many arguments$help" >&2
84  exit 1
85fi
86
87# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
88# compiler to aid in system detection is discouraged as it requires
89# temporary files to be created and, as you can see below, it is a
90# headache to deal with in a portable fashion.
91
92# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
93# use `HOST_CC' if defined, but it is deprecated.
94
95# Portable tmp directory creation inspired by the Autoconf team.
96
97tmp=
98# shellcheck disable=SC2172
99trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
100
101set_cc_for_build() {
102    # prevent multiple calls if $tmp is already set
103    test "$tmp" && return 0
104    : "${TMPDIR=/tmp}"
105    # shellcheck disable=SC2039
106    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
107          { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
108          { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
109          { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
110    dummy=$tmp/dummy
111    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
112          ,,)    echo "int x;" > "$dummy.c"
113                 for driver in cc gcc c89 c99 ; do
114                       if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
115                           CC_FOR_BUILD="$driver"
116                           break
117                       fi
118                 done
119                 if test x"$CC_FOR_BUILD" = x ; then
120                       CC_FOR_BUILD=no_compiler_found
121                 fi
122                 ;;
123          ,,*)   CC_FOR_BUILD=$CC ;;
124          ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
125    esac
126}
127
128# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
129# (ghazi@noc.rutgers.edu 1994-08-24)
130if test -f /.attbin/uname ; then
131          PATH=$PATH:/.attbin ; export PATH
132fi
133
134UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
135UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
136UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
137UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
138
139case "$UNAME_SYSTEM" in
140Linux|GNU|GNU/*)
141          # If the system lacks a compiler, then just pick glibc.
142          # We could probably try harder.
143          LIBC=gnu
144
145          set_cc_for_build
146          cat <<-EOF > "$dummy.c"
147          #include <features.h>
148          #if defined(__UCLIBC__)
149          LIBC=uclibc
150          #elif defined(__dietlibc__)
151          LIBC=dietlibc
152          #else
153          LIBC=gnu
154          #endif
155          EOF
156          eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
157
158          # If ldd exists, use it to detect musl libc.
159          if command -v ldd >/dev/null && \
160                    ldd --version 2>&1 | grep -q ^musl
161          then
162              LIBC=musl
163          fi
164          ;;
165esac
166
167# Note: order is significant - the case branches are not exclusive.
168
169case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
170    *:NetBSD:*:*)
171          # NetBSD (nbsd) targets should (where applicable) match one or
172          # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
173          # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
174          # switched to ELF, *-*-netbsd* would select the old
175          # object file format.  This provides both forward
176          # compatibility and a consistent mechanism for selecting the
177          # object file format.
178          #
179          # Note: NetBSD doesn't particularly care about the vendor
180          # portion of the name.  We always set it to "unknown".
181          sysctl="sysctl -n hw.machine_arch"
182          UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
183              "/sbin/$sysctl" 2>/dev/null || \
184              "/usr/sbin/$sysctl" 2>/dev/null || \
185              echo unknown)`
186          case "$UNAME_MACHINE_ARCH" in
187              aarch64eb) machine=aarch64_be-unknown ;;
188              armeb) machine=armeb-unknown ;;
189              arm*) machine=arm-unknown ;;
190              sh3el) machine=shl-unknown ;;
191              sh3eb) machine=sh-unknown ;;
192              sh5el) machine=sh5le-unknown ;;
193              earmv*)
194                    arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
195                    endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
196                    machine="${arch}${endian}"-unknown
197                    ;;
198              *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
199          esac
200          # The Operating System including object format, if it has switched
201          # to ELF recently (or will in the future) and ABI.
202          case "$UNAME_MACHINE_ARCH" in
203              earm*)
204                    os=netbsdelf
205                    ;;
206              arm*|i386|m68k|ns32k|sh3*|sparc|vax)
207                    set_cc_for_build
208                    if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
209                              | grep -q __ELF__
210                    then
211                        # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
212                        # Return netbsd for either.  FIX?
213                        os=netbsd
214                    else
215                        os=netbsdelf
216                    fi
217                    ;;
218              *)
219                    os=netbsd
220                    ;;
221          esac
222          # Determine ABI tags.
223          case "$UNAME_MACHINE_ARCH" in
224              earm*)
225                    expr='s/^earmv[0-9]/-eabi/;s/eb$//'
226                    abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
227                    ;;
228          esac
229          # The OS release
230          # Debian GNU/NetBSD machines have a different userland, and
231          # thus, need a distinct triplet. However, they do not need
232          # kernel version information, so it can be replaced with a
233          # suitable tag, in the style of linux-gnu.
234          case "$UNAME_VERSION" in
235              Debian*)
236                    release='-gnu'
237                    ;;
238              *)
239                    release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
240                    ;;
241          esac
242          # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
243          # contains redundant information, the shorter form:
244          # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
245          echo "$machine-${os}${release}${abi-}"
246          exit ;;
247    *:Bitrig:*:*)
248          UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
249          echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
250          exit ;;
251    *:OpenBSD:*:*)
252          UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
253          echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
254          exit ;;
255    *:LibertyBSD:*:*)
256          UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
257          echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
258          exit ;;
259    *:MidnightBSD:*:*)
260          echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
261          exit ;;
262    *:ekkoBSD:*:*)
263          echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
264          exit ;;
265    *:SolidBSD:*:*)
266          echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
267          exit ;;
268    *:OS108:*:*)
269          echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
270          exit ;;
271    macppc:MirBSD:*:*)
272          echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
273          exit ;;
274    *:MirBSD:*:*)
275          echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
276          exit ;;
277    *:Sortix:*:*)
278          echo "$UNAME_MACHINE"-unknown-sortix
279          exit ;;
280    *:Twizzler:*:*)
281          echo "$UNAME_MACHINE"-unknown-twizzler
282          exit ;;
283    *:Redox:*:*)
284          echo "$UNAME_MACHINE"-unknown-redox
285          exit ;;
286    mips:OSF1:*.*)
287          echo mips-dec-osf1
288          exit ;;
289    alpha:OSF1:*:*)
290          case $UNAME_RELEASE in
291          *4.0)
292                    UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
293                    ;;
294          *5.*)
295                    UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
296                    ;;
297          esac
298          # According to Compaq, /usr/sbin/psrinfo has been available on
299          # OSF/1 and Tru64 systems produced since 1995.  I hope that
300          # covers most systems running today.  This code pipes the CPU
301          # types through head -n 1, so we only detect the type of CPU 0.
302          ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
303          case "$ALPHA_CPU_TYPE" in
304              "EV4 (21064)")
305                    UNAME_MACHINE=alpha ;;
306              "EV4.5 (21064)")
307                    UNAME_MACHINE=alpha ;;
308              "LCA4 (21066/21068)")
309                    UNAME_MACHINE=alpha ;;
310              "EV5 (21164)")
311                    UNAME_MACHINE=alphaev5 ;;
312              "EV5.6 (21164A)")
313                    UNAME_MACHINE=alphaev56 ;;
314              "EV5.6 (21164PC)")
315                    UNAME_MACHINE=alphapca56 ;;
316              "EV5.7 (21164PC)")
317                    UNAME_MACHINE=alphapca57 ;;
318              "EV6 (21264)")
319                    UNAME_MACHINE=alphaev6 ;;
320              "EV6.7 (21264A)")
321                    UNAME_MACHINE=alphaev67 ;;
322              "EV6.8CB (21264C)")
323                    UNAME_MACHINE=alphaev68 ;;
324              "EV6.8AL (21264B)")
325                    UNAME_MACHINE=alphaev68 ;;
326              "EV6.8CX (21264D)")
327                    UNAME_MACHINE=alphaev68 ;;
328              "EV6.9A (21264/EV69A)")
329                    UNAME_MACHINE=alphaev69 ;;
330              "EV7 (21364)")
331                    UNAME_MACHINE=alphaev7 ;;
332              "EV7.9 (21364A)")
333                    UNAME_MACHINE=alphaev79 ;;
334          esac
335          # A Pn.n version is a patched version.
336          # A Vn.n version is a released version.
337          # A Tn.n version is a released field test version.
338          # A Xn.n version is an unreleased experimental baselevel.
339          # 1.2 uses "1.2" for uname -r.
340          echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
341          # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
342          exitcode=$?
343          trap '' 0
344          exit $exitcode ;;
345    Amiga*:UNIX_System_V:4.0:*)
346          echo m68k-unknown-sysv4
347          exit ;;
348    *:[Aa]miga[Oo][Ss]:*:*)
349          echo "$UNAME_MACHINE"-unknown-amigaos
350          exit ;;
351    *:[Mm]orph[Oo][Ss]:*:*)
352          echo "$UNAME_MACHINE"-unknown-morphos
353          exit ;;
354    *:OS/390:*:*)
355          echo i370-ibm-openedition
356          exit ;;
357    *:z/VM:*:*)
358          echo s390-ibm-zvmoe
359          exit ;;
360    *:OS400:*:*)
361          echo powerpc-ibm-os400
362          exit ;;
363    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
364          echo arm-acorn-riscix"$UNAME_RELEASE"
365          exit ;;
366    arm*:riscos:*:*|arm*:RISCOS:*:*)
367          echo arm-unknown-riscos
368          exit ;;
369    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
370          echo hppa1.1-hitachi-hiuxmpp
371          exit ;;
372    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
373          # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
374          if test "`(/bin/universe) 2>/dev/null`" = att ; then
375                    echo pyramid-pyramid-sysv3
376          else
377                    echo pyramid-pyramid-bsd
378          fi
379          exit ;;
380    NILE*:*:*:dcosx)
381          echo pyramid-pyramid-svr4
382          exit ;;
383    DRS?6000:unix:4.0:6*)
384          echo sparc-icl-nx6
385          exit ;;
386    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
387          case `/usr/bin/uname -p` in
388              sparc) echo sparc-icl-nx7; exit ;;
389          esac ;;
390    s390x:SunOS:*:*)
391          echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
392          exit ;;
393    sun4H:SunOS:5.*:*)
394          echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
395          exit ;;
396    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
397          echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
398          exit ;;
399    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
400          echo i386-pc-auroraux"$UNAME_RELEASE"
401          exit ;;
402    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
403          set_cc_for_build
404          SUN_ARCH=i386
405          # If there is a compiler, see if it is configured for 64-bit objects.
406          # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
407          # This test works for both compilers.
408          if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
409              if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
410                    (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
411                    grep IS_64BIT_ARCH >/dev/null
412              then
413                    SUN_ARCH=x86_64
414              fi
415          fi
416          echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
417          exit ;;
418    sun4*:SunOS:6*:*)
419          # According to config.sub, this is the proper way to canonicalize
420          # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
421          # it's likely to be more like Solaris than SunOS4.
422          echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
423          exit ;;
424    sun4*:SunOS:*:*)
425          case "`/usr/bin/arch -k`" in
426              Series*|S4*)
427                    UNAME_RELEASE=`uname -v`
428                    ;;
429          esac
430          # Japanese Language versions have a version number like `4.1.3-JL'.
431          echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
432          exit ;;
433    sun3*:SunOS:*:*)
434          echo m68k-sun-sunos"$UNAME_RELEASE"
435          exit ;;
436    sun*:*:4.2BSD:*)
437          UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
438          test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
439          case "`/bin/arch`" in
440              sun3)
441                    echo m68k-sun-sunos"$UNAME_RELEASE"
442                    ;;
443              sun4)
444                    echo sparc-sun-sunos"$UNAME_RELEASE"
445                    ;;
446          esac
447          exit ;;
448    aushp:SunOS:*:*)
449          echo sparc-auspex-sunos"$UNAME_RELEASE"
450          exit ;;
451    # The situation for MiNT is a little confusing.  The machine name
452    # can be virtually everything (everything which is not
453    # "atarist" or "atariste" at least should have a processor
454    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
455    # to the lowercase version "mint" (or "freemint").  Finally
456    # the system name "TOS" denotes a system which is actually not
457    # MiNT.  But MiNT is downward compatible to TOS, so this should
458    # be no problem.
459    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
460          echo m68k-atari-mint"$UNAME_RELEASE"
461          exit ;;
462    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
463          echo m68k-atari-mint"$UNAME_RELEASE"
464          exit ;;
465    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
466          echo m68k-atari-mint"$UNAME_RELEASE"
467          exit ;;
468    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
469          echo m68k-milan-mint"$UNAME_RELEASE"
470          exit ;;
471    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
472          echo m68k-hades-mint"$UNAME_RELEASE"
473          exit ;;
474    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
475          echo m68k-unknown-mint"$UNAME_RELEASE"
476          exit ;;
477    m68k:machten:*:*)
478          echo m68k-apple-machten"$UNAME_RELEASE"
479          exit ;;
480    powerpc:machten:*:*)
481          echo powerpc-apple-machten"$UNAME_RELEASE"
482          exit ;;
483    RISC*:Mach:*:*)
484          echo mips-dec-mach_bsd4.3
485          exit ;;
486    RISC*:ULTRIX:*:*)
487          echo mips-dec-ultrix"$UNAME_RELEASE"
488          exit ;;
489    VAX*:ULTRIX*:*:*)
490          echo vax-dec-ultrix"$UNAME_RELEASE"
491          exit ;;
492    2020:CLIX:*:* | 2430:CLIX:*:*)
493          echo clipper-intergraph-clix"$UNAME_RELEASE"
494          exit ;;
495    mips:*:*:UMIPS | mips:*:*:RISCos)
496          set_cc_for_build
497          sed 's/^  //' << EOF > "$dummy.c"
498#ifdef __cplusplus
499#include <stdio.h>  /* for printf() prototype */
500          int main (int argc, char *argv[]) {
501#else
502          int main (argc, argv) int argc; char *argv[]; {
503#endif
504          #if defined (host_mips) && defined (MIPSEB)
505          #if defined (SYSTYPE_SYSV)
506            printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
507          #endif
508          #if defined (SYSTYPE_SVR4)
509            printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
510          #endif
511          #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
512            printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
513          #endif
514          #endif
515            exit (-1);
516          }
517EOF
518          $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
519            dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
520            SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
521              { echo "$SYSTEM_NAME"; exit; }
522          echo mips-mips-riscos"$UNAME_RELEASE"
523          exit ;;
524    Motorola:PowerMAX_OS:*:*)
525          echo powerpc-motorola-powermax
526          exit ;;
527    Motorola:*:4.3:PL8-*)
528          echo powerpc-harris-powermax
529          exit ;;
530    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
531          echo powerpc-harris-powermax
532          exit ;;
533    Night_Hawk:Power_UNIX:*:*)
534          echo powerpc-harris-powerunix
535          exit ;;
536    m88k:CX/UX:7*:*)
537          echo m88k-harris-cxux7
538          exit ;;
539    m88k:*:4*:R4*)
540          echo m88k-motorola-sysv4
541          exit ;;
542    m88k:*:3*:R3*)
543          echo m88k-motorola-sysv3
544          exit ;;
545    AViiON:dgux:*:*)
546          # DG/UX returns AViiON for all architectures
547          UNAME_PROCESSOR=`/usr/bin/uname -p`
548          if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
549          then
550              if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
551                 [ "$TARGET_BINARY_INTERFACE"x = x ]
552              then
553                    echo m88k-dg-dgux"$UNAME_RELEASE"
554              else
555                    echo m88k-dg-dguxbcs"$UNAME_RELEASE"
556              fi
557          else
558              echo i586-dg-dgux"$UNAME_RELEASE"
559          fi
560          exit ;;
561    M88*:DolphinOS:*:*)       # DolphinOS (SVR3)
562          echo m88k-dolphin-sysv3
563          exit ;;
564    M88*:*:R3*:*)
565          # Delta 88k system running SVR3
566          echo m88k-motorola-sysv3
567          exit ;;
568    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
569          echo m88k-tektronix-sysv3
570          exit ;;
571    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
572          echo m68k-tektronix-bsd
573          exit ;;
574    *:IRIX*:*:*)
575          echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
576          exit ;;
577    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
578          echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
579          exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
580    i*86:AIX:*:*)
581          echo i386-ibm-aix
582          exit ;;
583    ia64:AIX:*:*)
584          if [ -x /usr/bin/oslevel ] ; then
585                    IBM_REV=`/usr/bin/oslevel`
586          else
587                    IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
588          fi
589          echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
590          exit ;;
591    *:AIX:2:3)
592          if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
593                    set_cc_for_build
594                    sed 's/^            //' << EOF > "$dummy.c"
595                    #include <sys/systemcfg.h>
596
597                    main()
598                              {
599                              if (!__power_pc())
600                                        exit(1);
601                              puts("powerpc-ibm-aix3.2.5");
602                              exit(0);
603                              }
604EOF
605                    if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
606                    then
607                              echo "$SYSTEM_NAME"
608                    else
609                              echo rs6000-ibm-aix3.2.5
610                    fi
611          elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
612                    echo rs6000-ibm-aix3.2.4
613          else
614                    echo rs6000-ibm-aix3.2
615          fi
616          exit ;;
617    *:AIX:*:[4567])
618          IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
619          if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
620                    IBM_ARCH=rs6000
621          else
622                    IBM_ARCH=powerpc
623          fi
624          if [ -x /usr/bin/lslpp ] ; then
625                    IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
626                                 awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
627          else
628                    IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
629          fi
630          echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
631          exit ;;
632    *:AIX:*:*)
633          echo rs6000-ibm-aix
634          exit ;;
635    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
636          echo romp-ibm-bsd4.4
637          exit ;;
638    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
639          echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
640          exit ;;                             # report: romp-ibm BSD 4.3
641    *:BOSX:*:*)
642          echo rs6000-bull-bosx
643          exit ;;
644    DPX/2?00:B.O.S.:*:*)
645          echo m68k-bull-sysv3
646          exit ;;
647    9000/[34]??:4.3bsd:1.*:*)
648          echo m68k-hp-bsd
649          exit ;;
650    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
651          echo m68k-hp-bsd4.4
652          exit ;;
653    9000/[34678]??:HP-UX:*:*)
654          HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
655          case "$UNAME_MACHINE" in
656              9000/31?)            HP_ARCH=m68000 ;;
657              9000/[34]??)         HP_ARCH=m68k ;;
658              9000/[678][0-9][0-9])
659                    if [ -x /usr/bin/getconf ]; then
660                        sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
661                        sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
662                        case "$sc_cpu_version" in
663                          523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
664                          528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
665                          532)                      # CPU_PA_RISC2_0
666                              case "$sc_kernel_bits" in
667                                32) HP_ARCH=hppa2.0n ;;
668                                64) HP_ARCH=hppa2.0w ;;
669                                '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
670                              esac ;;
671                        esac
672                    fi
673                    if [ "$HP_ARCH" = "" ]; then
674                        set_cc_for_build
675                        sed 's/^                  //' << EOF > "$dummy.c"
676
677                    #define _HPUX_SOURCE
678                    #include <stdlib.h>
679                    #include <unistd.h>
680
681                    int main ()
682                    {
683                    #if defined(_SC_KERNEL_BITS)
684                        long bits = sysconf(_SC_KERNEL_BITS);
685                    #endif
686                        long cpu  = sysconf (_SC_CPU_VERSION);
687
688                        switch (cpu)
689                              {
690                              case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
691                              case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
692                              case CPU_PA_RISC2_0:
693                    #if defined(_SC_KERNEL_BITS)
694                                  switch (bits)
695                                        {
696                                        case 64: puts ("hppa2.0w"); break;
697                                        case 32: puts ("hppa2.0n"); break;
698                                        default: puts ("hppa2.0"); break;
699                                        } break;
700                    #else  /* !defined(_SC_KERNEL_BITS) */
701                                  puts ("hppa2.0"); break;
702                    #endif
703                              default: puts ("hppa1.0"); break;
704                              }
705                        exit (0);
706                    }
707EOF
708                        (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
709                        test -z "$HP_ARCH" && HP_ARCH=hppa
710                    fi ;;
711          esac
712          if [ "$HP_ARCH" = hppa2.0w ]
713          then
714              set_cc_for_build
715
716              # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
717              # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
718              # generating 64-bit code.  GNU and HP use different nomenclature:
719              #
720              # $ CC_FOR_BUILD=cc ./config.guess
721              # => hppa2.0w-hp-hpux11.23
722              # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
723              # => hppa64-hp-hpux11.23
724
725              if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
726                    grep -q __LP64__
727              then
728                    HP_ARCH=hppa2.0w
729              else
730                    HP_ARCH=hppa64
731              fi
732          fi
733          echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
734          exit ;;
735    ia64:HP-UX:*:*)
736          HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
737          echo ia64-hp-hpux"$HPUX_REV"
738          exit ;;
739    3050*:HI-UX:*:*)
740          set_cc_for_build
741          sed 's/^  //' << EOF > "$dummy.c"
742          #include <unistd.h>
743          int
744          main ()
745          {
746            long cpu = sysconf (_SC_CPU_VERSION);
747            /* The order matters, because CPU_IS_HP_MC68K erroneously returns
748               true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
749               results, however.  */
750            if (CPU_IS_PA_RISC (cpu))
751              {
752                switch (cpu)
753                    {
754                      case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
755                      case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
756                      case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
757                      default: puts ("hppa-hitachi-hiuxwe2"); break;
758                    }
759              }
760            else if (CPU_IS_HP_MC68K (cpu))
761              puts ("m68k-hitachi-hiuxwe2");
762            else puts ("unknown-hitachi-hiuxwe2");
763            exit (0);
764          }
765EOF
766          $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
767                    { echo "$SYSTEM_NAME"; exit; }
768          echo unknown-hitachi-hiuxwe2
769          exit ;;
770    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
771          echo hppa1.1-hp-bsd
772          exit ;;
773    9000/8??:4.3bsd:*:*)
774          echo hppa1.0-hp-bsd
775          exit ;;
776    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
777          echo hppa1.0-hp-mpeix
778          exit ;;
779    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
780          echo hppa1.1-hp-osf
781          exit ;;
782    hp8??:OSF1:*:*)
783          echo hppa1.0-hp-osf
784          exit ;;
785    i*86:OSF1:*:*)
786          if [ -x /usr/sbin/sysversion ] ; then
787              echo "$UNAME_MACHINE"-unknown-osf1mk
788          else
789              echo "$UNAME_MACHINE"-unknown-osf1
790          fi
791          exit ;;
792    parisc*:Lites*:*:*)
793          echo hppa1.1-hp-lites
794          exit ;;
795    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
796          echo c1-convex-bsd
797          exit ;;
798    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
799          if getsysinfo -f scalar_acc
800          then echo c32-convex-bsd
801          else echo c2-convex-bsd
802          fi
803          exit ;;
804    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
805          echo c34-convex-bsd
806          exit ;;
807    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
808          echo c38-convex-bsd
809          exit ;;
810    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
811          echo c4-convex-bsd
812          exit ;;
813    CRAY*Y-MP:*:*:*)
814          echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
815          exit ;;
816    CRAY*[A-Z]90:*:*:*)
817          echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
818          | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
819                -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
820                -e 's/\.[^.]*$/.X/'
821          exit ;;
822    CRAY*TS:*:*:*)
823          echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
824          exit ;;
825    CRAY*T3E:*:*:*)
826          echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
827          exit ;;
828    CRAY*SV1:*:*:*)
829          echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
830          exit ;;
831    *:UNICOS/mp:*:*)
832          echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
833          exit ;;
834    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
835          FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
836          FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
837          FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
838          echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
839          exit ;;
840    5000:UNIX_System_V:4.*:*)
841          FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
842          FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
843          echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
844          exit ;;
845    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
846          echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
847          exit ;;
848    sparc*:BSD/OS:*:*)
849          echo sparc-unknown-bsdi"$UNAME_RELEASE"
850          exit ;;
851    *:BSD/OS:*:*)
852          echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
853          exit ;;
854    arm:FreeBSD:*:*)
855          UNAME_PROCESSOR=`uname -p`
856          set_cc_for_build
857          if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
858              | grep -q __ARM_PCS_VFP
859          then
860              echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi
861          else
862              echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf
863          fi
864          exit ;;
865    *:FreeBSD:*:*)
866          UNAME_PROCESSOR=`/usr/bin/uname -p`
867          case "$UNAME_PROCESSOR" in
868              amd64)
869                    UNAME_PROCESSOR=x86_64 ;;
870              i386)
871                    UNAME_PROCESSOR=i586 ;;
872          esac
873          echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
874          exit ;;
875    i*:CYGWIN*:*)
876          echo "$UNAME_MACHINE"-pc-cygwin
877          exit ;;
878    *:MINGW64*:*)
879          echo "$UNAME_MACHINE"-pc-mingw64
880          exit ;;
881    *:MINGW*:*)
882          echo "$UNAME_MACHINE"-pc-mingw32
883          exit ;;
884    *:MSYS*:*)
885          echo "$UNAME_MACHINE"-pc-msys
886          exit ;;
887    i*:PW*:*)
888          echo "$UNAME_MACHINE"-pc-pw32
889          exit ;;
890    *:Interix*:*)
891          case "$UNAME_MACHINE" in
892              x86)
893                    echo i586-pc-interix"$UNAME_RELEASE"
894                    exit ;;
895              authenticamd | genuineintel | EM64T)
896                    echo x86_64-unknown-interix"$UNAME_RELEASE"
897                    exit ;;
898              IA64)
899                    echo ia64-unknown-interix"$UNAME_RELEASE"
900                    exit ;;
901          esac ;;
902    i*:UWIN*:*)
903          echo "$UNAME_MACHINE"-pc-uwin
904          exit ;;
905    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
906          echo x86_64-pc-cygwin
907          exit ;;
908    prep*:SunOS:5.*:*)
909          echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
910          exit ;;
911    *:GNU:*:*)
912          # the GNU system
913          echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
914          exit ;;
915    *:GNU/*:*:*)
916          # other systems with GNU libc and userland
917          echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
918          exit ;;
919    *:Minix:*:*)
920          echo "$UNAME_MACHINE"-unknown-minix
921          exit ;;
922    aarch64:Linux:*:*)
923          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
924          exit ;;
925    aarch64_be:Linux:*:*)
926          UNAME_MACHINE=aarch64_be
927          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
928          exit ;;
929    alpha:Linux:*:*)
930          case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
931            EV5)   UNAME_MACHINE=alphaev5 ;;
932            EV56)  UNAME_MACHINE=alphaev56 ;;
933            PCA56) UNAME_MACHINE=alphapca56 ;;
934            PCA57) UNAME_MACHINE=alphapca56 ;;
935            EV6)   UNAME_MACHINE=alphaev6 ;;
936            EV67)  UNAME_MACHINE=alphaev67 ;;
937            EV68*) UNAME_MACHINE=alphaev68 ;;
938          esac
939          objdump --private-headers /bin/sh | grep -q ld.so.1
940          if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
941          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
942          exit ;;
943    arc:Linux:*:* | arceb:Linux:*:*)
944          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
945          exit ;;
946    arm*:Linux:*:*)
947          set_cc_for_build
948          if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
949              | grep -q __ARM_EABI__
950          then
951              echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
952          else
953              if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
954                    | grep -q __ARM_PCS_VFP
955              then
956                    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
957              else
958                    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
959              fi
960          fi
961          exit ;;
962    avr32*:Linux:*:*)
963          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
964          exit ;;
965    cris:Linux:*:*)
966          echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
967          exit ;;
968    crisv32:Linux:*:*)
969          echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
970          exit ;;
971    e2k:Linux:*:*)
972          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
973          exit ;;
974    frv:Linux:*:*)
975          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
976          exit ;;
977    hexagon:Linux:*:*)
978          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
979          exit ;;
980    i*86:Linux:*:*)
981          echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
982          exit ;;
983    ia64:Linux:*:*)
984          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
985          exit ;;
986    k1om:Linux:*:*)
987          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
988          exit ;;
989    m32r*:Linux:*:*)
990          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
991          exit ;;
992    m68*:Linux:*:*)
993          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
994          exit ;;
995    mips:Linux:*:* | mips64:Linux:*:*)
996          set_cc_for_build
997          IS_GLIBC=0
998          test x"${LIBC}" = xgnu && IS_GLIBC=1
999          sed 's/^  //' << EOF > "$dummy.c"
1000          #undef CPU
1001          #undef mips
1002          #undef mipsel
1003          #undef mips64
1004          #undef mips64el
1005          #if ${IS_GLIBC} && defined(_ABI64)
1006          LIBCABI=gnuabi64
1007          #else
1008          #if ${IS_GLIBC} && defined(_ABIN32)
1009          LIBCABI=gnuabin32
1010          #else
1011          LIBCABI=${LIBC}
1012          #endif
1013          #endif
1014
1015          #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1016          CPU=mipsisa64r6
1017          #else
1018          #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1019          CPU=mipsisa32r6
1020          #else
1021          #if defined(__mips64)
1022          CPU=mips64
1023          #else
1024          CPU=mips
1025          #endif
1026          #endif
1027          #endif
1028
1029          #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1030          MIPS_ENDIAN=el
1031          #else
1032          #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1033          MIPS_ENDIAN=
1034          #else
1035          MIPS_ENDIAN=
1036          #endif
1037          #endif
1038EOF
1039          eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`"
1040          test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1041          ;;
1042    mips64el:Linux:*:*)
1043          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1044          exit ;;
1045    openrisc*:Linux:*:*)
1046          echo or1k-unknown-linux-"$LIBC"
1047          exit ;;
1048    or32:Linux:*:* | or1k*:Linux:*:*)
1049          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1050          exit ;;
1051    padre:Linux:*:*)
1052          echo sparc-unknown-linux-"$LIBC"
1053          exit ;;
1054    parisc64:Linux:*:* | hppa64:Linux:*:*)
1055          echo hppa64-unknown-linux-"$LIBC"
1056          exit ;;
1057    parisc:Linux:*:* | hppa:Linux:*:*)
1058          # Look for CPU level
1059          case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1060            PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
1061            PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
1062            *)    echo hppa-unknown-linux-"$LIBC" ;;
1063          esac
1064          exit ;;
1065    ppc64:Linux:*:*)
1066          echo powerpc64-unknown-linux-"$LIBC"
1067          exit ;;
1068    ppc:Linux:*:*)
1069          echo powerpc-unknown-linux-"$LIBC"
1070          exit ;;
1071    ppc64le:Linux:*:*)
1072          echo powerpc64le-unknown-linux-"$LIBC"
1073          exit ;;
1074    ppcle:Linux:*:*)
1075          echo powerpcle-unknown-linux-"$LIBC"
1076          exit ;;
1077    riscv32:Linux:*:* | riscv64:Linux:*:*)
1078          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1079          exit ;;
1080    s390:Linux:*:* | s390x:Linux:*:*)
1081          echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
1082          exit ;;
1083    sh64*:Linux:*:*)
1084          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1085          exit ;;
1086    sh*:Linux:*:*)
1087          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1088          exit ;;
1089    sparc:Linux:*:* | sparc64:Linux:*:*)
1090          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1091          exit ;;
1092    tile*:Linux:*:*)
1093          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1094          exit ;;
1095    vax:Linux:*:*)
1096          echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
1097          exit ;;
1098    x86_64:Linux:*:*)
1099          echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
1100          exit ;;
1101    xtensa*:Linux:*:*)
1102          echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1103          exit ;;
1104    i*86:DYNIX/ptx:4*:*)
1105          # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1106          # earlier versions are messed up and put the nodename in both
1107          # sysname and nodename.
1108          echo i386-sequent-sysv4
1109          exit ;;
1110    i*86:UNIX_SV:4.2MP:2.*)
1111          # Unixware is an offshoot of SVR4, but it has its own version
1112          # number series starting with 2...
1113          # I am not positive that other SVR4 systems won't match this,
1114          # I just have to hope.  -- rms.
1115          # Use sysv4.2uw... so that sysv4* matches it.
1116          echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
1117          exit ;;
1118    i*86:OS/2:*:*)
1119          # If we were able to find `uname', then EMX Unix compatibility
1120          # is probably installed.
1121          echo "$UNAME_MACHINE"-pc-os2-emx
1122          exit ;;
1123    i*86:XTS-300:*:STOP)
1124          echo "$UNAME_MACHINE"-unknown-stop
1125          exit ;;
1126    i*86:atheos:*:*)
1127          echo "$UNAME_MACHINE"-unknown-atheos
1128          exit ;;
1129    i*86:syllable:*:*)
1130          echo "$UNAME_MACHINE"-pc-syllable
1131          exit ;;
1132    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1133          echo i386-unknown-lynxos"$UNAME_RELEASE"
1134          exit ;;
1135    i*86:*DOS:*:*)
1136          echo "$UNAME_MACHINE"-pc-msdosdjgpp
1137          exit ;;
1138    i*86:*:4.*:*)
1139          UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1140          if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1141                    echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
1142          else
1143                    echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
1144          fi
1145          exit ;;
1146    i*86:*:5:[678]*)
1147          # UnixWare 7.x, OpenUNIX and OpenServer 6.
1148          case `/bin/uname -X | grep "^Machine"` in
1149              *486*)               UNAME_MACHINE=i486 ;;
1150              *Pentium)            UNAME_MACHINE=i586 ;;
1151              *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1152          esac
1153          echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}"
1154          exit ;;
1155    i*86:*:3.2:*)
1156          if test -f /usr/options/cb.name; then
1157                    UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1158                    echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
1159          elif /bin/uname -X 2>/dev/null >/dev/null ; then
1160                    UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1161                    (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1162                    (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1163                              && UNAME_MACHINE=i586
1164                    (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1165                              && UNAME_MACHINE=i686
1166                    (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1167                              && UNAME_MACHINE=i686
1168                    echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
1169          else
1170                    echo "$UNAME_MACHINE"-pc-sysv32
1171          fi
1172          exit ;;
1173    pc:*:*:*)
1174          # Left here for compatibility:
1175          # uname -m prints for DJGPP always 'pc', but it prints nothing about
1176          # the processor, so we play safe by assuming i586.
1177          # Note: whatever this is, it MUST be the same as what config.sub
1178          # prints for the "djgpp" host, or else GDB configure will decide that
1179          # this is a cross-build.
1180          echo i586-pc-msdosdjgpp
1181          exit ;;
1182    Intel:Mach:3*:*)
1183          echo i386-pc-mach3
1184          exit ;;
1185    paragon:*:*:*)
1186          echo i860-intel-osf1
1187          exit ;;
1188    i860:*:4.*:*) # i860-SVR4
1189          if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1190            echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
1191          else # Add other i860-SVR4 vendors below as they are discovered.
1192            echo i860-unknown-sysv"$UNAME_RELEASE"  # Unknown i860-SVR4
1193          fi
1194          exit ;;
1195    mini*:CTIX:SYS*5:*)
1196          # "miniframe"
1197          echo m68010-convergent-sysv
1198          exit ;;
1199    mc68k:UNIX:SYSTEM5:3.51m)
1200          echo m68k-convergent-sysv
1201          exit ;;
1202    M680?0:D-NIX:5.3:*)
1203          echo m68k-diab-dnix
1204          exit ;;
1205    M68*:*:R3V[5678]*:*)
1206          test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1207    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
1208          OS_REL=''
1209          test -r /etc/.relid \
1210          && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1211          /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1212            && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1213          /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1214            && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1215    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1216          /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1217            && { echo i486-ncr-sysv4; exit; } ;;
1218    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1219          OS_REL='.3'
1220          test -r /etc/.relid \
1221              && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1222          /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1223              && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1224          /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1225              && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1226          /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1227              && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1228    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1229          echo m68k-unknown-lynxos"$UNAME_RELEASE"
1230          exit ;;
1231    mc68030:UNIX_System_V:4.*:*)
1232          echo m68k-atari-sysv4
1233          exit ;;
1234    TSUNAMI:LynxOS:2.*:*)
1235          echo sparc-unknown-lynxos"$UNAME_RELEASE"
1236          exit ;;
1237    rs6000:LynxOS:2.*:*)
1238          echo rs6000-unknown-lynxos"$UNAME_RELEASE"
1239          exit ;;
1240    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1241          echo powerpc-unknown-lynxos"$UNAME_RELEASE"
1242          exit ;;
1243    SM[BE]S:UNIX_SV:*:*)
1244          echo mips-dde-sysv"$UNAME_RELEASE"
1245          exit ;;
1246    RM*:ReliantUNIX-*:*:*)
1247          echo mips-sni-sysv4
1248          exit ;;
1249    RM*:SINIX-*:*:*)
1250          echo mips-sni-sysv4
1251          exit ;;
1252    *:SINIX-*:*:*)
1253          if uname -p 2>/dev/null >/dev/null ; then
1254                    UNAME_MACHINE=`(uname -p) 2>/dev/null`
1255                    echo "$UNAME_MACHINE"-sni-sysv4
1256          else
1257                    echo ns32k-sni-sysv
1258          fi
1259          exit ;;
1260    PENTIUM:*:4.0*:*)         # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1261                              # says <Richard.M.Bartel@ccMail.Census.GOV>
1262          echo i586-unisys-sysv4
1263          exit ;;
1264    *:UNIX_System_V:4*:FTX*)
1265          # From Gerald Hewes <hewes@openmarket.com>.
1266          # How about differentiating between stratus architectures? -djm
1267          echo hppa1.1-stratus-sysv4
1268          exit ;;
1269    *:*:*:FTX*)
1270          # From seanf@swdc.stratus.com.
1271          echo i860-stratus-sysv4
1272          exit ;;
1273    i*86:VOS:*:*)
1274          # From Paul.Green@stratus.com.
1275          echo "$UNAME_MACHINE"-stratus-vos
1276          exit ;;
1277    *:VOS:*:*)
1278          # From Paul.Green@stratus.com.
1279          echo hppa1.1-stratus-vos
1280          exit ;;
1281    mc68*:A/UX:*:*)
1282          echo m68k-apple-aux"$UNAME_RELEASE"
1283          exit ;;
1284    news*:NEWS-OS:6*:*)
1285          echo mips-sony-newsos6
1286          exit ;;
1287    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1288          if [ -d /usr/nec ]; then
1289                    echo mips-nec-sysv"$UNAME_RELEASE"
1290          else
1291                    echo mips-unknown-sysv"$UNAME_RELEASE"
1292          fi
1293          exit ;;
1294    BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
1295          echo powerpc-be-beos
1296          exit ;;
1297    BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
1298          echo powerpc-apple-beos
1299          exit ;;
1300    BePC:BeOS:*:*)  # BeOS running on Intel PC compatible.
1301          echo i586-pc-beos
1302          exit ;;
1303    BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
1304          echo i586-pc-haiku
1305          exit ;;
1306    x86_64:Haiku:*:*)
1307          echo x86_64-unknown-haiku
1308          exit ;;
1309    SX-4:SUPER-UX:*:*)
1310          echo sx4-nec-superux"$UNAME_RELEASE"
1311          exit ;;
1312    SX-5:SUPER-UX:*:*)
1313          echo sx5-nec-superux"$UNAME_RELEASE"
1314          exit ;;
1315    SX-6:SUPER-UX:*:*)
1316          echo sx6-nec-superux"$UNAME_RELEASE"
1317          exit ;;
1318    SX-7:SUPER-UX:*:*)
1319          echo sx7-nec-superux"$UNAME_RELEASE"
1320          exit ;;
1321    SX-8:SUPER-UX:*:*)
1322          echo sx8-nec-superux"$UNAME_RELEASE"
1323          exit ;;
1324    SX-8R:SUPER-UX:*:*)
1325          echo sx8r-nec-superux"$UNAME_RELEASE"
1326          exit ;;
1327    SX-ACE:SUPER-UX:*:*)
1328          echo sxace-nec-superux"$UNAME_RELEASE"
1329          exit ;;
1330    Power*:Rhapsody:*:*)
1331          echo powerpc-apple-rhapsody"$UNAME_RELEASE"
1332          exit ;;
1333    *:Rhapsody:*:*)
1334          echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
1335          exit ;;
1336    *:Darwin:*:*)
1337          UNAME_PROCESSOR=`uname -p`
1338          case $UNAME_PROCESSOR in
1339              unknown) UNAME_PROCESSOR=powerpc ;;
1340          esac
1341          if command -v xcode-select > /dev/null 2> /dev/null && \
1342                    ! xcode-select --print-path > /dev/null 2> /dev/null ; then
1343              # Avoid executing cc if there is no toolchain installed as
1344              # cc will be a stub that puts up a graphical alert
1345              # prompting the user to install developer tools.
1346              CC_FOR_BUILD=no_compiler_found
1347          else
1348              set_cc_for_build
1349          fi
1350          if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
1351              if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1352                       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1353                       grep IS_64BIT_ARCH >/dev/null
1354              then
1355                    case $UNAME_PROCESSOR in
1356                        i386) UNAME_PROCESSOR=x86_64 ;;
1357                        powerpc) UNAME_PROCESSOR=powerpc64 ;;
1358                    esac
1359              fi
1360              # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1361              if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1362                       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1363                       grep IS_PPC >/dev/null
1364              then
1365                    UNAME_PROCESSOR=powerpc
1366              fi
1367          elif test "$UNAME_PROCESSOR" = i386 ; then
1368              # uname -m returns i386 or x86_64
1369              UNAME_PROCESSOR=$UNAME_MACHINE
1370          fi
1371          echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
1372          exit ;;
1373    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1374          UNAME_PROCESSOR=`uname -p`
1375          if test "$UNAME_PROCESSOR" = x86; then
1376                    UNAME_PROCESSOR=i386
1377                    UNAME_MACHINE=pc
1378          fi
1379          echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
1380          exit ;;
1381    *:QNX:*:4*)
1382          echo i386-pc-qnx
1383          exit ;;
1384    NEO-*:NONSTOP_KERNEL:*:*)
1385          echo neo-tandem-nsk"$UNAME_RELEASE"
1386          exit ;;
1387    NSE-*:NONSTOP_KERNEL:*:*)
1388          echo nse-tandem-nsk"$UNAME_RELEASE"
1389          exit ;;
1390    NSR-*:NONSTOP_KERNEL:*:*)
1391          echo nsr-tandem-nsk"$UNAME_RELEASE"
1392          exit ;;
1393    NSV-*:NONSTOP_KERNEL:*:*)
1394          echo nsv-tandem-nsk"$UNAME_RELEASE"
1395          exit ;;
1396    NSX-*:NONSTOP_KERNEL:*:*)
1397          echo nsx-tandem-nsk"$UNAME_RELEASE"
1398          exit ;;
1399    *:NonStop-UX:*:*)
1400          echo mips-compaq-nonstopux
1401          exit ;;
1402    BS2000:POSIX*:*:*)
1403          echo bs2000-siemens-sysv
1404          exit ;;
1405    DS/*:UNIX_System_V:*:*)
1406          echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
1407          exit ;;
1408    *:Plan9:*:*)
1409          # "uname -m" is not consistent, so use $cputype instead. 386
1410          # is converted to i386 for consistency with other x86
1411          # operating systems.
1412          # shellcheck disable=SC2154
1413          if test "$cputype" = 386; then
1414              UNAME_MACHINE=i386
1415          else
1416              UNAME_MACHINE="$cputype"
1417          fi
1418          echo "$UNAME_MACHINE"-unknown-plan9
1419          exit ;;
1420    *:TOPS-10:*:*)
1421          echo pdp10-unknown-tops10
1422          exit ;;
1423    *:TENEX:*:*)
1424          echo pdp10-unknown-tenex
1425          exit ;;
1426    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1427          echo pdp10-dec-tops20
1428          exit ;;
1429    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1430          echo pdp10-xkl-tops20
1431          exit ;;
1432    *:TOPS-20:*:*)
1433          echo pdp10-unknown-tops20
1434          exit ;;
1435    *:ITS:*:*)
1436          echo pdp10-unknown-its
1437          exit ;;
1438    SEI:*:*:SEIUX)
1439          echo mips-sei-seiux"$UNAME_RELEASE"
1440          exit ;;
1441    *:DragonFly:*:*)
1442          echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
1443          exit ;;
1444    *:*VMS:*:*)
1445          UNAME_MACHINE=`(uname -p) 2>/dev/null`
1446          case "$UNAME_MACHINE" in
1447              A*) echo alpha-dec-vms ; exit ;;
1448              I*) echo ia64-dec-vms ; exit ;;
1449              V*) echo vax-dec-vms ; exit ;;
1450          esac ;;
1451    *:XENIX:*:SysV)
1452          echo i386-pc-xenix
1453          exit ;;
1454    i*86:skyos:*:*)
1455          echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
1456          exit ;;
1457    i*86:rdos:*:*)
1458          echo "$UNAME_MACHINE"-pc-rdos
1459          exit ;;
1460    i*86:AROS:*:*)
1461          echo "$UNAME_MACHINE"-pc-aros
1462          exit ;;
1463    x86_64:VMkernel:*:*)
1464          echo "$UNAME_MACHINE"-unknown-esx
1465          exit ;;
1466    amd64:Isilon\ OneFS:*:*)
1467          echo x86_64-unknown-onefs
1468          exit ;;
1469    *:Unleashed:*:*)
1470          echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
1471          exit ;;
1472esac
1473
1474# No uname command or uname output not recognized.
1475set_cc_for_build
1476cat > "$dummy.c" <<EOF
1477#ifdef _SEQUENT_
1478#include <sys/types.h>
1479#include <sys/utsname.h>
1480#endif
1481#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1482#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1483#include <signal.h>
1484#if defined(_SIZE_T_) || defined(SIGLOST)
1485#include <sys/utsname.h>
1486#endif
1487#endif
1488#endif
1489main ()
1490{
1491#if defined (sony)
1492#if defined (MIPSEB)
1493  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1494     I don't know....  */
1495  printf ("mips-sony-bsd\n"); exit (0);
1496#else
1497#include <sys/param.h>
1498  printf ("m68k-sony-newsos%s\n",
1499#ifdef NEWSOS4
1500  "4"
1501#else
1502  ""
1503#endif
1504  ); exit (0);
1505#endif
1506#endif
1507
1508#if defined (NeXT)
1509#if !defined (__ARCHITECTURE__)
1510#define __ARCHITECTURE__ "m68k"
1511#endif
1512  int version;
1513  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1514  if (version < 4)
1515    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1516  else
1517    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1518  exit (0);
1519#endif
1520
1521#if defined (MULTIMAX) || defined (n16)
1522#if defined (UMAXV)
1523  printf ("ns32k-encore-sysv\n"); exit (0);
1524#else
1525#if defined (CMU)
1526  printf ("ns32k-encore-mach\n"); exit (0);
1527#else
1528  printf ("ns32k-encore-bsd\n"); exit (0);
1529#endif
1530#endif
1531#endif
1532
1533#if defined (__386BSD__)
1534  printf ("i386-pc-bsd\n"); exit (0);
1535#endif
1536
1537#if defined (sequent)
1538#if defined (i386)
1539  printf ("i386-sequent-dynix\n"); exit (0);
1540#endif
1541#if defined (ns32000)
1542  printf ("ns32k-sequent-dynix\n"); exit (0);
1543#endif
1544#endif
1545
1546#if defined (_SEQUENT_)
1547  struct utsname un;
1548
1549  uname(&un);
1550  if (strncmp(un.version, "V2", 2) == 0) {
1551    printf ("i386-sequent-ptx2\n"); exit (0);
1552  }
1553  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1554    printf ("i386-sequent-ptx1\n"); exit (0);
1555  }
1556  printf ("i386-sequent-ptx\n"); exit (0);
1557#endif
1558
1559#if defined (vax)
1560#if !defined (ultrix)
1561#include <sys/param.h>
1562#if defined (BSD)
1563#if BSD == 43
1564  printf ("vax-dec-bsd4.3\n"); exit (0);
1565#else
1566#if BSD == 199006
1567  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1568#else
1569  printf ("vax-dec-bsd\n"); exit (0);
1570#endif
1571#endif
1572#else
1573  printf ("vax-dec-bsd\n"); exit (0);
1574#endif
1575#else
1576#if defined(_SIZE_T_) || defined(SIGLOST)
1577  struct utsname un;
1578  uname (&un);
1579  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1580#else
1581  printf ("vax-dec-ultrix\n"); exit (0);
1582#endif
1583#endif
1584#endif
1585#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1586#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1587#if defined(_SIZE_T_) || defined(SIGLOST)
1588  struct utsname *un;
1589  uname (&un);
1590  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1591#else
1592  printf ("mips-dec-ultrix\n"); exit (0);
1593#endif
1594#endif
1595#endif
1596
1597#if defined (alliant) && defined (i860)
1598  printf ("i860-alliant-bsd\n"); exit (0);
1599#endif
1600
1601  exit (1);
1602}
1603EOF
1604
1605$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1606          { echo "$SYSTEM_NAME"; exit; }
1607
1608# Apollos put the system type in the environment.
1609test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1610
1611echo "$0: unable to guess system type" >&2
1612
1613case "$UNAME_MACHINE:$UNAME_SYSTEM" in
1614    mips:Linux | mips64:Linux)
1615          # If we got here on MIPS GNU/Linux, output extra information.
1616          cat >&2 <<EOF
1617
1618NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1619the system type. Please install a C compiler and try again.
1620EOF
1621          ;;
1622esac
1623
1624cat >&2 <<EOF
1625
1626This script (version $timestamp), has failed to recognize the
1627operating system you are using. If your script is old, overwrite *all*
1628copies of config.guess and config.sub with the latest versions from:
1629
1630  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
1631and
1632  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
1633
1634If $0 has already been updated, send the following data and any
1635information you think might be pertinent to config-patches@gnu.org to
1636provide the necessary information to handle your system.
1637
1638config.guess timestamp = $timestamp
1639
1640uname -m = `(uname -m) 2>/dev/null || echo unknown`
1641uname -r = `(uname -r) 2>/dev/null || echo unknown`
1642uname -s = `(uname -s) 2>/dev/null || echo unknown`
1643uname -v = `(uname -v) 2>/dev/null || echo unknown`
1644
1645/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1646/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1647
1648hostinfo               = `(hostinfo) 2>/dev/null`
1649/bin/universe          = `(/bin/universe) 2>/dev/null`
1650/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1651/bin/arch              = `(/bin/arch) 2>/dev/null`
1652/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1653/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1654
1655UNAME_MACHINE = "$UNAME_MACHINE"
1656UNAME_RELEASE = "$UNAME_RELEASE"
1657UNAME_SYSTEM  = "$UNAME_SYSTEM"
1658UNAME_VERSION = "$UNAME_VERSION"
1659EOF
1660
1661exit 1
1662
1663# Local variables:
1664# eval: (add-hook 'before-save-hook 'time-stamp)
1665# time-stamp-start: "timestamp='"
1666# time-stamp-format: "%:y-%02m-%02d"
1667# time-stamp-end: "'"
1668# End:
1669