Back to home page

Wine source

 
 

    


File indexing completed on 2023-11-24 23:29:37

87f48fcc7 Patr*0001 #! /bin/sh
                0002 # Configuration validation subroutine script.
3aca59945 Alex*0003 #   Copyright 1992-2023 Free Software Foundation, Inc.
87f48fcc7 Patr*0004 
b9f6d1be0 Alex*0005 # shellcheck disable=SC2006,SC2268 # see below for rationale
                0006 
3aca59945 Alex*0007 timestamp='2023-09-19'
87f48fcc7 Patr*0008 
bd72767ee Andr*0009 # This file is free software; you can redistribute it and/or modify it
                0010 # under the terms of the GNU General Public License as published by
3aca59945 Alex*0011 # the Free Software Foundation, either version 3 of the License, or
87f48fcc7 Patr*0012 # (at your option) any later version.
                0013 #
bd72767ee Andr*0014 # This program is distributed in the hope that it will be useful, but
                0015 # WITHOUT ANY WARRANTY; without even the implied warranty of
                0016 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
                0017 # General Public License for more details.
87f48fcc7 Patr*0018 #
                0019 # You should have received a copy of the GNU General Public License
f6a1b37d1 Alex*0020 # along with this program; if not, see <https://www.gnu.org/licenses/>.
5c0dde779 Alex*0021 #
87f48fcc7 Patr*0022 # As a special exception to the GNU General Public License, if you
                0023 # distribute this file as part of a program that contains a
                0024 # configuration script generated by Autoconf, you may include it under
bd72767ee Andr*0025 # the same distribution terms that you use for the rest of that
                0026 # program.  This Exception is an additional permission under section 7
                0027 # of the GNU General Public License, version 3 ("GPLv3").
87f48fcc7 Patr*0028 
5c0dde779 Alex*0029 
bf6c3a122 Alex*0030 # Please send patches to <config-patches@gnu.org>.
87f48fcc7 Patr*0031 #
                0032 # Configuration subroutine to validate and canonicalize a configuration type.
                0033 # Supply the specified configuration type as an argument.
                0034 # If it is invalid, we print an error message on stderr and exit with code 1.
                0035 # Otherwise, we print the canonical config type on stdout and succeed.
                0036 
f00b8b9c1 Wolf*0037 # You can get the latest version of this script from:
b9f6d1be0 Alex*0038 # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
f00b8b9c1 Wolf*0039 
87f48fcc7 Patr*0040 # This file is supposed to be the same for all GNU packages
                0041 # and recognize all the CPU types, system types and aliases
                0042 # that are meaningful with *any* GNU software.
                0043 # Each package is responsible for reporting which valid configurations
                0044 # it does not support.  The user should be able to distinguish
                0045 # a failure to support a valid configuration from a meaningless
                0046 # configuration.
                0047 
                0048 # The goal of this file is to map all the various variations of a given
                0049 # machine specification into a single specification in the form:
                0050 #       CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
                0051 # or in some cases, the newer four-part form:
                0052 #       CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
                0053 # It is wrong to echo any other type of specification.
                0054 
b9f6d1be0 Alex*0055 # The "shellcheck disable" line above the timestamp inhibits complaints
                0056 # about features and limitations of the classic Bourne shell that were
                0057 # superseded or lifted in POSIX.  However, this script identifies a wide
                0058 # variety of pre-POSIX systems that do not have POSIX shells at all, and
                0059 # even some reasonably current systems (Solaris 10 as case-in-point) still
                0060 # have a pre-POSIX /bin/sh.
                0061 
87f48fcc7 Patr*0062 me=`echo "$0" | sed -e 's,.*/,,'`
                0063 
                0064 usage="\
f6a1b37d1 Alex*0065 Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
87f48fcc7 Patr*0066 
                0067 Canonicalize a configuration name.
                0068 
f6a1b37d1 Alex*0069 Options:
87f48fcc7 Patr*0070   -h, --help         print this help, then exit
                0071   -t, --time-stamp   print date of last modification, then exit
                0072   -v, --version      print version number, then exit
                0073 
                0074 Report bugs and patches to <config-patches@gnu.org>."
                0075 
                0076 version="\
                0077 GNU config.sub ($timestamp)
                0078 
3aca59945 Alex*0079 Copyright 1992-2023 Free Software Foundation, Inc.
87f48fcc7 Patr*0080 
                0081 This is free software; see the source for copying conditions.  There is NO
                0082 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
                0083 
                0084 help="
3aca59945 Alex*0085 Try '$me --help' for more information."
87f48fcc7 Patr*0086 
                0087 # Parse command line
                0088 while test $# -gt 0 ; do
                0089   case $1 in
                0090     --time-stamp | --time* | -t )
5c0dde779 Alex*0091        echo "$timestamp" ; exit ;;
87f48fcc7 Patr*0092     --version | -v )
5c0dde779 Alex*0093        echo "$version" ; exit ;;
87f48fcc7 Patr*0094     --help | --h* | -h )
5c0dde779 Alex*0095        echo "$usage"; exit ;;
87f48fcc7 Patr*0096     -- )     # Stop option processing
                0097        shift; break ;;
                0098     - ) # Use stdin as input.
                0099        break ;;
                0100     -* )
11bb6deb0 Mart*0101        echo "$me: invalid option $1$help" >&2
87f48fcc7 Patr*0102        exit 1 ;;
                0103 
                0104     *local*)
                0105        # First pass through any local machine types.
f6a1b37d1 Alex*0106        echo "$1"
5c0dde779 Alex*0107        exit ;;
87f48fcc7 Patr*0108 
                0109     * )
                0110        break ;;
                0111   esac
                0112 done
                0113 
                0114 case $# in
                0115  0) echo "$me: missing argument$help" >&2
                0116     exit 1;;
                0117  1) ;;
                0118  *) echo "$me: too many arguments$help" >&2
                0119     exit 1;;
                0120 esac
                0121 
11bb6deb0 Mart*0122 # Split fields of configuration type
                0123 # shellcheck disable=SC2162
b9f6d1be0 Alex*0124 saved_IFS=$IFS
11bb6deb0 Mart*0125 IFS="-" read field1 field2 field3 field4 <<EOF
                0126 $1
                0127 EOF
b9f6d1be0 Alex*0128 IFS=$saved_IFS
87f48fcc7 Patr*0129 
11bb6deb0 Mart*0130 # Separate into logical components for further validation
                0131 case $1 in
                0132         *-*-*-*-*)
3aca59945 Alex*0133                 echo "Invalid configuration '$1': more than four components" >&2
11bb6deb0 Mart*0134                 exit 1
bd72767ee Andr*0135                 ;;
11bb6deb0 Mart*0136         *-*-*-*)
                0137                 basic_machine=$field1-$field2
                0138                 basic_os=$field3-$field4
87f48fcc7 Patr*0139                 ;;
11bb6deb0 Mart*0140         *-*-*)
                0141                 # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
                0142                 # parts
                0143                 maybe_os=$field2-$field3
                0144                 case $maybe_os in
                0145                         nto-qnx* | linux-* | uclinux-uclibc* \
                0146                         | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
                0147                         | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
3aca59945 Alex*0148                         | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \
                0149                         | windows-* )
11bb6deb0 Mart*0150                                 basic_machine=$field1
                0151                                 basic_os=$maybe_os
                0152                                 ;;
                0153                         android-linux)
                0154                                 basic_machine=$field1-unknown
                0155                                 basic_os=linux-android
                0156                                 ;;
                0157                         *)
                0158                                 basic_machine=$field1-$field2
                0159                                 basic_os=$field3
                0160                                 ;;
                0161                 esac
87f48fcc7 Patr*0162                 ;;
11bb6deb0 Mart*0163         *-*)
                0164                 # A lone config we happen to match not fitting any pattern
                0165                 case $field1-$field2 in
                0166                         decstation-3100)
                0167                                 basic_machine=mips-dec
                0168                                 basic_os=
                0169                                 ;;
                0170                         *-*)
                0171                                 # Second component is usually, but not always the OS
                0172                                 case $field2 in
                0173                                         # Prevent following clause from handling this valid os
                0174                                         sun*os*)
                0175                                                 basic_machine=$field1
                0176                                                 basic_os=$field2
                0177                                                 ;;
b9f6d1be0 Alex*0178                                         zephyr*)
                0179                                                 basic_machine=$field1-unknown
                0180                                                 basic_os=$field2
                0181                                                 ;;
11bb6deb0 Mart*0182                                         # Manufacturers
                0183                                         dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
                0184                                         | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
                0185                                         | unicom* | ibm* | next | hp | isi* | apollo | altos* \
                0186                                         | convergent* | ncr* | news | 32* | 3600* | 3100* \
                0187                                         | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
                0188                                         | ultra | tti* | harris | dolphin | highlevel | gould \
                0189                                         | cbm | ns | masscomp | apple | axis | knuth | cray \
                0190                                         | microblaze* | sim | cisco \
                0191                                         | oki | wec | wrs | winbond)
                0192                                                 basic_machine=$field1-$field2
                0193                                                 basic_os=
                0194                                                 ;;
                0195                                         *)
                0196                                                 basic_machine=$field1
                0197                                                 basic_os=$field2
                0198                                                 ;;
                0199                                 esac
                0200                         ;;
                0201                 esac
87f48fcc7 Patr*0202                 ;;
11bb6deb0 Mart*0203         *)
                0204                 # Convert single-component short-hands not valid as part of
                0205                 # multi-component configurations.
                0206                 case $field1 in
                0207                         386bsd)
                0208                                 basic_machine=i386-pc
                0209                                 basic_os=bsd
                0210                                 ;;
                0211                         a29khif)
                0212                                 basic_machine=a29k-amd
                0213                                 basic_os=udi
                0214                                 ;;
                0215                         adobe68k)
                0216                                 basic_machine=m68010-adobe
                0217                                 basic_os=scout
                0218                                 ;;
                0219                         alliant)
                0220                                 basic_machine=fx80-alliant
                0221                                 basic_os=
                0222                                 ;;
                0223                         altos | altos3068)
                0224                                 basic_machine=m68k-altos
                0225                                 basic_os=
                0226                                 ;;
                0227                         am29k)
                0228                                 basic_machine=a29k-none
                0229                                 basic_os=bsd
                0230                                 ;;
                0231                         amdahl)
                0232                                 basic_machine=580-amdahl
                0233                                 basic_os=sysv
                0234                                 ;;
                0235                         amiga)
                0236                                 basic_machine=m68k-unknown
                0237                                 basic_os=
                0238                                 ;;
                0239                         amigaos | amigados)
                0240                                 basic_machine=m68k-unknown
                0241                                 basic_os=amigaos
                0242                                 ;;
                0243                         amigaunix | amix)
                0244                                 basic_machine=m68k-unknown
                0245                                 basic_os=sysv4
                0246                                 ;;
                0247                         apollo68)
                0248                                 basic_machine=m68k-apollo
                0249                                 basic_os=sysv
                0250                                 ;;
                0251                         apollo68bsd)
                0252                                 basic_machine=m68k-apollo
                0253                                 basic_os=bsd
                0254                                 ;;
                0255                         aros)
                0256                                 basic_machine=i386-pc
                0257                                 basic_os=aros
                0258                                 ;;
                0259                         aux)
                0260                                 basic_machine=m68k-apple
                0261                                 basic_os=aux
                0262                                 ;;
                0263                         balance)
                0264                                 basic_machine=ns32k-sequent
                0265                                 basic_os=dynix
                0266                                 ;;
                0267                         blackfin)
                0268                                 basic_machine=bfin-unknown
                0269                                 basic_os=linux
                0270                                 ;;
                0271                         cegcc)
                0272                                 basic_machine=arm-unknown
                0273                                 basic_os=cegcc
                0274                                 ;;
                0275                         convex-c1)
                0276                                 basic_machine=c1-convex
                0277                                 basic_os=bsd
                0278                                 ;;
                0279                         convex-c2)
                0280                                 basic_machine=c2-convex
                0281                                 basic_os=bsd
                0282                                 ;;
                0283                         convex-c32)
                0284                                 basic_machine=c32-convex
                0285                                 basic_os=bsd
                0286                                 ;;
                0287                         convex-c34)
                0288                                 basic_machine=c34-convex
                0289                                 basic_os=bsd
                0290                                 ;;
                0291                         convex-c38)
                0292                                 basic_machine=c38-convex
                0293                                 basic_os=bsd
                0294                                 ;;
                0295                         cray)
                0296                                 basic_machine=j90-cray
                0297                                 basic_os=unicos
                0298                                 ;;
                0299                         crds | unos)
                0300                                 basic_machine=m68k-crds
                0301                                 basic_os=
                0302                                 ;;
                0303                         da30)
                0304                                 basic_machine=m68k-da30
                0305                                 basic_os=
                0306                                 ;;
                0307                         decstation | pmax | pmin | dec3100 | decstatn)
                0308                                 basic_machine=mips-dec
                0309                                 basic_os=
                0310                                 ;;
                0311                         delta88)
                0312                                 basic_machine=m88k-motorola
                0313                                 basic_os=sysv3
                0314                                 ;;
                0315                         dicos)
                0316                                 basic_machine=i686-pc
                0317                                 basic_os=dicos
                0318                                 ;;
                0319                         djgpp)
                0320                                 basic_machine=i586-pc
                0321                                 basic_os=msdosdjgpp
                0322                                 ;;
                0323                         ebmon29k)
                0324                                 basic_machine=a29k-amd
                0325                                 basic_os=ebmon
                0326                                 ;;
                0327                         es1800 | OSE68k | ose68k | ose | OSE)
                0328                                 basic_machine=m68k-ericsson
                0329                                 basic_os=ose
                0330                                 ;;
                0331                         gmicro)
                0332                                 basic_machine=tron-gmicro
                0333                                 basic_os=sysv
                0334                                 ;;
                0335                         go32)
                0336                                 basic_machine=i386-pc
                0337                                 basic_os=go32
                0338                                 ;;
                0339                         h8300hms)
                0340                                 basic_machine=h8300-hitachi
                0341                                 basic_os=hms
                0342                                 ;;
                0343                         h8300xray)
                0344                                 basic_machine=h8300-hitachi
                0345                                 basic_os=xray
                0346                                 ;;
                0347                         h8500hms)
                0348                                 basic_machine=h8500-hitachi
                0349                                 basic_os=hms
                0350                                 ;;
                0351                         harris)
                0352                                 basic_machine=m88k-harris
                0353                                 basic_os=sysv3
                0354                                 ;;
                0355                         hp300 | hp300hpux)
                0356                                 basic_machine=m68k-hp
                0357                                 basic_os=hpux
                0358                                 ;;
                0359                         hp300bsd)
                0360                                 basic_machine=m68k-hp
                0361                                 basic_os=bsd
                0362                                 ;;
                0363                         hppaosf)
                0364                                 basic_machine=hppa1.1-hp
                0365                                 basic_os=osf
                0366                                 ;;
                0367                         hppro)
                0368                                 basic_machine=hppa1.1-hp
                0369                                 basic_os=proelf
                0370                                 ;;
                0371                         i386mach)
                0372                                 basic_machine=i386-mach
                0373                                 basic_os=mach
                0374                                 ;;
                0375                         isi68 | isi)
                0376                                 basic_machine=m68k-isi
                0377                                 basic_os=sysv
                0378                                 ;;
                0379                         m68knommu)
                0380                                 basic_machine=m68k-unknown
                0381                                 basic_os=linux
                0382                                 ;;
                0383                         magnum | m3230)
                0384                                 basic_machine=mips-mips
                0385                                 basic_os=sysv
                0386                                 ;;
                0387                         merlin)
                0388                                 basic_machine=ns32k-utek
                0389                                 basic_os=sysv
                0390                                 ;;
                0391                         mingw64)
                0392                                 basic_machine=x86_64-pc
                0393                                 basic_os=mingw64
                0394                                 ;;
                0395                         mingw32)
                0396                                 basic_machine=i686-pc
                0397                                 basic_os=mingw32
                0398                                 ;;
                0399                         mingw32ce)
                0400                                 basic_machine=arm-unknown
                0401                                 basic_os=mingw32ce
                0402                                 ;;
                0403                         monitor)
                0404                                 basic_machine=m68k-rom68k
                0405                                 basic_os=coff
                0406                                 ;;
                0407                         morphos)
                0408                                 basic_machine=powerpc-unknown
                0409                                 basic_os=morphos
                0410                                 ;;
                0411                         moxiebox)
                0412                                 basic_machine=moxie-unknown
                0413                                 basic_os=moxiebox
                0414                                 ;;
                0415                         msdos)
                0416                                 basic_machine=i386-pc
                0417                                 basic_os=msdos
                0418                                 ;;
                0419                         msys)
                0420                                 basic_machine=i686-pc
                0421                                 basic_os=msys
                0422                                 ;;
                0423                         mvs)
                0424                                 basic_machine=i370-ibm
                0425                                 basic_os=mvs
                0426                                 ;;
                0427                         nacl)
                0428                                 basic_machine=le32-unknown
                0429                                 basic_os=nacl
                0430                                 ;;
                0431                         ncr3000)
                0432                                 basic_machine=i486-ncr
                0433                                 basic_os=sysv4
                0434                                 ;;
                0435                         netbsd386)
                0436                                 basic_machine=i386-pc
                0437                                 basic_os=netbsd
                0438                                 ;;
                0439                         netwinder)
                0440                                 basic_machine=armv4l-rebel
                0441                                 basic_os=linux
                0442                                 ;;
                0443                         news | news700 | news800 | news900)
                0444                                 basic_machine=m68k-sony
                0445                                 basic_os=newsos
                0446                                 ;;
                0447                         news1000)
                0448                                 basic_machine=m68030-sony
                0449                                 basic_os=newsos
                0450                                 ;;
                0451                         necv70)
                0452                                 basic_machine=v70-nec
                0453                                 basic_os=sysv
                0454                                 ;;
                0455                         nh3000)
                0456                                 basic_machine=m68k-harris
                0457                                 basic_os=cxux
                0458                                 ;;
                0459                         nh[45]000)
                0460                                 basic_machine=m88k-harris
                0461                                 basic_os=cxux
                0462                                 ;;
                0463                         nindy960)
                0464                                 basic_machine=i960-intel
                0465                                 basic_os=nindy
                0466                                 ;;
                0467                         mon960)
                0468                                 basic_machine=i960-intel
                0469                                 basic_os=mon960
                0470                                 ;;
                0471                         nonstopux)
                0472                                 basic_machine=mips-compaq
                0473                                 basic_os=nonstopux
                0474                                 ;;
                0475                         os400)
                0476                                 basic_machine=powerpc-ibm
                0477                                 basic_os=os400
                0478                                 ;;
                0479                         OSE68000 | ose68000)
                0480                                 basic_machine=m68000-ericsson
                0481                                 basic_os=ose
                0482                                 ;;
                0483                         os68k)
                0484                                 basic_machine=m68k-none
                0485                                 basic_os=os68k
                0486                                 ;;
                0487                         paragon)
                0488                                 basic_machine=i860-intel
                0489                                 basic_os=osf
                0490                                 ;;
                0491                         parisc)
                0492                                 basic_machine=hppa-unknown
                0493                                 basic_os=linux
                0494                                 ;;
                0495                         psp)
                0496                                 basic_machine=mipsallegrexel-sony
                0497                                 basic_os=psp
                0498                                 ;;
                0499                         pw32)
                0500                                 basic_machine=i586-unknown
                0501                                 basic_os=pw32
                0502                                 ;;
                0503                         rdos | rdos64)
                0504                                 basic_machine=x86_64-pc
                0505                                 basic_os=rdos
                0506                                 ;;
                0507                         rdos32)
                0508                                 basic_machine=i386-pc
                0509                                 basic_os=rdos
                0510                                 ;;
                0511                         rom68k)
                0512                                 basic_machine=m68k-rom68k
                0513                                 basic_os=coff
                0514                                 ;;
                0515                         sa29200)
                0516                                 basic_machine=a29k-amd
                0517                                 basic_os=udi
                0518                                 ;;
                0519                         sei)
                0520                                 basic_machine=mips-sei
                0521                                 basic_os=seiux
                0522                                 ;;
                0523                         sequent)
                0524                                 basic_machine=i386-sequent
                0525                                 basic_os=
                0526                                 ;;
                0527                         sps7)
                0528                                 basic_machine=m68k-bull
                0529                                 basic_os=sysv2
                0530                                 ;;
                0531                         st2000)
                0532                                 basic_machine=m68k-tandem
                0533                                 basic_os=
                0534                                 ;;
                0535                         stratus)
                0536                                 basic_machine=i860-stratus
                0537                                 basic_os=sysv4
                0538                                 ;;
                0539                         sun2)
                0540                                 basic_machine=m68000-sun
                0541                                 basic_os=
                0542                                 ;;
                0543                         sun2os3)
                0544                                 basic_machine=m68000-sun
                0545                                 basic_os=sunos3
                0546                                 ;;
                0547                         sun2os4)
                0548                                 basic_machine=m68000-sun
                0549                                 basic_os=sunos4
                0550                                 ;;
                0551                         sun3)
                0552                                 basic_machine=m68k-sun
                0553                                 basic_os=
                0554                                 ;;
                0555                         sun3os3)
                0556                                 basic_machine=m68k-sun
                0557                                 basic_os=sunos3
                0558                                 ;;
                0559                         sun3os4)
                0560                                 basic_machine=m68k-sun
                0561                                 basic_os=sunos4
                0562                                 ;;
                0563                         sun4)
                0564                                 basic_machine=sparc-sun
                0565                                 basic_os=
                0566                                 ;;
                0567                         sun4os3)
                0568                                 basic_machine=sparc-sun
                0569                                 basic_os=sunos3
                0570                                 ;;
                0571                         sun4os4)
                0572                                 basic_machine=sparc-sun
                0573                                 basic_os=sunos4
                0574                                 ;;
                0575                         sun4sol2)
                0576                                 basic_machine=sparc-sun
                0577                                 basic_os=solaris2
                0578                                 ;;
                0579                         sun386 | sun386i | roadrunner)
                0580                                 basic_machine=i386-sun
                0581                                 basic_os=
                0582                                 ;;
                0583                         sv1)
                0584                                 basic_machine=sv1-cray
                0585                                 basic_os=unicos
                0586                                 ;;
                0587                         symmetry)
                0588                                 basic_machine=i386-sequent
                0589                                 basic_os=dynix
                0590                                 ;;
                0591                         t3e)
                0592                                 basic_machine=alphaev5-cray
                0593                                 basic_os=unicos
                0594                                 ;;
                0595                         t90)
                0596                                 basic_machine=t90-cray
                0597                                 basic_os=unicos
                0598                                 ;;
                0599                         toad1)
                0600                                 basic_machine=pdp10-xkl
                0601                                 basic_os=tops20
                0602                                 ;;
                0603                         tpf)
                0604                                 basic_machine=s390x-ibm
                0605                                 basic_os=tpf
                0606                                 ;;
                0607                         udi29k)
                0608                                 basic_machine=a29k-amd
                0609                                 basic_os=udi
                0610                                 ;;
                0611                         ultra3)
                0612                                 basic_machine=a29k-nyu
                0613                                 basic_os=sym1
                0614                                 ;;
                0615                         v810 | necv810)
                0616                                 basic_machine=v810-nec
                0617                                 basic_os=none
                0618                                 ;;
                0619                         vaxv)
                0620                                 basic_machine=vax-dec
                0621                                 basic_os=sysv
                0622                                 ;;
                0623                         vms)
                0624                                 basic_machine=vax-dec
                0625                                 basic_os=vms
                0626                                 ;;
                0627                         vsta)
                0628                                 basic_machine=i386-pc
                0629                                 basic_os=vsta
                0630                                 ;;
                0631                         vxworks960)
                0632                                 basic_machine=i960-wrs
                0633                                 basic_os=vxworks
                0634                                 ;;
                0635                         vxworks68)
                0636                                 basic_machine=m68k-wrs
                0637                                 basic_os=vxworks
                0638                                 ;;
                0639                         vxworks29k)
                0640                                 basic_machine=a29k-wrs
                0641                                 basic_os=vxworks
                0642                                 ;;
                0643                         xbox)
                0644                                 basic_machine=i686-pc
                0645                                 basic_os=mingw32
                0646                                 ;;
                0647                         ymp)
                0648                                 basic_machine=ymp-cray
                0649                                 basic_os=unicos
                0650                                 ;;
                0651                         *)
                0652                                 basic_machine=$1
                0653                                 basic_os=
                0654                                 ;;
                0655                 esac
87f48fcc7 Patr*0656                 ;;
                0657 esac
                0658 
11bb6deb0 Mart*0659 # Decode 1-component or ad-hoc basic machines
87f48fcc7 Patr*0660 case $basic_machine in
11bb6deb0 Mart*0661         # Here we handle the default manufacturer of certain CPU types.  It is in
                0662         # some cases the only manufacturer, in others, it is the most popular.
                0663         w89k)
                0664                 cpu=hppa1.1
                0665                 vendor=winbond
87f48fcc7 Patr*0666                 ;;
11bb6deb0 Mart*0667         op50n)
                0668                 cpu=hppa1.1
                0669                 vendor=oki
87f48fcc7 Patr*0670                 ;;
11bb6deb0 Mart*0671         op60c)
                0672                 cpu=hppa1.1
                0673                 vendor=oki
5c0dde779 Alex*0674                 ;;
11bb6deb0 Mart*0675         ibm*)
                0676                 cpu=i370
                0677                 vendor=ibm
2843d4f83 Andr*0678                 ;;
11bb6deb0 Mart*0679         orion105)
                0680                 cpu=clipper
                0681                 vendor=highlevel
bd72767ee Andr*0682                 ;;
11bb6deb0 Mart*0683         mac | mpw | mac-mpw)
                0684                 cpu=m68k
                0685                 vendor=apple
2843d4f83 Andr*0686                 ;;
11bb6deb0 Mart*0687         pmac | pmac-mpw)
                0688                 cpu=powerpc
                0689                 vendor=apple
2843d4f83 Andr*0690                 ;;
                0691 
87f48fcc7 Patr*0692         # Recognize the various machine names and aliases which stand
                0693         # for a CPU type and a company and sometimes even an OS.
                0694         3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
11bb6deb0 Mart*0695                 cpu=m68000
                0696                 vendor=att
87f48fcc7 Patr*0697                 ;;
                0698         3b*)
11bb6deb0 Mart*0699                 cpu=we32k
                0700                 vendor=att
a4b314f48 Alex*0701                 ;;
f00b8b9c1 Wolf*0702         bluegene*)
11bb6deb0 Mart*0703                 cpu=powerpc
                0704                 vendor=ibm
                0705                 basic_os=cnk
87f48fcc7 Patr*0706                 ;;
fb2b1c85b Alex*0707         decsystem10* | dec10*)
11bb6deb0 Mart*0708                 cpu=pdp10
                0709                 vendor=dec
                0710                 basic_os=tops10
fb2b1c85b Alex*0711                 ;;
                0712         decsystem20* | dec20*)
11bb6deb0 Mart*0713                 cpu=pdp10
                0714                 vendor=dec
                0715                 basic_os=tops20
fb2b1c85b Alex*0716                 ;;
87f48fcc7 Patr*0717         delta | 3300 | motorola-3300 | motorola-delta \
                0718               | 3300-motorola | delta-motorola)
11bb6deb0 Mart*0719                 cpu=m68k
                0720                 vendor=motorola
87f48fcc7 Patr*0721                 ;;
f6a1b37d1 Alex*0722         dpx2*)
11bb6deb0 Mart*0723                 cpu=m68k
                0724                 vendor=bull
                0725                 basic_os=sysv3
87f48fcc7 Patr*0726                 ;;
                0727         encore | umax | mmax)
11bb6deb0 Mart*0728                 cpu=ns32k
                0729                 vendor=encore
87f48fcc7 Patr*0730                 ;;
11bb6deb0 Mart*0731         elxsi)
                0732                 cpu=elxsi
                0733                 vendor=elxsi
                0734                 basic_os=${basic_os:-bsd}
87f48fcc7 Patr*0735                 ;;
                0736         fx2800)
11bb6deb0 Mart*0737                 cpu=i860
                0738                 vendor=alliant
87f48fcc7 Patr*0739                 ;;
                0740         genix)
11bb6deb0 Mart*0741                 cpu=ns32k
                0742                 vendor=ns
87f48fcc7 Patr*0743                 ;;
                0744         h3050r* | hiux*)
11bb6deb0 Mart*0745                 cpu=hppa1.1
                0746                 vendor=hitachi
                0747                 basic_os=hiuxwe2
87f48fcc7 Patr*0748                 ;;
                0749         hp3k9[0-9][0-9] | hp9[0-9][0-9])
11bb6deb0 Mart*0750                 cpu=hppa1.0
                0751                 vendor=hp
87f48fcc7 Patr*0752                 ;;
                0753         hp9k2[0-9][0-9] | hp9k31[0-9])
11bb6deb0 Mart*0754                 cpu=m68000
                0755                 vendor=hp
87f48fcc7 Patr*0756                 ;;
                0757         hp9k3[2-9][0-9])
11bb6deb0 Mart*0758                 cpu=m68k
                0759                 vendor=hp
87f48fcc7 Patr*0760                 ;;
                0761         hp9k6[0-9][0-9] | hp6[0-9][0-9])
11bb6deb0 Mart*0762                 cpu=hppa1.0
                0763                 vendor=hp
87f48fcc7 Patr*0764                 ;;
                0765         hp9k7[0-79][0-9] | hp7[0-79][0-9])
11bb6deb0 Mart*0766                 cpu=hppa1.1
                0767                 vendor=hp
87f48fcc7 Patr*0768                 ;;
                0769         hp9k78[0-9] | hp78[0-9])
                0770                 # FIXME: really hppa2.0-hp
11bb6deb0 Mart*0771                 cpu=hppa1.1
                0772                 vendor=hp
87f48fcc7 Patr*0773                 ;;
                0774         hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
                0775                 # FIXME: really hppa2.0-hp
11bb6deb0 Mart*0776                 cpu=hppa1.1
                0777                 vendor=hp
87f48fcc7 Patr*0778                 ;;
                0779         hp9k8[0-9][13679] | hp8[0-9][13679])
11bb6deb0 Mart*0780                 cpu=hppa1.1
                0781                 vendor=hp
87f48fcc7 Patr*0782                 ;;
                0783         hp9k8[0-9][0-9] | hp8[0-9][0-9])
11bb6deb0 Mart*0784                 cpu=hppa1.0
                0785                 vendor=hp
87f48fcc7 Patr*0786                 ;;
                0787         i*86v32)
11bb6deb0 Mart*0788                 cpu=`echo "$1" | sed -e 's/86.*/86/'`
                0789                 vendor=pc
                0790                 basic_os=sysv32
87f48fcc7 Patr*0791                 ;;
                0792         i*86v4*)
11bb6deb0 Mart*0793                 cpu=`echo "$1" | sed -e 's/86.*/86/'`
                0794                 vendor=pc
                0795                 basic_os=sysv4
87f48fcc7 Patr*0796                 ;;
                0797         i*86v)
11bb6deb0 Mart*0798                 cpu=`echo "$1" | sed -e 's/86.*/86/'`
                0799                 vendor=pc
                0800                 basic_os=sysv
87f48fcc7 Patr*0801                 ;;
                0802         i*86sol2)
11bb6deb0 Mart*0803                 cpu=`echo "$1" | sed -e 's/86.*/86/'`
                0804                 vendor=pc
                0805                 basic_os=solaris2
87f48fcc7 Patr*0806                 ;;
11bb6deb0 Mart*0807         j90 | j90-cray)
                0808                 cpu=j90
                0809                 vendor=cray
                0810                 basic_os=${basic_os:-unicos}
87f48fcc7 Patr*0811                 ;;
                0812         iris | iris4d)
11bb6deb0 Mart*0813                 cpu=mips
                0814                 vendor=sgi
                0815                 case $basic_os in
                0816                     irix*)
87f48fcc7 Patr*0817                         ;;
                0818                     *)
11bb6deb0 Mart*0819                         basic_os=irix4
87f48fcc7 Patr*0820                         ;;
                0821                 esac
                0822                 ;;
                0823         miniframe)
11bb6deb0 Mart*0824                 cpu=m68000
                0825                 vendor=convergent
bf6c3a122 Alex*0826                 ;;
11bb6deb0 Mart*0827         *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
                0828                 cpu=m68k
                0829                 vendor=atari
                0830                 basic_os=mint
87f48fcc7 Patr*0831                 ;;
                0832         news-3600 | risc-news)
11bb6deb0 Mart*0833                 cpu=mips
                0834                 vendor=sony
                0835                 basic_os=newsos
87f48fcc7 Patr*0836                 ;;
f6a1b37d1 Alex*0837         next | m*-next)
11bb6deb0 Mart*0838                 cpu=m68k
                0839                 vendor=next
                0840                 case $basic_os in
                0841                     openstep*)
                0842                         ;;
                0843                     nextstep*)
87f48fcc7 Patr*0844                         ;;
11bb6deb0 Mart*0845                     ns2*)
                0846                       basic_os=nextstep2
87f48fcc7 Patr*0847                         ;;
                0848                     *)
11bb6deb0 Mart*0849                       basic_os=nextstep3
87f48fcc7 Patr*0850                         ;;
                0851                 esac
                0852                 ;;
                0853         np1)
11bb6deb0 Mart*0854                 cpu=np1
                0855                 vendor=gould
f6a1b37d1 Alex*0856                 ;;
87f48fcc7 Patr*0857         op50n-* | op60c-*)
11bb6deb0 Mart*0858                 cpu=hppa1.1
                0859                 vendor=oki
                0860                 basic_os=proelf
87f48fcc7 Patr*0861                 ;;
                0862         pa-hitachi)
11bb6deb0 Mart*0863                 cpu=hppa1.1
                0864                 vendor=hitachi
                0865                 basic_os=hiuxwe2
a4b314f48 Alex*0866                 ;;
87f48fcc7 Patr*0867         pbd)
11bb6deb0 Mart*0868                 cpu=sparc
                0869                 vendor=tti
87f48fcc7 Patr*0870                 ;;
                0871         pbb)
11bb6deb0 Mart*0872                 cpu=m68k
                0873                 vendor=tti
5c0dde779 Alex*0874                 ;;
11bb6deb0 Mart*0875         pc532)
                0876                 cpu=ns32k
                0877                 vendor=pc532
c67a307b8 Alex*0878                 ;;
87f48fcc7 Patr*0879         pn)
11bb6deb0 Mart*0880                 cpu=pn
                0881                 vendor=gould
4d9e7036b Alex*0882                 ;;
11bb6deb0 Mart*0883         power)
                0884                 cpu=power
                0885                 vendor=ibm
87f48fcc7 Patr*0886                 ;;
11bb6deb0 Mart*0887         ps2)
                0888                 cpu=i386
                0889                 vendor=ibm
4d9e7036b Alex*0890                 ;;
11bb6deb0 Mart*0891         rm[46]00)
                0892                 cpu=mips
                0893                 vendor=siemens
fb2b1c85b Alex*0894                 ;;
11bb6deb0 Mart*0895         rtpc | rtpc-*)
                0896                 cpu=romp
                0897                 vendor=ibm
4d9e7036b Alex*0898                 ;;
11bb6deb0 Mart*0899         sde)
                0900                 cpu=mipsisa32
                0901                 vendor=sde
                0902                 basic_os=${basic_os:-elf}
fb2b1c85b Alex*0903                 ;;
11bb6deb0 Mart*0904         simso-wrs)
                0905                 cpu=sparclite
                0906                 vendor=wrs
                0907                 basic_os=vxworks
87f48fcc7 Patr*0908                 ;;
11bb6deb0 Mart*0909         tower | tower-32)
                0910                 cpu=m68k
                0911                 vendor=ncr
87f48fcc7 Patr*0912                 ;;
11bb6deb0 Mart*0913         vpp*|vx|vx-*)
                0914                 cpu=f301
                0915                 vendor=fujitsu
bd72767ee Andr*0916                 ;;
11bb6deb0 Mart*0917         w65)
                0918                 cpu=w65
                0919                 vendor=wdc
5c0dde779 Alex*0920                 ;;
11bb6deb0 Mart*0921         w89k-*)
                0922                 cpu=hppa1.1
                0923                 vendor=winbond
                0924                 basic_os=proelf
87f48fcc7 Patr*0925                 ;;
11bb6deb0 Mart*0926         none)
                0927                 cpu=none
                0928                 vendor=none
87f48fcc7 Patr*0929                 ;;
11bb6deb0 Mart*0930         leon|leon[3-9])
                0931                 cpu=sparc
                0932                 vendor=$basic_machine
87f48fcc7 Patr*0933                 ;;
11bb6deb0 Mart*0934         leon-*|leon[3-9]-*)
                0935                 cpu=sparc
                0936                 vendor=`echo "$basic_machine" | sed 's/-.*//'`
fb2b1c85b Alex*0937                 ;;
11bb6deb0 Mart*0938 
                0939         *-*)
                0940                 # shellcheck disable=SC2162
b9f6d1be0 Alex*0941                 saved_IFS=$IFS
11bb6deb0 Mart*0942                 IFS="-" read cpu vendor <<EOF
                0943 $basic_machine
                0944 EOF
b9f6d1be0 Alex*0945                 IFS=$saved_IFS
fb2b1c85b Alex*0946                 ;;
3aca59945 Alex*0947         # We use 'pc' rather than 'unknown'
11bb6deb0 Mart*0948         # because (1) that's what they normally are, and
                0949         # (2) the word "unknown" tends to confuse beginning users.
                0950         i*86 | x86_64)
                0951                 cpu=$basic_machine
                0952                 vendor=pc
87f48fcc7 Patr*0953                 ;;
11bb6deb0 Mart*0954         # These rules are duplicated from below for sake of the special case above;
                0955         # i.e. things that normalized to x86 arches should also default to "pc"
                0956         pc98)
                0957                 cpu=i386
                0958                 vendor=pc
4d9e7036b Alex*0959                 ;;
11bb6deb0 Mart*0960         x64 | amd64)
                0961                 cpu=x86_64
                0962                 vendor=pc
4d9e7036b Alex*0963                 ;;
11bb6deb0 Mart*0964         # Recognize the basic CPU types without company name.
                0965         *)
                0966                 cpu=$basic_machine
                0967                 vendor=unknown
aafc07086 Alex*0968                 ;;
11bb6deb0 Mart*0969 esac
                0970 
                0971 unset -v basic_machine
                0972 
                0973 # Decode basic machines in the full and proper CPU-Company form.
                0974 case $cpu-$vendor in
                0975         # Here we handle the default manufacturer of certain CPU types in canonical form. It is in
                0976         # some cases the only manufacturer, in others, it is the most popular.
                0977         craynv-unknown)
                0978                 vendor=cray
                0979                 basic_os=${basic_os:-unicosmp}
c67a307b8 Alex*0980                 ;;
11bb6deb0 Mart*0981         c90-unknown | c90-cray)
                0982                 vendor=cray
                0983                 basic_os=${Basic_os:-unicos}
87f48fcc7 Patr*0984                 ;;
11bb6deb0 Mart*0985         fx80-unknown)
                0986                 vendor=alliant
aafc07086 Alex*0987                 ;;
11bb6deb0 Mart*0988         romp-unknown)
                0989                 vendor=ibm
87f48fcc7 Patr*0990                 ;;
11bb6deb0 Mart*0991         mmix-unknown)
                0992                 vendor=knuth
87f48fcc7 Patr*0993                 ;;
11bb6deb0 Mart*0994         microblaze-unknown | microblazeel-unknown)
                0995                 vendor=xilinx
87f48fcc7 Patr*0996                 ;;
11bb6deb0 Mart*0997         rs6000-unknown)
                0998                 vendor=ibm
87f48fcc7 Patr*0999                 ;;
11bb6deb0 Mart*1000         vax-unknown)
                1001                 vendor=dec
87f48fcc7 Patr*1002                 ;;
11bb6deb0 Mart*1003         pdp11-unknown)
                1004                 vendor=dec
2843d4f83 Andr*1005                 ;;
11bb6deb0 Mart*1006         we32k-unknown)
                1007                 vendor=att
87f48fcc7 Patr*1008                 ;;
11bb6deb0 Mart*1009         cydra-unknown)
                1010                 vendor=cydrome
87f48fcc7 Patr*1011                 ;;
11bb6deb0 Mart*1012         i370-ibm*)
                1013                 vendor=ibm
87f48fcc7 Patr*1014                 ;;
11bb6deb0 Mart*1015         orion-unknown)
                1016                 vendor=highlevel
87f48fcc7 Patr*1017                 ;;
11bb6deb0 Mart*1018         xps-unknown | xps100-unknown)
                1019                 cpu=xps100
                1020                 vendor=honeywell
87f48fcc7 Patr*1021                 ;;
11bb6deb0 Mart*1022 
                1023         # Here we normalize CPU types with a missing or matching vendor
3aca59945 Alex*1024         armh-unknown | armh-alt)
                1025                 cpu=armv7l
                1026                 vendor=alt
                1027                 basic_os=${basic_os:-linux-gnueabihf}
                1028                 ;;
11bb6deb0 Mart*1029         dpx20-unknown | dpx20-bull)
                1030                 cpu=rs6000
                1031                 vendor=bull
                1032                 basic_os=${basic_os:-bosx}
87f48fcc7 Patr*1033                 ;;
11bb6deb0 Mart*1034 
                1035         # Here we normalize CPU types irrespective of the vendor
                1036         amd64-*)
                1037                 cpu=x86_64
87f48fcc7 Patr*1038                 ;;
11bb6deb0 Mart*1039         blackfin-*)
                1040                 cpu=bfin
                1041                 basic_os=linux
87f48fcc7 Patr*1042                 ;;
11bb6deb0 Mart*1043         c54x-*)
                1044                 cpu=tic54x
87f48fcc7 Patr*1045                 ;;
11bb6deb0 Mart*1046         c55x-*)
                1047                 cpu=tic55x
87f48fcc7 Patr*1048                 ;;
11bb6deb0 Mart*1049         c6x-*)
                1050                 cpu=tic6x
87f48fcc7 Patr*1051                 ;;
11bb6deb0 Mart*1052         e500v[12]-*)
                1053                 cpu=powerpc
                1054                 basic_os=${basic_os}"spe"
87f48fcc7 Patr*1055                 ;;
11bb6deb0 Mart*1056         mips3*-*)
                1057                 cpu=mips64
87f48fcc7 Patr*1058                 ;;
11bb6deb0 Mart*1059         ms1-*)
                1060                 cpu=mt
58faa1cf7 Alex*1061                 ;;
11bb6deb0 Mart*1062         m68knommu-*)
                1063                 cpu=m68k
                1064                 basic_os=linux
87f48fcc7 Patr*1065                 ;;
11bb6deb0 Mart*1066         m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
                1067                 cpu=s12z
a4b314f48 Alex*1068                 ;;
11bb6deb0 Mart*1069         openrisc-*)
                1070                 cpu=or32
87f48fcc7 Patr*1071                 ;;
11bb6deb0 Mart*1072         parisc-*)
                1073                 cpu=hppa
                1074                 basic_os=linux
87f48fcc7 Patr*1075                 ;;
11bb6deb0 Mart*1076         pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
                1077                 cpu=i586
fb2b1c85b Alex*1078                 ;;
3aca59945 Alex*1079         pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*)
11bb6deb0 Mart*1080                 cpu=i686
87f48fcc7 Patr*1081                 ;;
11bb6deb0 Mart*1082         pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
                1083                 cpu=i686
c67a307b8 Alex*1084                 ;;
11bb6deb0 Mart*1085         pentium4-*)
                1086                 cpu=i786
87f48fcc7 Patr*1087                 ;;
11bb6deb0 Mart*1088         pc98-*)
                1089                 cpu=i386
87f48fcc7 Patr*1090                 ;;
11bb6deb0 Mart*1091         ppc-* | ppcbe-*)
                1092                 cpu=powerpc
87f48fcc7 Patr*1093                 ;;
11bb6deb0 Mart*1094         ppcle-* | powerpclittle-*)
                1095                 cpu=powerpcle
87f48fcc7 Patr*1096                 ;;
11bb6deb0 Mart*1097         ppc64-*)
                1098                 cpu=powerpc64
87f48fcc7 Patr*1099                 ;;
11bb6deb0 Mart*1100         ppc64le-* | powerpc64little-*)
                1101                 cpu=powerpc64le
4d9e7036b Alex*1102                 ;;
11bb6deb0 Mart*1103         sb1-*)
                1104                 cpu=mipsisa64sb1
87f48fcc7 Patr*1105                 ;;
11bb6deb0 Mart*1106         sb1el-*)
                1107                 cpu=mipsisa64sb1el
87f48fcc7 Patr*1108                 ;;
11bb6deb0 Mart*1109         sh5e[lb]-*)
                1110                 cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
87f48fcc7 Patr*1111                 ;;
11bb6deb0 Mart*1112         spur-*)
                1113                 cpu=spur
87f48fcc7 Patr*1114                 ;;
11bb6deb0 Mart*1115         strongarm-* | thumb-*)
                1116                 cpu=arm
87f48fcc7 Patr*1117                 ;;
11bb6deb0 Mart*1118         tx39-*)
                1119                 cpu=mipstx39
f6a1b37d1 Alex*1120                 ;;
11bb6deb0 Mart*1121         tx39el-*)
                1122                 cpu=mipstx39el
c67a307b8 Alex*1123                 ;;
11bb6deb0 Mart*1124         x64-*)
                1125                 cpu=x86_64
87f48fcc7 Patr*1126                 ;;
2843d4f83 Andr*1127         xscale-* | xscalee[bl]-*)
11bb6deb0 Mart*1128                 cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
58faa1cf7 Alex*1129                 ;;
3aca59945 Alex*1130         arm64-* | aarch64le-*)
11bb6deb0 Mart*1131                 cpu=aarch64
87f48fcc7 Patr*1132                 ;;
                1133 
11bb6deb0 Mart*1134         # Recognize the canonical CPU Types that limit and/or modify the
                1135         # company names they are paired with.
                1136         cr16-*)
                1137                 basic_os=${basic_os:-elf}
87f48fcc7 Patr*1138                 ;;
11bb6deb0 Mart*1139         crisv32-* | etraxfs*-*)
                1140                 cpu=crisv32
                1141                 vendor=axis
c67a307b8 Alex*1142                 ;;
11bb6deb0 Mart*1143         cris-* | etrax*-*)
                1144                 cpu=cris
                1145                 vendor=axis
87f48fcc7 Patr*1146                 ;;
11bb6deb0 Mart*1147         crx-*)
                1148                 basic_os=${basic_os:-elf}
87f48fcc7 Patr*1149                 ;;
11bb6deb0 Mart*1150         neo-tandem)
                1151                 cpu=neo
                1152                 vendor=tandem
87f48fcc7 Patr*1153                 ;;
11bb6deb0 Mart*1154         nse-tandem)
                1155                 cpu=nse
                1156                 vendor=tandem
87f48fcc7 Patr*1157                 ;;
11bb6deb0 Mart*1158         nsr-tandem)
                1159                 cpu=nsr
                1160                 vendor=tandem
87f48fcc7 Patr*1161                 ;;
11bb6deb0 Mart*1162         nsv-tandem)
                1163                 cpu=nsv
                1164                 vendor=tandem
87f48fcc7 Patr*1165                 ;;
11bb6deb0 Mart*1166         nsx-tandem)
                1167                 cpu=nsx
                1168                 vendor=tandem
87f48fcc7 Patr*1169                 ;;
11bb6deb0 Mart*1170         mipsallegrexel-sony)
                1171                 cpu=mipsallegrexel
                1172                 vendor=sony
87f48fcc7 Patr*1173                 ;;
11bb6deb0 Mart*1174         tile*-*)
                1175                 basic_os=${basic_os:-linux-gnu}
87f48fcc7 Patr*1176                 ;;
11bb6deb0 Mart*1177 
87f48fcc7 Patr*1178         *)
11bb6deb0 Mart*1179                 # Recognize the canonical CPU types that are allowed with any
                1180                 # company name.
                1181                 case $cpu in
                1182                         1750a | 580 \
                1183                         | a29k \
3aca59945 Alex*1184                         | aarch64 | aarch64_be | aarch64c | arm64ec \
11bb6deb0 Mart*1185                         | abacus \
                1186                         | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
                1187                         | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
                1188                         | alphapca5[67] | alpha64pca5[67] \
                1189                         | am33_2.0 \
                1190                         | amdgcn \
b9f6d1be0 Alex*1191                         | arc | arceb | arc32 | arc64 \
11bb6deb0 Mart*1192                         | arm | arm[lb]e | arme[lb] | armv* \
                1193                         | avr | avr32 \
                1194                         | asmjs \
                1195                         | ba \
                1196                         | be32 | be64 \
                1197                         | bfin | bpf | bs2000 \
                1198                         | c[123]* | c30 | [cjt]90 | c4x \
                1199                         | c8051 | clipper | craynv | csky | cydra \
                1200                         | d10v | d30v | dlx | dsp16xx \
                1201                         | e2k | elxsi | epiphany \
                1202                         | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
3aca59945 Alex*1203                         | javascript \
11bb6deb0 Mart*1204                         | h8300 | h8500 \
                1205                         | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
                1206                         | hexagon \
                1207                         | i370 | i*86 | i860 | i960 | ia16 | ia64 \
                1208                         | ip2k | iq2000 \
                1209                         | k1om \
3aca59945 Alex*1210                         | kvx \
11bb6deb0 Mart*1211                         | le32 | le64 \
                1212                         | lm32 \
3aca59945 Alex*1213                         | loongarch32 | loongarch64 \
11bb6deb0 Mart*1214                         | m32c | m32r | m32rle \
                1215                         | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
                1216                         | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
                1217                         | m88110 | m88k | maxq | mb | mcore | mep | metag \
                1218                         | microblaze | microblazeel \
3aca59945 Alex*1219                         | mips* \
11bb6deb0 Mart*1220                         | mmix \
                1221                         | mn10200 | mn10300 \
                1222                         | moxie \
                1223                         | mt \
                1224                         | msp430 \
                1225                         | nds32 | nds32le | nds32be \
                1226                         | nfp \
                1227                         | nios | nios2 | nios2eb | nios2el \
                1228                         | none | np1 | ns16k | ns32k | nvptx \
                1229                         | open8 \
                1230                         | or1k* \
                1231                         | or32 \
                1232                         | orion \
                1233                         | picochip \
                1234                         | pdp10 | pdp11 | pj | pjl | pn | power \
                1235                         | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
                1236                         | pru \
                1237                         | pyramid \
b9f6d1be0 Alex*1238                         | riscv | riscv32 | riscv32be | riscv64 | riscv64be \
11bb6deb0 Mart*1239                         | rl78 | romp | rs6000 | rx \
                1240                         | s390 | s390x \
                1241                         | score \
                1242                         | sh | shl \
                1243                         | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
                1244                         | sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
                1245                         | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
                1246                         | sparclite \
                1247                         | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
                1248                         | spu \
                1249                         | tahoe \
b9f6d1be0 Alex*1250                         | thumbv7* \
11bb6deb0 Mart*1251                         | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
                1252                         | tron \
                1253                         | ubicom32 \
                1254                         | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
                1255                         | vax \
                1256                         | visium \
                1257                         | w65 \
                1258                         | wasm32 | wasm64 \
                1259                         | we32k \
                1260                         | x86 | x86_64 | xc16x | xgate | xps100 \
                1261                         | xstormy16 | xtensa* \
                1262                         | ymp \
                1263                         | z8k | z80)
                1264                                 ;;
                1265 
                1266                         *)
3aca59945 Alex*1267                                 echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2
11bb6deb0 Mart*1268                                 exit 1
                1269                                 ;;
                1270                 esac
87f48fcc7 Patr*1271                 ;;
                1272 esac
                1273 
                1274 # Here we canonicalize certain aliases for manufacturers.
11bb6deb0 Mart*1275 case $vendor in
                1276         digital*)
                1277                 vendor=dec
87f48fcc7 Patr*1278                 ;;
11bb6deb0 Mart*1279         commodore*)
                1280                 vendor=cbm
87f48fcc7 Patr*1281                 ;;
                1282         *)
                1283                 ;;
                1284 esac
                1285 
                1286 # Decode manufacturer-specific aliases for certain operating systems.
                1287 
3aca59945 Alex*1288 if test x"$basic_os" != x
87f48fcc7 Patr*1289 then
11bb6deb0 Mart*1290 
3aca59945 Alex*1291 # First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
11bb6deb0 Mart*1292 # set os.
3aca59945 Alex*1293 obj=
11bb6deb0 Mart*1294 case $basic_os in
                1295         gnu/linux*)
                1296                 kernel=linux
b9f6d1be0 Alex*1297                 os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
                1298                 ;;
                1299         os2-emx)
                1300                 kernel=os2
                1301                 os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
11bb6deb0 Mart*1302                 ;;
                1303         nto-qnx*)
                1304                 kernel=nto
b9f6d1be0 Alex*1305                 os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
11bb6deb0 Mart*1306                 ;;
                1307         *-*)
                1308                 # shellcheck disable=SC2162
b9f6d1be0 Alex*1309                 saved_IFS=$IFS
11bb6deb0 Mart*1310                 IFS="-" read kernel os <<EOF
                1311 $basic_os
                1312 EOF
b9f6d1be0 Alex*1313                 IFS=$saved_IFS
11bb6deb0 Mart*1314                 ;;
                1315         # Default OS when just kernel was specified
                1316         nto*)
                1317                 kernel=nto
b9f6d1be0 Alex*1318                 os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
11bb6deb0 Mart*1319                 ;;
                1320         linux*)
                1321                 kernel=linux
b9f6d1be0 Alex*1322                 os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
11bb6deb0 Mart*1323                 ;;
3aca59945 Alex*1324         managarm*)
                1325                 kernel=managarm
                1326                 os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'`
                1327                 ;;
11bb6deb0 Mart*1328         *)
                1329                 kernel=
                1330                 os=$basic_os
                1331                 ;;
                1332 esac
                1333 
                1334 # Now, normalize the OS (knowing we just have one component, it's not a kernel,
                1335 # etc.)
87f48fcc7 Patr*1336 case $os in
f6a1b37d1 Alex*1337         # First match some system type aliases that might get confused
                1338         # with valid system types.
11bb6deb0 Mart*1339         # solaris* is a basic system type, with this one exception.
                1340         auroraux)
                1341                 os=auroraux
f00b8b9c1 Wolf*1342                 ;;
11bb6deb0 Mart*1343         bluegene*)
                1344                 os=cnk
87f48fcc7 Patr*1345                 ;;
11bb6deb0 Mart*1346         solaris1 | solaris1.*)
b9f6d1be0 Alex*1347                 os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
87f48fcc7 Patr*1348                 ;;
11bb6deb0 Mart*1349         solaris)
                1350                 os=solaris2
87f48fcc7 Patr*1351                 ;;
11bb6deb0 Mart*1352         unixware*)
                1353                 os=sysv4.2uw
87f48fcc7 Patr*1354                 ;;
f6a1b37d1 Alex*1355         # es1800 is here to avoid being matched by es* (a different OS)
11bb6deb0 Mart*1356         es1800*)
                1357                 os=ose
f6a1b37d1 Alex*1358                 ;;
11bb6deb0 Mart*1359         # Some version numbers need modification
                1360         chorusos*)
                1361                 os=chorusos
                1362                 ;;
                1363         isc)
                1364                 os=isc2.2
                1365                 ;;
                1366         sco6)
                1367                 os=sco5v6
                1368                 ;;
                1369         sco5)
                1370                 os=sco3.2v5
                1371                 ;;
                1372         sco4)
                1373                 os=sco3.2v4
                1374                 ;;
                1375         sco3.2.[4-9]*)
b9f6d1be0 Alex*1376                 os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
11bb6deb0 Mart*1377                 ;;
                1378         sco*v* | scout)
                1379                 # Don't match below
                1380                 ;;
                1381         sco*)
                1382                 os=sco3.2v2
                1383                 ;;
                1384         psos*)
                1385                 os=psos
                1386                 ;;
                1387         qnx*)
b9f6d1be0 Alex*1388                 os=qnx
87f48fcc7 Patr*1389                 ;;
11bb6deb0 Mart*1390         hiux*)
                1391                 os=hiuxwe2
                1392                 ;;
                1393         lynx*178)
                1394                 os=lynxos178
4d9e7036b Alex*1395                 ;;
11bb6deb0 Mart*1396         lynx*5)
                1397                 os=lynxos5
87f48fcc7 Patr*1398                 ;;
11bb6deb0 Mart*1399         lynxos*)
                1400                 # don't get caught up in next wildcard
87f48fcc7 Patr*1401                 ;;
11bb6deb0 Mart*1402         lynx*)
                1403                 os=lynxos
                1404                 ;;
                1405         mac[0-9]*)
f6a1b37d1 Alex*1406                 os=`echo "$os" | sed -e 's|mac|macos|'`
87f48fcc7 Patr*1407                 ;;
11bb6deb0 Mart*1408         opened*)
                1409                 os=openedition
c67a307b8 Alex*1410                 ;;
11bb6deb0 Mart*1411         os400*)
                1412                 os=os400
87f48fcc7 Patr*1413                 ;;
11bb6deb0 Mart*1414         sunos5*)
f6a1b37d1 Alex*1415                 os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
87f48fcc7 Patr*1416                 ;;
11bb6deb0 Mart*1417         sunos6*)
f6a1b37d1 Alex*1418                 os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
87f48fcc7 Patr*1419                 ;;
11bb6deb0 Mart*1420         wince*)
                1421                 os=wince
87f48fcc7 Patr*1422                 ;;
11bb6deb0 Mart*1423         utek*)
                1424                 os=bsd
87f48fcc7 Patr*1425                 ;;
11bb6deb0 Mart*1426         dynix*)
                1427                 os=bsd
87f48fcc7 Patr*1428                 ;;
11bb6deb0 Mart*1429         acis*)
                1430                 os=aos
87f48fcc7 Patr*1431                 ;;
11bb6deb0 Mart*1432         atheos*)
                1433                 os=atheos
fb2b1c85b Alex*1434                 ;;
11bb6deb0 Mart*1435         syllable*)
                1436                 os=syllable
c67a307b8 Alex*1437                 ;;
11bb6deb0 Mart*1438         386bsd)
                1439                 os=bsd
87f48fcc7 Patr*1440                 ;;
11bb6deb0 Mart*1441         ctix* | uts*)
                1442                 os=sysv
58faa1cf7 Alex*1443                 ;;
11bb6deb0 Mart*1444         nova*)
                1445                 os=rtmk-nova
87f48fcc7 Patr*1446                 ;;
11bb6deb0 Mart*1447         ns2)
                1448                 os=nextstep2
87f48fcc7 Patr*1449                 ;;
                1450         # Preserve the version number of sinix5.
11bb6deb0 Mart*1451         sinix5.*)
b9f6d1be0 Alex*1452                 os=`echo "$os" | sed -e 's|sinix|sysv|'`
87f48fcc7 Patr*1453                 ;;
11bb6deb0 Mart*1454         sinix*)
                1455                 os=sysv4
87f48fcc7 Patr*1456                 ;;
11bb6deb0 Mart*1457         tpf*)
                1458                 os=tpf
87f48fcc7 Patr*1459                 ;;
11bb6deb0 Mart*1460         triton*)
                1461                 os=sysv3
87f48fcc7 Patr*1462                 ;;
11bb6deb0 Mart*1463         oss*)
                1464                 os=sysv3
87f48fcc7 Patr*1465                 ;;
11bb6deb0 Mart*1466         svr4*)
                1467                 os=sysv4
87f48fcc7 Patr*1468                 ;;
11bb6deb0 Mart*1469         svr3)
                1470                 os=sysv3
87f48fcc7 Patr*1471                 ;;
11bb6deb0 Mart*1472         sysvr4)
                1473                 os=sysv4
87f48fcc7 Patr*1474                 ;;
11bb6deb0 Mart*1475         ose*)
                1476                 os=ose
87f48fcc7 Patr*1477                 ;;
11bb6deb0 Mart*1478         *mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
                1479                 os=mint
c67a307b8 Alex*1480                 ;;
11bb6deb0 Mart*1481         dicos*)
                1482                 os=dicos
a4b314f48 Alex*1483                 ;;
11bb6deb0 Mart*1484         pikeos*)
f6a1b37d1 Alex*1485                 # Until real need of OS specific support for
                1486                 # particular features comes up, bare metal
                1487                 # configurations are quite functional.
11bb6deb0 Mart*1488                 case $cpu in
f6a1b37d1 Alex*1489                     arm*)
11bb6deb0 Mart*1490                         os=eabi
f6a1b37d1 Alex*1491                         ;;
                1492                     *)
3aca59945 Alex*1493                         os=
                1494                         obj=elf
f6a1b37d1 Alex*1495                         ;;
                1496                 esac
                1497                 ;;
3aca59945 Alex*1498         aout* | coff* | elf* | pe*)
                1499                 # These are machine code file formats, not OSes
                1500                 obj=$os
                1501                 os=
                1502                 ;;
87f48fcc7 Patr*1503         *)
11bb6deb0 Mart*1504                 # No normalization, but not necessarily accepted, that comes below.
87f48fcc7 Patr*1505                 ;;
                1506 esac
11bb6deb0 Mart*1507 
87f48fcc7 Patr*1508 else
                1509 
                1510 # Here we handle the default operating systems that come with various machines.
                1511 # The value should be what the vendor currently ships out the door with their
                1512 # machine or put another way, the most popular os provided with the machine.
                1513 
                1514 # Note that if you're going to try to match "-MANUFACTURER" here (say,
                1515 # "-sun"), then you have to tell the case statement up towards the top
                1516 # that MANUFACTURER isn't an operating system.  Otherwise, code above
                1517 # will signal an error saying that MANUFACTURER isn't an operating
                1518 # system, and we'll never get to this point.
                1519 
11bb6deb0 Mart*1520 kernel=
3aca59945 Alex*1521 obj=
11bb6deb0 Mart*1522 case $cpu-$vendor in
2843d4f83 Andr*1523         score-*)
3aca59945 Alex*1524                 os=
                1525                 obj=elf
aafc07086 Alex*1526                 ;;
2843d4f83 Andr*1527         spu-*)
3aca59945 Alex*1528                 os=
                1529                 obj=elf
5c0dde779 Alex*1530                 ;;
87f48fcc7 Patr*1531         *-acorn)
11bb6deb0 Mart*1532                 os=riscix1.2
87f48fcc7 Patr*1533                 ;;
                1534         arm*-rebel)
11bb6deb0 Mart*1535                 kernel=linux
                1536                 os=gnu
87f48fcc7 Patr*1537                 ;;
                1538         arm*-semi)
3aca59945 Alex*1539                 os=
                1540                 obj=aout
87f48fcc7 Patr*1541                 ;;
2843d4f83 Andr*1542         c4x-* | tic4x-*)
3aca59945 Alex*1543                 os=
                1544                 obj=coff
5c0dde779 Alex*1545                 ;;
bf6c3a122 Alex*1546         c8051-*)
3aca59945 Alex*1547                 os=
                1548                 obj=elf
11bb6deb0 Mart*1549                 ;;
                1550         clipper-intergraph)
                1551                 os=clix
bf6c3a122 Alex*1552                 ;;
bd72767ee Andr*1553         hexagon-*)
3aca59945 Alex*1554                 os=
                1555                 obj=elf
bd72767ee Andr*1556                 ;;
f00b8b9c1 Wolf*1557         tic54x-*)
3aca59945 Alex*1558                 os=
                1559                 obj=coff
f00b8b9c1 Wolf*1560                 ;;
                1561         tic55x-*)
3aca59945 Alex*1562                 os=
                1563                 obj=coff
f00b8b9c1 Wolf*1564                 ;;
                1565         tic6x-*)
3aca59945 Alex*1566                 os=
                1567                 obj=coff
f00b8b9c1 Wolf*1568                 ;;
fb2b1c85b Alex*1569         # This must come before the *-dec entry.
87f48fcc7 Patr*1570         pdp10-*)
11bb6deb0 Mart*1571                 os=tops20
87f48fcc7 Patr*1572                 ;;
4d9e7036b Alex*1573         pdp11-*)
11bb6deb0 Mart*1574                 os=none
87f48fcc7 Patr*1575                 ;;
                1576         *-dec | vax-*)
11bb6deb0 Mart*1577                 os=ultrix4.2
87f48fcc7 Patr*1578                 ;;
                1579         m68*-apollo)
11bb6deb0 Mart*1580                 os=domain
87f48fcc7 Patr*1581                 ;;
                1582         i386-sun)
11bb6deb0 Mart*1583                 os=sunos4.0.2
87f48fcc7 Patr*1584                 ;;
                1585         m68000-sun)
11bb6deb0 Mart*1586                 os=sunos3
87f48fcc7 Patr*1587                 ;;
                1588         m68*-cisco)
3aca59945 Alex*1589                 os=
                1590                 obj=aout
87f48fcc7 Patr*1591                 ;;
2843d4f83 Andr*1592         mep-*)
3aca59945 Alex*1593                 os=
                1594                 obj=elf
aafc07086 Alex*1595                 ;;
87f48fcc7 Patr*1596         mips*-cisco)
3aca59945 Alex*1597                 os=
                1598                 obj=elf
87f48fcc7 Patr*1599                 ;;
                1600         mips*-*)
3aca59945 Alex*1601                 os=
                1602                 obj=elf
87f48fcc7 Patr*1603                 ;;
58faa1cf7 Alex*1604         or32-*)
3aca59945 Alex*1605                 os=
                1606                 obj=coff
58faa1cf7 Alex*1607                 ;;
87f48fcc7 Patr*1608         *-tti)  # must be before sparc entry or we get the wrong os.
11bb6deb0 Mart*1609                 os=sysv3
87f48fcc7 Patr*1610                 ;;
                1611         sparc-* | *-sun)
11bb6deb0 Mart*1612                 os=sunos4.1.1
87f48fcc7 Patr*1613                 ;;
f6a1b37d1 Alex*1614         pru-*)
3aca59945 Alex*1615                 os=
                1616                 obj=elf
f6a1b37d1 Alex*1617                 ;;
87f48fcc7 Patr*1618         *-be)
11bb6deb0 Mart*1619                 os=beos
87f48fcc7 Patr*1620                 ;;
                1621         *-ibm)
11bb6deb0 Mart*1622                 os=aix
87f48fcc7 Patr*1623                 ;;
2843d4f83 Andr*1624         *-knuth)
11bb6deb0 Mart*1625                 os=mmixware
c67a307b8 Alex*1626                 ;;
87f48fcc7 Patr*1627         *-wec)
11bb6deb0 Mart*1628                 os=proelf
87f48fcc7 Patr*1629                 ;;
                1630         *-winbond)
11bb6deb0 Mart*1631                 os=proelf
87f48fcc7 Patr*1632                 ;;
                1633         *-oki)
11bb6deb0 Mart*1634                 os=proelf
87f48fcc7 Patr*1635                 ;;
                1636         *-hp)
11bb6deb0 Mart*1637                 os=hpux
87f48fcc7 Patr*1638                 ;;
                1639         *-hitachi)
11bb6deb0 Mart*1640                 os=hiux
87f48fcc7 Patr*1641                 ;;
                1642         i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
11bb6deb0 Mart*1643                 os=sysv
87f48fcc7 Patr*1644                 ;;
                1645         *-cbm)
11bb6deb0 Mart*1646                 os=amigaos
87f48fcc7 Patr*1647                 ;;
                1648         *-dg)
11bb6deb0 Mart*1649                 os=dgux
87f48fcc7 Patr*1650                 ;;
                1651         *-dolphin)
11bb6deb0 Mart*1652                 os=sysv3
87f48fcc7 Patr*1653                 ;;
                1654         m68k-ccur)
11bb6deb0 Mart*1655                 os=rtu
87f48fcc7 Patr*1656                 ;;
                1657         m88k-omron*)
11bb6deb0 Mart*1658                 os=luna
87f48fcc7 Patr*1659                 ;;
f6a1b37d1 Alex*1660         *-next)
11bb6deb0 Mart*1661                 os=nextstep
87f48fcc7 Patr*1662                 ;;
                1663         *-sequent)
11bb6deb0 Mart*1664                 os=ptx
87f48fcc7 Patr*1665                 ;;
                1666         *-crds)
11bb6deb0 Mart*1667                 os=unos
87f48fcc7 Patr*1668                 ;;
                1669         *-ns)
11bb6deb0 Mart*1670                 os=genix
87f48fcc7 Patr*1671                 ;;
                1672         i370-*)
11bb6deb0 Mart*1673                 os=mvs
87f48fcc7 Patr*1674                 ;;
4d9e7036b Alex*1675         *-gould)
11bb6deb0 Mart*1676                 os=sysv
87f48fcc7 Patr*1677                 ;;
4d9e7036b Alex*1678         *-highlevel)
11bb6deb0 Mart*1679                 os=bsd
87f48fcc7 Patr*1680                 ;;
                1681         *-encore)
11bb6deb0 Mart*1682                 os=bsd
87f48fcc7 Patr*1683                 ;;
4d9e7036b Alex*1684         *-sgi)
11bb6deb0 Mart*1685                 os=irix
87f48fcc7 Patr*1686                 ;;
4d9e7036b Alex*1687         *-siemens)
11bb6deb0 Mart*1688                 os=sysv4
87f48fcc7 Patr*1689                 ;;
                1690         *-masscomp)
11bb6deb0 Mart*1691                 os=rtu
87f48fcc7 Patr*1692                 ;;
                1693         f30[01]-fujitsu | f700-fujitsu)
11bb6deb0 Mart*1694                 os=uxpv
87f48fcc7 Patr*1695                 ;;
                1696         *-rom68k)
3aca59945 Alex*1697                 os=
                1698                 obj=coff
87f48fcc7 Patr*1699                 ;;
                1700         *-*bug)
3aca59945 Alex*1701                 os=
                1702                 obj=coff
87f48fcc7 Patr*1703                 ;;
                1704         *-apple)
11bb6deb0 Mart*1705                 os=macos
87f48fcc7 Patr*1706                 ;;
                1707         *-atari*)
11bb6deb0 Mart*1708                 os=mint
                1709                 ;;
                1710         *-wrs)
                1711                 os=vxworks
87f48fcc7 Patr*1712                 ;;
                1713         *)
11bb6deb0 Mart*1714                 os=none
87f48fcc7 Patr*1715                 ;;
                1716 esac
11bb6deb0 Mart*1717 
87f48fcc7 Patr*1718 fi
                1719 
3aca59945 Alex*1720 # Now, validate our (potentially fixed-up) individual pieces (OS, OBJ).
                1721 
11bb6deb0 Mart*1722 case $os in
b9f6d1be0 Alex*1723         # Sometimes we do "kernel-libc", so those need to count as OSes.
                1724         musl* | newlib* | relibc* | uclibc*)
                1725                 ;;
                1726         # Likewise for "kernel-abi"
                1727         eabi* | gnueabi*)
11bb6deb0 Mart*1728                 ;;
b9f6d1be0 Alex*1729         # VxWorks passes extra cpu info in the 4th filed.
                1730         simlinux | simwindows | spe)
11bb6deb0 Mart*1731                 ;;
3aca59945 Alex*1732         # See `case $cpu-$os` validation below
                1733         ghcjs)
                1734                 ;;
11bb6deb0 Mart*1735         # Now accept the basic system types.
                1736         # The portable systems comes first.
                1737         # Each alternative MUST end in a * to match a version number.
                1738         gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
                1739              | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
                1740              | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
                1741              | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
                1742              | hiux* | abug | nacl* | netware* | windows* \
3aca59945 Alex*1743              | os9* | macos* | osx* | ios* | tvos* | watchos* \
11bb6deb0 Mart*1744              | mpw* | magic* | mmixware* | mon960* | lnews* \
                1745              | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
                1746              | aos* | aros* | cloudabi* | sortix* | twizzler* \
                1747              | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
                1748              | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
                1749              | mirbsd* | netbsd* | dicos* | openedition* | ose* \
b9f6d1be0 Alex*1750              | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
11bb6deb0 Mart*1751              | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
3aca59945 Alex*1752              | bosx* | nextstep* | cxux* | oabi* \
                1753              | ptx* | ecoff* | winnt* | domain* | vsta* \
11bb6deb0 Mart*1754              | udi* | lites* | ieee* | go32* | aux* | hcos* \
b9f6d1be0 Alex*1755              | chorusrdb* | cegcc* | glidix* | serenity* \
3aca59945 Alex*1756              | cygwin* | msys* | moss* | proelf* | rtems* \
11bb6deb0 Mart*1757              | midipix* | mingw32* | mingw64* | mint* \
                1758              | uxpv* | beos* | mpeix* | udk* | moxiebox* \
                1759              | interix* | uwin* | mks* | rhapsody* | darwin* \
                1760              | openstep* | oskit* | conix* | pw32* | nonstopux* \
                1761              | storm-chaos* | tops10* | tenex* | tops20* | its* \
                1762              | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
                1763              | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
                1764              | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
                1765              | skyos* | haiku* | rdos* | toppers* | drops* | es* \
                1766              | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
                1767              | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
3aca59945 Alex*1768              | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
                1769              | fiwix* | mlibc* | cos* | mbr* )
11bb6deb0 Mart*1770                 ;;
                1771         # This one is extra strict with allowed versions
                1772         sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
                1773                 # Don't forget version if it is 3.2v4 or newer.
                1774                 ;;
                1775         none)
                1776                 ;;
3aca59945 Alex*1777         kernel* | msvc* )
                1778                 # Restricted further below
                1779                 ;;
                1780         '')
                1781                 if test x"$obj" = x
                1782                 then
                1783                         echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2
                1784                 fi
                1785                 ;;
                1786         *)
                1787                 echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2
                1788                 exit 1
                1789                 ;;
                1790 esac
                1791 
                1792 case $obj in
                1793         aout* | coff* | elf* | pe*)
                1794                 ;;
                1795         '')
                1796                 # empty is fine
                1797                 ;;
11bb6deb0 Mart*1798         *)
3aca59945 Alex*1799                 echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2
                1800                 exit 1
                1801                 ;;
                1802 esac
                1803 
                1804 # Here we handle the constraint that a (synthetic) cpu and os are
                1805 # valid only in combination with each other and nowhere else.
                1806 case $cpu-$os in
                1807         # The "javascript-unknown-ghcjs" triple is used by GHC; we
                1808         # accept it here in order to tolerate that, but reject any
                1809         # variations.
                1810         javascript-ghcjs)
                1811                 ;;
                1812         javascript-* | *-ghcjs)
                1813                 echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2
11bb6deb0 Mart*1814                 exit 1
                1815                 ;;
                1816 esac
                1817 
                1818 # As a final step for OS-related things, validate the OS-kernel combination
                1819 # (given a valid OS), if there is a kernel.
3aca59945 Alex*1820 case $kernel-$os-$obj in
                1821         linux-gnu*- | linux-dietlibc*- | linux-android*- | linux-newlib*- \
                1822                    | linux-musl*- | linux-relibc*- | linux-uclibc*- | linux-mlibc*- )
                1823                 ;;
                1824         uclinux-uclibc*- )
                1825                 ;;
                1826         managarm-mlibc*- | managarm-kernel*- )
11bb6deb0 Mart*1827                 ;;
3aca59945 Alex*1828         windows*-msvc*-)
b9f6d1be0 Alex*1829                 ;;
3aca59945 Alex*1830         -dietlibc*- | -newlib*- | -musl*- | -relibc*- | -uclibc*- | -mlibc*- )
11bb6deb0 Mart*1831                 # These are just libc implementations, not actual OSes, and thus
                1832                 # require a kernel.
3aca59945 Alex*1833                 echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2
11bb6deb0 Mart*1834                 exit 1
                1835                 ;;
3aca59945 Alex*1836         -kernel*- )
                1837                 echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2
                1838                 exit 1
11bb6deb0 Mart*1839                 ;;
3aca59945 Alex*1840         *-kernel*- )
                1841                 echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2
                1842                 exit 1
b9f6d1be0 Alex*1843                 ;;
3aca59945 Alex*1844         *-msvc*- )
                1845                 echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2
                1846                 exit 1
11bb6deb0 Mart*1847                 ;;
3aca59945 Alex*1848         kfreebsd*-gnu*- | kopensolaris*-gnu*-)
                1849                 ;;
                1850         vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-)
                1851                 ;;
                1852         nto-qnx*-)
                1853                 ;;
                1854         os2-emx-)
b9f6d1be0 Alex*1855                 ;;
3aca59945 Alex*1856         *-eabi*- | *-gnueabi*-)
11bb6deb0 Mart*1857                 ;;
3aca59945 Alex*1858         none--*)
                1859                 # None (no kernel, i.e. freestanding / bare metal),
                1860                 # can be paired with an machine code file format
                1861                 ;;
                1862         -*-)
11bb6deb0 Mart*1863                 # Blank kernel with real OS is always fine.
                1864                 ;;
3aca59945 Alex*1865         --*)
                1866                 # Blank kernel and OS with real machine code file format is always fine.
                1867                 ;;
                1868         *-*-*)
                1869                 echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2
11bb6deb0 Mart*1870                 exit 1
                1871                 ;;
                1872 esac
                1873 
87f48fcc7 Patr*1874 # Here we handle the case where we know the os, and the CPU type, but not the
                1875 # manufacturer.  We pick the logical manufacturer.
11bb6deb0 Mart*1876 case $vendor in
                1877         unknown)
                1878                 case $cpu-$os in
                1879                         *-riscix*)
87f48fcc7 Patr*1880                                 vendor=acorn
                1881                                 ;;
11bb6deb0 Mart*1882                         *-sunos*)
87f48fcc7 Patr*1883                                 vendor=sun
                1884                                 ;;
11bb6deb0 Mart*1885                         *-cnk* | *-aix*)
87f48fcc7 Patr*1886                                 vendor=ibm
                1887                                 ;;
11bb6deb0 Mart*1888                         *-beos*)
87f48fcc7 Patr*1889                                 vendor=be
                1890                                 ;;
11bb6deb0 Mart*1891                         *-hpux*)
87f48fcc7 Patr*1892                                 vendor=hp
                1893                                 ;;
11bb6deb0 Mart*1894                         *-mpeix*)
87f48fcc7 Patr*1895                                 vendor=hp
                1896                                 ;;
11bb6deb0 Mart*1897                         *-hiux*)
87f48fcc7 Patr*1898                                 vendor=hitachi
                1899                                 ;;
11bb6deb0 Mart*1900                         *-unos*)
87f48fcc7 Patr*1901                                 vendor=crds
                1902                                 ;;
11bb6deb0 Mart*1903                         *-dgux*)
87f48fcc7 Patr*1904                                 vendor=dg
                1905                                 ;;
11bb6deb0 Mart*1906                         *-luna*)
87f48fcc7 Patr*1907                                 vendor=omron
                1908                                 ;;
11bb6deb0 Mart*1909                         *-genix*)
87f48fcc7 Patr*1910                                 vendor=ns
                1911                                 ;;
11bb6deb0 Mart*1912                         *-clix*)
                1913                                 vendor=intergraph
                1914                                 ;;
                1915                         *-mvs* | *-opened*)
                1916                                 vendor=ibm
                1917                                 ;;
                1918                         *-os400*)
87f48fcc7 Patr*1919                                 vendor=ibm
                1920                                 ;;
11bb6deb0 Mart*1921                         s390-* | s390x-*)
c67a307b8 Alex*1922                                 vendor=ibm
                1923                                 ;;
11bb6deb0 Mart*1924                         *-ptx*)
87f48fcc7 Patr*1925                                 vendor=sequent
                1926                                 ;;
11bb6deb0 Mart*1927                         *-tpf*)
c67a307b8 Alex*1928                                 vendor=ibm
                1929                                 ;;
11bb6deb0 Mart*1930                         *-vxsim* | *-vxworks* | *-windiss*)
87f48fcc7 Patr*1931                                 vendor=wrs
                1932                                 ;;
11bb6deb0 Mart*1933                         *-aux*)
87f48fcc7 Patr*1934                                 vendor=apple
                1935                                 ;;
11bb6deb0 Mart*1936                         *-hms*)
87f48fcc7 Patr*1937                                 vendor=hitachi
                1938                                 ;;
11bb6deb0 Mart*1939                         *-mpw* | *-macos*)
87f48fcc7 Patr*1940                                 vendor=apple
                1941                                 ;;
11bb6deb0 Mart*1942                         *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
87f48fcc7 Patr*1943                                 vendor=atari
                1944                                 ;;
11bb6deb0 Mart*1945                         *-vos*)
fb2b1c85b Alex*1946                                 vendor=stratus
                1947                                 ;;
87f48fcc7 Patr*1948                 esac
                1949                 ;;
                1950 esac
                1951 
3aca59945 Alex*1952 echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}"
5c0dde779 Alex*1953 exit
87f48fcc7 Patr*1954 
                1955 # Local variables:
11bb6deb0 Mart*1956 # eval: (add-hook 'before-save-hook 'time-stamp)
87f48fcc7 Patr*1957 # time-stamp-start: "timestamp='"
                1958 # time-stamp-format: "%:y-%02m-%02d"
                1959 # time-stamp-end: "'"
                1960 # End: