ncurses 6.2 - patch 20210515
[ncurses.git] / config.sub
1 #! /bin/sh
2 # Configuration validation subroutine script.
3 #   Copyright 2021 Thomas E. Dickey
4 #   Copyright 1992-2021 Free Software Foundation, Inc.
5
6 timestamp='2021-03-10'
7
8 # This file is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 # General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, see <https://www.gnu.org/licenses/>.
20 #
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that
25 # program.  This Exception is an additional permission under section 7
26 # of the GNU General Public License, version 3 ("GPLv3").
27
28
29 # Please send patches to <config-patches@gnu.org>.
30 #
31 # Configuration subroutine to validate and canonicalize a configuration type.
32 # Supply the specified configuration type as an argument.
33 # If it is invalid, we print an error message on stderr and exit with code 1.
34 # Otherwise, we print the canonical config type on stdout and succeed.
35
36 # You can get the latest version of this script from:
37 # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
38
39 # This file is supposed to be the same for all GNU packages
40 # and recognize all the CPU types, system types and aliases
41 # that are meaningful with *any* GNU software.
42 # Each package is responsible for reporting which valid configurations
43 # it does not support.  The user should be able to distinguish
44 # a failure to support a valid configuration from a meaningless
45 # configuration.
46
47 # The goal of this file is to map all the various variations of a given
48 # machine specification into a single specification in the form:
49 #       CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
50 # or in some cases, the newer four-part form:
51 #       CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
52 # It is wrong to echo any other type of specification.
53
54 me=`echo "$0" | sed -e 's,.*/,,'`
55
56 usage="\
57 Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
58
59 Canonicalize a configuration name.
60
61 Options:
62   -h, --help         print this help, then exit
63   -t, --time-stamp   print date of last modification, then exit
64   -v, --version      print version number, then exit
65
66 Report bugs and patches to <config-patches@gnu.org>."
67
68 version="\
69 GNU config.sub ($timestamp)
70
71 Copyright 1992-2021 Free Software Foundation, Inc.
72
73 This is free software; see the source for copying conditions.  There is NO
74 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
75
76 help="
77 Try \`$me --help' for more information."
78
79 # Parse command line
80 while test $# -gt 0 ; do
81   case $1 in
82     --time-stamp | --time* | -t )
83        echo "$timestamp" ; exit ;;
84     --version | -v )
85        echo "$version" ; exit ;;
86     --help | --h* | -h )
87        echo "$usage"; exit ;;
88     -- )     # Stop option processing
89        shift; break ;;
90     - ) # Use stdin as input.
91        break ;;
92     -* )
93        echo "$me: invalid option $1$help" >&2
94        exit 1 ;;
95
96     *local*)
97        # First pass through any local machine types.
98        echo "$1"
99        exit ;;
100
101     * )
102        break ;;
103   esac
104 done
105
106 case $# in
107  0) echo "$me: missing argument$help" >&2
108     exit 1;;
109  1) ;;
110  *) echo "$me: too many arguments$help" >&2
111     exit 1;;
112 esac
113
114 # Split fields of configuration type
115 # shellcheck disable=SC2162
116 IFS="-" read field1 field2 field3 field4 <<EOF
117 $1
118 EOF
119
120 # Separate into logical components for further validation
121 case $1 in
122         *-*-*-*-*)
123                 echo Invalid configuration \`"$1"\': more than four components >&2
124                 exit 1
125                 ;;
126         *-*-*-*)
127                 basic_machine=$field1-$field2
128                 basic_os=$field3-$field4
129                 ;;
130         *-*-*)
131                 # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
132                 # parts
133                 maybe_os=$field2-$field3
134                 case $maybe_os in
135                         nto-qnx* | linux-* | uclinux-uclibc* \
136                         | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
137                         | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
138                         | storm-chaos* | os2-emx* | rtmk-nova*)
139                                 basic_machine=$field1
140                                 basic_os=$maybe_os
141                                 ;;
142                         android-linux)
143                                 basic_machine=$field1-unknown
144                                 basic_os=linux-android
145                                 ;;
146                         *)
147                                 basic_machine=$field1-$field2
148                                 basic_os=$field3
149                                 ;;
150                 esac
151                 ;;
152         *-*)
153                 # A lone config we happen to match not fitting any pattern
154                 case $field1-$field2 in
155                         decstation-3100)
156                                 basic_machine=mips-dec
157                                 basic_os=
158                                 ;;
159                         *-*)
160                                 # Second component is usually, but not always the OS
161                                 case $field2 in
162                                         # Prevent following clause from handling this valid os
163                                         sun*os*)
164                                                 basic_machine=$field1
165                                                 basic_os=$field2
166                                                 ;;
167                                         # Manufacturers
168                                         dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
169                                         | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
170                                         | unicom* | ibm* | next | hp | isi* | apollo | altos* \
171                                         | convergent* | ncr* | news | 32* | 3600* | 3100* \
172                                         | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
173                                         | ultra | tti* | harris | dolphin | highlevel | gould \
174                                         | cbm | ns | masscomp | apple | axis | knuth | cray \
175                                         | microblaze* | sim | cisco \
176                                         | oki | wec | wrs | winbond)
177                                                 basic_machine=$field1-$field2
178                                                 basic_os=
179                                                 ;;
180                                         *)
181                                                 basic_machine=$field1
182                                                 basic_os=$field2
183                                                 ;;
184                                 esac
185                         ;;
186                 esac
187                 ;;
188         *)
189                 # Convert single-component short-hands not valid as part of
190                 # multi-component configurations.
191                 case $field1 in
192                         386bsd)
193                                 basic_machine=i386-pc
194                                 basic_os=bsd
195                                 ;;
196                         a29khif)
197                                 basic_machine=a29k-amd
198                                 basic_os=udi
199                                 ;;
200                         adobe68k)
201                                 basic_machine=m68010-adobe
202                                 basic_os=scout
203                                 ;;
204                         alliant)
205                                 basic_machine=fx80-alliant
206                                 basic_os=
207                                 ;;
208                         altos | altos3068)
209                                 basic_machine=m68k-altos
210                                 basic_os=
211                                 ;;
212                         am29k)
213                                 basic_machine=a29k-none
214                                 basic_os=bsd
215                                 ;;
216                         amdahl)
217                                 basic_machine=580-amdahl
218                                 basic_os=sysv
219                                 ;;
220                         amiga)
221                                 basic_machine=m68k-unknown
222                                 basic_os=
223                                 ;;
224                         amigaos | amigados)
225                                 basic_machine=m68k-unknown
226                                 basic_os=amigaos
227                                 ;;
228                         amigaunix | amix)
229                                 basic_machine=m68k-unknown
230                                 basic_os=sysv4
231                                 ;;
232                         apollo68)
233                                 basic_machine=m68k-apollo
234                                 basic_os=sysv
235                                 ;;
236                         apollo68bsd)
237                                 basic_machine=m68k-apollo
238                                 basic_os=bsd
239                                 ;;
240                         aros)
241                                 basic_machine=i386-pc
242                                 basic_os=aros
243                                 ;;
244                         aux)
245                                 basic_machine=m68k-apple
246                                 basic_os=aux
247                                 ;;
248                         balance)
249                                 basic_machine=ns32k-sequent
250                                 basic_os=dynix
251                                 ;;
252                         blackfin)
253                                 basic_machine=bfin-unknown
254                                 basic_os=linux
255                                 ;;
256                         cegcc)
257                                 basic_machine=arm-unknown
258                                 basic_os=cegcc
259                                 ;;
260                         convex-c1)
261                                 basic_machine=c1-convex
262                                 basic_os=bsd
263                                 ;;
264                         convex-c2)
265                                 basic_machine=c2-convex
266                                 basic_os=bsd
267                                 ;;
268                         convex-c32)
269                                 basic_machine=c32-convex
270                                 basic_os=bsd
271                                 ;;
272                         convex-c34)
273                                 basic_machine=c34-convex
274                                 basic_os=bsd
275                                 ;;
276                         convex-c38)
277                                 basic_machine=c38-convex
278                                 basic_os=bsd
279                                 ;;
280                         cray)
281                                 basic_machine=j90-cray
282                                 basic_os=unicos
283                                 ;;
284                         crds | unos)
285                                 basic_machine=m68k-crds
286                                 basic_os=
287                                 ;;
288                         da30)
289                                 basic_machine=m68k-da30
290                                 basic_os=
291                                 ;;
292                         decstation | pmax | pmin | dec3100 | decstatn)
293                                 basic_machine=mips-dec
294                                 basic_os=
295                                 ;;
296                         delta88)
297                                 basic_machine=m88k-motorola
298                                 basic_os=sysv3
299                                 ;;
300                         dicos)
301                                 basic_machine=i686-pc
302                                 basic_os=dicos
303                                 ;;
304                         djgpp)
305                                 basic_machine=i586-pc
306                                 basic_os=msdosdjgpp
307                                 ;;
308                         ebmon29k)
309                                 basic_machine=a29k-amd
310                                 basic_os=ebmon
311                                 ;;
312                         es1800 | OSE68k | ose68k | ose | OSE)
313                                 basic_machine=m68k-ericsson
314                                 basic_os=ose
315                                 ;;
316                         gmicro)
317                                 basic_machine=tron-gmicro
318                                 basic_os=sysv
319                                 ;;
320                         go32)
321                                 basic_machine=i386-pc
322                                 basic_os=go32
323                                 ;;
324                         h8300hms)
325                                 basic_machine=h8300-hitachi
326                                 basic_os=hms
327                                 ;;
328                         h8300xray)
329                                 basic_machine=h8300-hitachi
330                                 basic_os=xray
331                                 ;;
332                         h8500hms)
333                                 basic_machine=h8500-hitachi
334                                 basic_os=hms
335                                 ;;
336                         harris)
337                                 basic_machine=m88k-harris
338                                 basic_os=sysv3
339                                 ;;
340                         hp300 | hp300hpux)
341                                 basic_machine=m68k-hp
342                                 basic_os=hpux
343                                 ;;
344                         hp300bsd)
345                                 basic_machine=m68k-hp
346                                 basic_os=bsd
347                                 ;;
348                         hppaosf)
349                                 basic_machine=hppa1.1-hp
350                                 basic_os=osf
351                                 ;;
352                         hppro)
353                                 basic_machine=hppa1.1-hp
354                                 basic_os=proelf
355                                 ;;
356                         i386mach)
357                                 basic_machine=i386-mach
358                                 basic_os=mach
359                                 ;;
360                         isi68 | isi)
361                                 basic_machine=m68k-isi
362                                 basic_os=sysv
363                                 ;;
364                         m68knommu)
365                                 basic_machine=m68k-unknown
366                                 basic_os=linux
367                                 ;;
368                         magnum | m3230)
369                                 basic_machine=mips-mips
370                                 basic_os=sysv
371                                 ;;
372                         merlin)
373                                 basic_machine=ns32k-utek
374                                 basic_os=sysv
375                                 ;;
376                         mingw64)
377                                 basic_machine=x86_64-pc
378                                 basic_os=mingw64
379                                 ;;
380                         mingw32)
381                                 basic_machine=i686-pc
382                                 basic_os=mingw32
383                                 ;;
384                         mingw32ce)
385                                 basic_machine=arm-unknown
386                                 basic_os=mingw32ce
387                                 ;;
388                         monitor)
389                                 basic_machine=m68k-rom68k
390                                 basic_os=coff
391                                 ;;
392                         morphos)
393                                 basic_machine=powerpc-unknown
394                                 basic_os=morphos
395                                 ;;
396                         moxiebox)
397                                 basic_machine=moxie-unknown
398                                 basic_os=moxiebox
399                                 ;;
400                         msdos)
401                                 basic_machine=i386-pc
402                                 basic_os=msdos
403                                 ;;
404                         msys)
405                                 basic_machine=i686-pc
406                                 basic_os=msys
407                                 ;;
408                         mvs)
409                                 basic_machine=i370-ibm
410                                 basic_os=mvs
411                                 ;;
412                         nacl)
413                                 basic_machine=le32-unknown
414                                 basic_os=nacl
415                                 ;;
416                         ncr3000)
417                                 basic_machine=i486-ncr
418                                 basic_os=sysv4
419                                 ;;
420                         netbsd386)
421                                 basic_machine=i386-pc
422                                 basic_os=netbsd
423                                 ;;
424                         netwinder)
425                                 basic_machine=armv4l-rebel
426                                 basic_os=linux
427                                 ;;
428                         news | news700 | news800 | news900)
429                                 basic_machine=m68k-sony
430                                 basic_os=newsos
431                                 ;;
432                         news1000)
433                                 basic_machine=m68030-sony
434                                 basic_os=newsos
435                                 ;;
436                         necv70)
437                                 basic_machine=v70-nec
438                                 basic_os=sysv
439                                 ;;
440                         nh3000)
441                                 basic_machine=m68k-harris
442                                 basic_os=cxux
443                                 ;;
444                         nh[45]000)
445                                 basic_machine=m88k-harris
446                                 basic_os=cxux
447                                 ;;
448                         nindy960)
449                                 basic_machine=i960-intel
450                                 basic_os=nindy
451                                 ;;
452                         mon960)
453                                 basic_machine=i960-intel
454                                 basic_os=mon960
455                                 ;;
456                         nonstopux)
457                                 basic_machine=mips-compaq
458                                 basic_os=nonstopux
459                                 ;;
460                         os400)
461                                 basic_machine=powerpc-ibm
462                                 basic_os=os400
463                                 ;;
464                         OSE68000 | ose68000)
465                                 basic_machine=m68000-ericsson
466                                 basic_os=ose
467                                 ;;
468                         os68k)
469                                 basic_machine=m68k-none
470                                 basic_os=os68k
471                                 ;;
472                         paragon)
473                                 basic_machine=i860-intel
474                                 basic_os=osf
475                                 ;;
476                         parisc)
477                                 basic_machine=hppa-unknown
478                                 basic_os=linux
479                                 ;;
480                         psp)
481                                 basic_machine=mipsallegrexel-sony
482                                 basic_os=psp
483                                 ;;
484                         pw32)
485                                 basic_machine=i586-unknown
486                                 basic_os=pw32
487                                 ;;
488                         rdos | rdos64)
489                                 basic_machine=x86_64-pc
490                                 basic_os=rdos
491                                 ;;
492                         rdos32)
493                                 basic_machine=i386-pc
494                                 basic_os=rdos
495                                 ;;
496                         rom68k)
497                                 basic_machine=m68k-rom68k
498                                 basic_os=coff
499                                 ;;
500                         sa29200)
501                                 basic_machine=a29k-amd
502                                 basic_os=udi
503                                 ;;
504                         sei)
505                                 basic_machine=mips-sei
506                                 basic_os=seiux
507                                 ;;
508                         sequent)
509                                 basic_machine=i386-sequent
510                                 basic_os=
511                                 ;;
512                         sps7)
513                                 basic_machine=m68k-bull
514                                 basic_os=sysv2
515                                 ;;
516                         st2000)
517                                 basic_machine=m68k-tandem
518                                 basic_os=
519                                 ;;
520                         stratus)
521                                 basic_machine=i860-stratus
522                                 basic_os=sysv4
523                                 ;;
524                         sun2)
525                                 basic_machine=m68000-sun
526                                 basic_os=
527                                 ;;
528                         sun2os3)
529                                 basic_machine=m68000-sun
530                                 basic_os=sunos3
531                                 ;;
532                         sun2os4)
533                                 basic_machine=m68000-sun
534                                 basic_os=sunos4
535                                 ;;
536                         sun3)
537                                 basic_machine=m68k-sun
538                                 basic_os=
539                                 ;;
540                         sun3os3)
541                                 basic_machine=m68k-sun
542                                 basic_os=sunos3
543                                 ;;
544                         sun3os4)
545                                 basic_machine=m68k-sun
546                                 basic_os=sunos4
547                                 ;;
548                         sun4)
549                                 basic_machine=sparc-sun
550                                 basic_os=
551                                 ;;
552                         sun4os3)
553                                 basic_machine=sparc-sun
554                                 basic_os=sunos3
555                                 ;;
556                         sun4os4)
557                                 basic_machine=sparc-sun
558                                 basic_os=sunos4
559                                 ;;
560                         sun4sol2)
561                                 basic_machine=sparc-sun
562                                 basic_os=solaris2
563                                 ;;
564                         sun386 | sun386i | roadrunner)
565                                 basic_machine=i386-sun
566                                 basic_os=
567                                 ;;
568                         sv1)
569                                 basic_machine=sv1-cray
570                                 basic_os=unicos
571                                 ;;
572                         symmetry)
573                                 basic_machine=i386-sequent
574                                 basic_os=dynix
575                                 ;;
576                         t3e)
577                                 basic_machine=alphaev5-cray
578                                 basic_os=unicos
579                                 ;;
580                         t90)
581                                 basic_machine=t90-cray
582                                 basic_os=unicos
583                                 ;;
584                         toad1)
585                                 basic_machine=pdp10-xkl
586                                 basic_os=tops20
587                                 ;;
588                         tpf)
589                                 basic_machine=s390x-ibm
590                                 basic_os=tpf
591                                 ;;
592                         udi29k)
593                                 basic_machine=a29k-amd
594                                 basic_os=udi
595                                 ;;
596                         ultra3)
597                                 basic_machine=a29k-nyu
598                                 basic_os=sym1
599                                 ;;
600                         v810 | necv810)
601                                 basic_machine=v810-nec
602                                 basic_os=none
603                                 ;;
604                         vaxv)
605                                 basic_machine=vax-dec
606                                 basic_os=sysv
607                                 ;;
608                         vms)
609                                 basic_machine=vax-dec
610                                 basic_os=vms
611                                 ;;
612                         vsta)
613                                 basic_machine=i386-pc
614                                 basic_os=vsta
615                                 ;;
616                         vxworks960)
617                                 basic_machine=i960-wrs
618                                 basic_os=vxworks
619                                 ;;
620                         vxworks68)
621                                 basic_machine=m68k-wrs
622                                 basic_os=vxworks
623                                 ;;
624                         vxworks29k)
625                                 basic_machine=a29k-wrs
626                                 basic_os=vxworks
627                                 ;;
628                         xbox)
629                                 basic_machine=i686-pc
630                                 basic_os=mingw32
631                                 ;;
632                         ymp)
633                                 basic_machine=ymp-cray
634                                 basic_os=unicos
635                                 ;;
636                         *)
637                                 basic_machine=$1
638                                 basic_os=
639                                 ;;
640                 esac
641                 ;;
642 esac
643
644 # Decode 1-component or ad-hoc basic machines
645 case $basic_machine in
646         # Here we handle the default manufacturer of certain CPU types.  It is in
647         # some cases the only manufacturer, in others, it is the most popular.
648         w89k)
649                 cpu=hppa1.1
650                 vendor=winbond
651                 ;;
652         op50n)
653                 cpu=hppa1.1
654                 vendor=oki
655                 ;;
656         op60c)
657                 cpu=hppa1.1
658                 vendor=oki
659                 ;;
660         ibm*)
661                 cpu=i370
662                 vendor=ibm
663                 ;;
664         orion105)
665                 cpu=clipper
666                 vendor=highlevel
667                 ;;
668         mac | mpw | mac-mpw)
669                 cpu=m68k
670                 vendor=apple
671                 ;;
672         pmac | pmac-mpw)
673                 cpu=powerpc
674                 vendor=apple
675                 ;;
676
677         # Recognize the various machine names and aliases which stand
678         # for a CPU type and a company and sometimes even an OS.
679         3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
680                 cpu=m68000
681                 vendor=att
682                 ;;
683         3b*)
684                 cpu=we32k
685                 vendor=att
686                 ;;
687         bluegene*)
688                 cpu=powerpc
689                 vendor=ibm
690                 basic_os=cnk
691                 ;;
692         decsystem10* | dec10*)
693                 cpu=pdp10
694                 vendor=dec
695                 basic_os=tops10
696                 ;;
697         decsystem20* | dec20*)
698                 cpu=pdp10
699                 vendor=dec
700                 basic_os=tops20
701                 ;;
702         delta | 3300 | motorola-3300 | motorola-delta \
703               | 3300-motorola | delta-motorola)
704                 cpu=m68k
705                 vendor=motorola
706                 ;;
707         dpx2*)
708                 cpu=m68k
709                 vendor=bull
710                 basic_os=sysv3
711                 ;;
712         encore | umax | mmax)
713                 cpu=ns32k
714                 vendor=encore
715                 ;;
716         elxsi)
717                 cpu=elxsi
718                 vendor=elxsi
719                 basic_os=${basic_os:-bsd}
720                 ;;
721         fx2800)
722                 cpu=i860
723                 vendor=alliant
724                 ;;
725         genix)
726                 cpu=ns32k
727                 vendor=ns
728                 ;;
729         h3050r* | hiux*)
730                 cpu=hppa1.1
731                 vendor=hitachi
732                 basic_os=hiuxwe2
733                 ;;
734         hp3k9[0-9][0-9] | hp9[0-9][0-9])
735                 cpu=hppa1.0
736                 vendor=hp
737                 ;;
738         hp9k2[0-9][0-9] | hp9k31[0-9])
739                 cpu=m68000
740                 vendor=hp
741                 ;;
742         hp9k3[2-9][0-9])
743                 cpu=m68k
744                 vendor=hp
745                 ;;
746         hp9k6[0-9][0-9] | hp6[0-9][0-9])
747                 cpu=hppa1.0
748                 vendor=hp
749                 ;;
750         hp9k7[0-79][0-9] | hp7[0-79][0-9])
751                 cpu=hppa1.1
752                 vendor=hp
753                 ;;
754         hp9k78[0-9] | hp78[0-9])
755                 # FIXME: really hppa2.0-hp
756                 cpu=hppa1.1
757                 vendor=hp
758                 ;;
759         hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
760                 # FIXME: really hppa2.0-hp
761                 cpu=hppa1.1
762                 vendor=hp
763                 ;;
764         hp9k8[0-9][13679] | hp8[0-9][13679])
765                 cpu=hppa1.1
766                 vendor=hp
767                 ;;
768         hp9k8[0-9][0-9] | hp8[0-9][0-9])
769                 cpu=hppa1.0
770                 vendor=hp
771                 ;;
772         i*86v32)
773                 cpu=`echo "$1" | sed -e 's/86.*/86/'`
774                 vendor=pc
775                 basic_os=sysv32
776                 ;;
777         i*86v4*)
778                 cpu=`echo "$1" | sed -e 's/86.*/86/'`
779                 vendor=pc
780                 basic_os=sysv4
781                 ;;
782         i*86v)
783                 cpu=`echo "$1" | sed -e 's/86.*/86/'`
784                 vendor=pc
785                 basic_os=sysv
786                 ;;
787         i*86sol2)
788                 cpu=`echo "$1" | sed -e 's/86.*/86/'`
789                 vendor=pc
790                 basic_os=solaris2
791                 ;;
792         j90 | j90-cray)
793                 cpu=j90
794                 vendor=cray
795                 basic_os=${basic_os:-unicos}
796                 ;;
797         iris | iris4d)
798                 cpu=mips
799                 vendor=sgi
800                 case $basic_os in
801                     irix*)
802                         ;;
803                     *)
804                         basic_os=irix4
805                         ;;
806                 esac
807                 ;;
808         miniframe)
809                 cpu=m68000
810                 vendor=convergent
811                 ;;
812         *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
813                 cpu=m68k
814                 vendor=atari
815                 basic_os=mint
816                 ;;
817         news-3600 | risc-news)
818                 cpu=mips
819                 vendor=sony
820                 basic_os=newsos
821                 ;;
822         next | m*-next)
823                 cpu=m68k
824                 vendor=next
825                 case $basic_os in
826                     openstep*)
827                         ;;
828                     nextstep*)
829                         ;;
830                     ns2*)
831                       basic_os=nextstep2
832                         ;;
833                     *)
834                       basic_os=nextstep3
835                         ;;
836                 esac
837                 ;;
838         np1)
839                 cpu=np1
840                 vendor=gould
841                 ;;
842         op50n-* | op60c-*)
843                 cpu=hppa1.1
844                 vendor=oki
845                 basic_os=proelf
846                 ;;
847         pa-hitachi)
848                 cpu=hppa1.1
849                 vendor=hitachi
850                 basic_os=hiuxwe2
851                 ;;
852         pbd)
853                 cpu=sparc
854                 vendor=tti
855                 ;;
856         pbb)
857                 cpu=m68k
858                 vendor=tti
859                 ;;
860         pc532)
861                 cpu=ns32k
862                 vendor=pc532
863                 ;;
864         pn)
865                 cpu=pn
866                 vendor=gould
867                 ;;
868         power)
869                 cpu=power
870                 vendor=ibm
871                 ;;
872         ps2)
873                 cpu=i386
874                 vendor=ibm
875                 ;;
876         rm[46]00)
877                 cpu=mips
878                 vendor=siemens
879                 ;;
880         rtpc | rtpc-*)
881                 cpu=romp
882                 vendor=ibm
883                 ;;
884         sde)
885                 cpu=mipsisa32
886                 vendor=sde
887                 basic_os=${basic_os:-elf}
888                 ;;
889         simso-wrs)
890                 cpu=sparclite
891                 vendor=wrs
892                 basic_os=vxworks
893                 ;;
894         tower | tower-32)
895                 cpu=m68k
896                 vendor=ncr
897                 ;;
898         vpp*|vx|vx-*)
899                 cpu=f301
900                 vendor=fujitsu
901                 ;;
902         w65)
903                 cpu=w65
904                 vendor=wdc
905                 ;;
906         w89k-*)
907                 cpu=hppa1.1
908                 vendor=winbond
909                 basic_os=proelf
910                 ;;
911         none)
912                 cpu=none
913                 vendor=none
914                 ;;
915         leon|leon[3-9])
916                 cpu=sparc
917                 vendor=$basic_machine
918                 ;;
919         leon-*|leon[3-9]-*)
920                 cpu=sparc
921                 vendor=`echo "$basic_machine" | sed 's/-.*//'`
922                 ;;
923
924         *-*)
925                 # shellcheck disable=SC2162
926                 IFS="-" read cpu vendor <<EOF
927 $basic_machine
928 EOF
929                 ;;
930         # We use `pc' rather than `unknown'
931         # because (1) that's what they normally are, and
932         # (2) the word "unknown" tends to confuse beginning users.
933         i*86 | x86_64)
934                 cpu=$basic_machine
935                 vendor=pc
936                 ;;
937         # These rules are duplicated from below for sake of the special case above;
938         # i.e. things that normalized to x86 arches should also default to "pc"
939         pc98)
940                 cpu=i386
941                 vendor=pc
942                 ;;
943         x64 | amd64)
944                 cpu=x86_64
945                 vendor=pc
946                 ;;
947         # Recognize the basic CPU types without company name.
948         *)
949                 cpu=$basic_machine
950                 vendor=unknown
951                 ;;
952 esac
953
954 unset -v basic_machine
955
956 # Decode basic machines in the full and proper CPU-Company form.
957 case $cpu-$vendor in
958         # Here we handle the default manufacturer of certain CPU types in canonical form. It is in
959         # some cases the only manufacturer, in others, it is the most popular.
960         craynv-unknown)
961                 vendor=cray
962                 basic_os=${basic_os:-unicosmp}
963                 ;;
964         c90-unknown | c90-cray)
965                 vendor=cray
966                 basic_os=${Basic_os:-unicos}
967                 ;;
968         fx80-unknown)
969                 vendor=alliant
970                 ;;
971         romp-unknown)
972                 vendor=ibm
973                 ;;
974         mmix-unknown)
975                 vendor=knuth
976                 ;;
977         microblaze-unknown | microblazeel-unknown)
978                 vendor=xilinx
979                 ;;
980         rs6000-unknown)
981                 vendor=ibm
982                 ;;
983         vax-unknown)
984                 vendor=dec
985                 ;;
986         pdp11-unknown)
987                 vendor=dec
988                 ;;
989         we32k-unknown)
990                 vendor=att
991                 ;;
992         cydra-unknown)
993                 vendor=cydrome
994                 ;;
995         i370-ibm*)
996                 vendor=ibm
997                 ;;
998         orion-unknown)
999                 vendor=highlevel
1000                 ;;
1001         xps-unknown | xps100-unknown)
1002                 cpu=xps100
1003                 vendor=honeywell
1004                 ;;
1005
1006         # Here we normalize CPU types with a missing or matching vendor
1007         dpx20-unknown | dpx20-bull)
1008                 cpu=rs6000
1009                 vendor=bull
1010                 basic_os=${basic_os:-bosx}
1011                 ;;
1012
1013         # Here we normalize CPU types irrespective of the vendor
1014         amd64-*)
1015                 cpu=x86_64
1016                 ;;
1017         blackfin-*)
1018                 cpu=bfin
1019                 basic_os=linux
1020                 ;;
1021         c54x-*)
1022                 cpu=tic54x
1023                 ;;
1024         c55x-*)
1025                 cpu=tic55x
1026                 ;;
1027         c6x-*)
1028                 cpu=tic6x
1029                 ;;
1030         e500v[12]-*)
1031                 cpu=powerpc
1032                 basic_os=${basic_os}"spe"
1033                 ;;
1034         mips3*-*)
1035                 cpu=mips64
1036                 ;;
1037         ms1-*)
1038                 cpu=mt
1039                 ;;
1040         m68knommu-*)
1041                 cpu=m68k
1042                 basic_os=linux
1043                 ;;
1044         m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
1045                 cpu=s12z
1046                 ;;
1047         openrisc-*)
1048                 cpu=or32
1049                 ;;
1050         parisc-*)
1051                 cpu=hppa
1052                 basic_os=linux
1053                 ;;
1054         pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
1055                 cpu=i586
1056                 ;;
1057         pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
1058                 cpu=i686
1059                 ;;
1060         pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
1061                 cpu=i686
1062                 ;;
1063         pentium4-*)
1064                 cpu=i786
1065                 ;;
1066         pc98-*)
1067                 cpu=i386
1068                 ;;
1069         ppc-* | ppcbe-*)
1070                 cpu=powerpc
1071                 ;;
1072         ppcle-* | powerpclittle-*)
1073                 cpu=powerpcle
1074                 ;;
1075         ppc64-*)
1076                 cpu=powerpc64
1077                 ;;
1078         ppc64le-* | powerpc64little-*)
1079                 cpu=powerpc64le
1080                 ;;
1081         sb1-*)
1082                 cpu=mipsisa64sb1
1083                 ;;
1084         sb1el-*)
1085                 cpu=mipsisa64sb1el
1086                 ;;
1087         sh5e[lb]-*)
1088                 cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
1089                 ;;
1090         spur-*)
1091                 cpu=spur
1092                 ;;
1093         strongarm-* | thumb-*)
1094                 cpu=arm
1095                 ;;
1096         tx39-*)
1097                 cpu=mipstx39
1098                 ;;
1099         tx39el-*)
1100                 cpu=mipstx39el
1101                 ;;
1102         x64-*)
1103                 cpu=x86_64
1104                 ;;
1105         xscale-* | xscalee[bl]-*)
1106                 cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
1107                 ;;
1108         arm64-*)
1109                 cpu=aarch64
1110                 ;;
1111
1112         # Recognize the canonical CPU Types that limit and/or modify the
1113         # company names they are paired with.
1114         cr16-*)
1115                 basic_os=${basic_os:-elf}
1116                 ;;
1117         crisv32-* | etraxfs*-*)
1118                 cpu=crisv32
1119                 vendor=axis
1120                 ;;
1121         cris-* | etrax*-*)
1122                 cpu=cris
1123                 vendor=axis
1124                 ;;
1125         crx-*)
1126                 basic_os=${basic_os:-elf}
1127                 ;;
1128         neo-tandem)
1129                 cpu=neo
1130                 vendor=tandem
1131                 ;;
1132         nse-tandem)
1133                 cpu=nse
1134                 vendor=tandem
1135                 ;;
1136         nsr-tandem)
1137                 cpu=nsr
1138                 vendor=tandem
1139                 ;;
1140         nsv-tandem)
1141                 cpu=nsv
1142                 vendor=tandem
1143                 ;;
1144         nsx-tandem)
1145                 cpu=nsx
1146                 vendor=tandem
1147                 ;;
1148         mipsallegrexel-sony)
1149                 cpu=mipsallegrexel
1150                 vendor=sony
1151                 ;;
1152         tile*-*)
1153                 basic_os=${basic_os:-linux-gnu}
1154                 ;;
1155
1156         *)
1157                 # Recognize the canonical CPU types that are allowed with any
1158                 # company name.
1159                 case $cpu in
1160                         1750a | 580 \
1161                         | a29k \
1162                         | aarch64 | aarch64_be \
1163                         | abacus \
1164                         | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
1165                         | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
1166                         | alphapca5[67] | alpha64pca5[67] \
1167                         | am33_2.0 \
1168                         | amdgcn \
1169                         | arc | arceb \
1170                         | arm | arm[lb]e | arme[lb] | armv* \
1171                         | avr | avr32 \
1172                         | asmjs \
1173                         | ba \
1174                         | be32 | be64 \
1175                         | bfin | bpf | bs2000 \
1176                         | c[123]* | c30 | [cjt]90 | c4x \
1177                         | c8051 | clipper | craynv | csky | cydra \
1178                         | d10v | d30v | dlx | dsp16xx \
1179                         | e2k | elxsi | epiphany \
1180                         | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
1181                         | h8300 | h8500 \
1182                         | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
1183                         | hexagon \
1184                         | i370 | i*86 | i860 | i960 | ia16 | ia64 \
1185                         | ip2k | iq2000 \
1186                         | k1om \
1187                         | le32 | le64 \
1188                         | lm32 \
1189                         | loongarch32 | loongarch64 | loongarchx32 \
1190                         | m32c | m32r | m32rle \
1191                         | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
1192                         | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
1193                         | m88110 | m88k | maxq | mb | mcore | mep | metag \
1194                         | microblaze | microblazeel \
1195                         | mips | mipsbe | mipseb | mipsel | mipsle \
1196                         | mips16 \
1197                         | mips64 | mips64eb | mips64el \
1198                         | mips64octeon | mips64octeonel \
1199                         | mips64orion | mips64orionel \
1200                         | mips64r5900 | mips64r5900el \
1201                         | mips64vr | mips64vrel \
1202                         | mips64vr4100 | mips64vr4100el \
1203                         | mips64vr4300 | mips64vr4300el \
1204                         | mips64vr5000 | mips64vr5000el \
1205                         | mips64vr5900 | mips64vr5900el \
1206                         | mipsisa32 | mipsisa32el \
1207                         | mipsisa32r2 | mipsisa32r2el \
1208                         | mipsisa32r6 | mipsisa32r6el \
1209                         | mipsisa64 | mipsisa64el \
1210                         | mipsisa64r2 | mipsisa64r2el \
1211                         | mipsisa64r6 | mipsisa64r6el \
1212                         | mipsisa64sb1 | mipsisa64sb1el \
1213                         | mipsisa64sr71k | mipsisa64sr71kel \
1214                         | mipsr5900 | mipsr5900el \
1215                         | mipstx39 | mipstx39el \
1216                         | mmix \
1217                         | mn10200 | mn10300 \
1218                         | moxie \
1219                         | mt \
1220                         | msp430 \
1221                         | nds32 | nds32le | nds32be \
1222                         | nfp \
1223                         | nios | nios2 | nios2eb | nios2el \
1224                         | none | np1 | ns16k | ns32k | nvptx \
1225                         | open8 \
1226                         | or1k* \
1227                         | or32 \
1228                         | orion \
1229                         | picochip \
1230                         | pdp10 | pdp11 | pj | pjl | pn | power \
1231                         | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
1232                         | pru \
1233                         | pyramid \
1234                         | riscv | riscv32 | riscv32be | riscv64 | riscv64be \
1235                         | rl78 | romp | rs6000 | rx \
1236                         | s390 | s390x \
1237                         | score \
1238                         | sh | shl \
1239                         | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
1240                         | sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
1241                         | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
1242                         | sparclite \
1243                         | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
1244                         | spu \
1245                         | tahoe \
1246                         | thumbv7* \
1247                         | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
1248                         | tron \
1249                         | ubicom32 \
1250                         | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
1251                         | vax \
1252                         | visium \
1253                         | w65 \
1254                         | wasm32 | wasm64 \
1255                         | we32k \
1256                         | x86 | x86_64 | xc16x | xgate | xps100 \
1257                         | xstormy16 | xtensa* \
1258                         | ymp \
1259                         | z8k | z80)
1260                                 ;;
1261
1262                         *)
1263                                 echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
1264                                 exit 1
1265                                 ;;
1266                 esac
1267                 ;;
1268 esac
1269
1270 # Here we canonicalize certain aliases for manufacturers.
1271 case $vendor in
1272         digital*)
1273                 vendor=dec
1274                 ;;
1275         commodore*)
1276                 vendor=cbm
1277                 ;;
1278         *)
1279                 ;;
1280 esac
1281
1282 # Decode manufacturer-specific aliases for certain operating systems.
1283
1284 if test x$basic_os != x
1285 then
1286
1287 # First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
1288 # set os.
1289 case $basic_os in
1290         gnu/linux*)
1291                 kernel=linux
1292                 os=`echo $basic_os | sed -e 's|gnu/linux|gnu|'`
1293                 ;;
1294         os2-emx)
1295                 kernel=os2
1296                 os=`echo $basic_os | sed -e 's|os2-emx|emx|'`
1297                 ;;
1298         nto-qnx*)
1299                 kernel=nto
1300                 os=`echo $basic_os | sed -e 's|nto-qnx|qnx|'`
1301                 ;;
1302         *-*)
1303                 # shellcheck disable=SC2162
1304                 IFS="-" read kernel os <<EOF
1305 $basic_os
1306 EOF
1307                 ;;
1308         # Default OS when just kernel was specified
1309         nto*)
1310                 kernel=nto
1311                 os=`echo $basic_os | sed -e 's|nto|qnx|'`
1312                 ;;
1313         linux*)
1314                 kernel=linux
1315                 os=`echo $basic_os | sed -e 's|linux|gnu|'`
1316                 ;;
1317         *)
1318                 kernel=
1319                 os=$basic_os
1320                 ;;
1321 esac
1322
1323 # Now, normalize the OS (knowing we just have one component, it's not a kernel,
1324 # etc.)
1325 case $os in
1326         # First match some system type aliases that might get confused
1327         # with valid system types.
1328         # solaris* is a basic system type, with this one exception.
1329         auroraux)
1330                 os=auroraux
1331                 ;;
1332         bluegene*)
1333                 os=cnk
1334                 ;;
1335         solaris1 | solaris1.*)
1336                 os=`echo $os | sed -e 's|solaris1|sunos4|'`
1337                 ;;
1338         solaris)
1339                 os=solaris2
1340                 ;;
1341         unixware*)
1342                 os=sysv4.2uw
1343                 ;;
1344         # es1800 is here to avoid being matched by es* (a different OS)
1345         es1800*)
1346                 os=ose
1347                 ;;
1348         # Some version numbers need modification
1349         chorusos*)
1350                 os=chorusos
1351                 ;;
1352         isc)
1353                 os=isc2.2
1354                 ;;
1355         sco6)
1356                 os=sco5v6
1357                 ;;
1358         sco5)
1359                 os=sco3.2v5
1360                 ;;
1361         sco4)
1362                 os=sco3.2v4
1363                 ;;
1364         sco3.2.[4-9]*)
1365                 os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
1366                 ;;
1367         sco*v* | scout)
1368                 # Don't match below
1369                 ;;
1370         sco*)
1371                 os=sco3.2v2
1372                 ;;
1373         psos*)
1374                 os=psos
1375                 ;;
1376         qnx*)
1377                 os=qnx
1378                 ;;
1379         hiux*)
1380                 os=hiuxwe2
1381                 ;;
1382         lynx*178)
1383                 os=lynxos178
1384                 ;;
1385         lynx*5)
1386                 os=lynxos5
1387                 ;;
1388         lynxos*)
1389                 # don't get caught up in next wildcard
1390                 ;;
1391         lynx*)
1392                 os=lynxos
1393                 ;;
1394         mac[0-9]*)
1395                 os=`echo "$os" | sed -e 's|mac|macos|'`
1396                 ;;
1397         opened*)
1398                 os=openedition
1399                 ;;
1400         os400*)
1401                 os=os400
1402                 ;;
1403         sunos5*)
1404                 os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
1405                 ;;
1406         sunos6*)
1407                 os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
1408                 ;;
1409         wince*)
1410                 os=wince
1411                 ;;
1412         utek*)
1413                 os=bsd
1414                 ;;
1415         dynix*)
1416                 os=bsd
1417                 ;;
1418         acis*)
1419                 os=aos
1420                 ;;
1421         atheos*)
1422                 os=atheos
1423                 ;;
1424         syllable*)
1425                 os=syllable
1426                 ;;
1427         386bsd)
1428                 os=bsd
1429                 ;;
1430         ctix* | uts*)
1431                 os=sysv
1432                 ;;
1433         nova*)
1434                 os=rtmk-nova
1435                 ;;
1436         ns2)
1437                 os=nextstep2
1438                 ;;
1439         # Preserve the version number of sinix5.
1440         sinix5.*)
1441                 os=`echo $os | sed -e 's|sinix|sysv|'`
1442                 ;;
1443         sinix*)
1444                 os=sysv4
1445                 ;;
1446         tpf*)
1447                 os=tpf
1448                 ;;
1449         triton*)
1450                 os=sysv3
1451                 ;;
1452         oss*)
1453                 os=sysv3
1454                 ;;
1455         svr4*)
1456                 os=sysv4
1457                 ;;
1458         svr3)
1459                 os=sysv3
1460                 ;;
1461         sysvr4)
1462                 os=sysv4
1463                 ;;
1464         ose*)
1465                 os=ose
1466                 ;;
1467         *mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
1468                 os=mint
1469                 ;;
1470         dicos*)
1471                 os=dicos
1472                 ;;
1473         pikeos*)
1474                 # Until real need of OS specific support for
1475                 # particular features comes up, bare metal
1476                 # configurations are quite functional.
1477                 case $cpu in
1478                     arm*)
1479                         os=eabi
1480                         ;;
1481                     *)
1482                         os=elf
1483                         ;;
1484                 esac
1485                 ;;
1486         *)
1487                 # No normalization, but not necessarily accepted, that comes below.
1488                 ;;
1489 esac
1490
1491 else
1492
1493 # Here we handle the default operating systems that come with various machines.
1494 # The value should be what the vendor currently ships out the door with their
1495 # machine or put another way, the most popular os provided with the machine.
1496
1497 # Note that if you're going to try to match "-MANUFACTURER" here (say,
1498 # "-sun"), then you have to tell the case statement up towards the top
1499 # that MANUFACTURER isn't an operating system.  Otherwise, code above
1500 # will signal an error saying that MANUFACTURER isn't an operating
1501 # system, and we'll never get to this point.
1502
1503 kernel=
1504 case $cpu-$vendor in
1505         score-*)
1506                 os=elf
1507                 ;;
1508         spu-*)
1509                 os=elf
1510                 ;;
1511         *-acorn)
1512                 os=riscix1.2
1513                 ;;
1514         arm*-rebel)
1515                 kernel=linux
1516                 os=gnu
1517                 ;;
1518         arm*-semi)
1519                 os=aout
1520                 ;;
1521         c4x-* | tic4x-*)
1522                 os=coff
1523                 ;;
1524         c8051-*)
1525                 os=elf
1526                 ;;
1527         clipper-intergraph)
1528                 os=clix
1529                 ;;
1530         hexagon-*)
1531                 os=elf
1532                 ;;
1533         tic54x-*)
1534                 os=coff
1535                 ;;
1536         tic55x-*)
1537                 os=coff
1538                 ;;
1539         tic6x-*)
1540                 os=coff
1541                 ;;
1542         # This must come before the *-dec entry.
1543         pdp10-*)
1544                 os=tops20
1545                 ;;
1546         pdp11-*)
1547                 os=none
1548                 ;;
1549         *-dec | vax-*)
1550                 os=ultrix4.2
1551                 ;;
1552         m68*-apollo)
1553                 os=domain
1554                 ;;
1555         i386-sun)
1556                 os=sunos4.0.2
1557                 ;;
1558         m68000-sun)
1559                 os=sunos3
1560                 ;;
1561         m68*-cisco)
1562                 os=aout
1563                 ;;
1564         mep-*)
1565                 os=elf
1566                 ;;
1567         mips*-cisco)
1568                 os=elf
1569                 ;;
1570         mips*-*)
1571                 os=elf
1572                 ;;
1573         or32-*)
1574                 os=coff
1575                 ;;
1576         *-tti)  # must be before sparc entry or we get the wrong os.
1577                 os=sysv3
1578                 ;;
1579         sparc-* | *-sun)
1580                 os=sunos4.1.1
1581                 ;;
1582         pru-*)
1583                 os=elf
1584                 ;;
1585         *-be)
1586                 os=beos
1587                 ;;
1588         *-ibm)
1589                 os=aix
1590                 ;;
1591         *-knuth)
1592                 os=mmixware
1593                 ;;
1594         *-wec)
1595                 os=proelf
1596                 ;;
1597         *-winbond)
1598                 os=proelf
1599                 ;;
1600         *-oki)
1601                 os=proelf
1602                 ;;
1603         *-hp)
1604                 os=hpux
1605                 ;;
1606         *-hitachi)
1607                 os=hiux
1608                 ;;
1609         i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1610                 os=sysv
1611                 ;;
1612         *-cbm)
1613                 os=amigaos
1614                 ;;
1615         *-dg)
1616                 os=dgux
1617                 ;;
1618         *-dolphin)
1619                 os=sysv3
1620                 ;;
1621         m68k-ccur)
1622                 os=rtu
1623                 ;;
1624         m88k-omron*)
1625                 os=luna
1626                 ;;
1627         *-next)
1628                 os=nextstep
1629                 ;;
1630         *-sequent)
1631                 os=ptx
1632                 ;;
1633         *-crds)
1634                 os=unos
1635                 ;;
1636         *-ns)
1637                 os=genix
1638                 ;;
1639         i370-*)
1640                 os=mvs
1641                 ;;
1642         *-gould)
1643                 os=sysv
1644                 ;;
1645         *-highlevel)
1646                 os=bsd
1647                 ;;
1648         *-encore)
1649                 os=bsd
1650                 ;;
1651         *-sgi)
1652                 os=irix
1653                 ;;
1654         *-siemens)
1655                 os=sysv4
1656                 ;;
1657         *-masscomp)
1658                 os=rtu
1659                 ;;
1660         f30[01]-fujitsu | f700-fujitsu)
1661                 os=uxpv
1662                 ;;
1663         *-rom68k)
1664                 os=coff
1665                 ;;
1666         *-*bug)
1667                 os=coff
1668                 ;;
1669         *-apple)
1670                 os=macos
1671                 ;;
1672         *-atari*)
1673                 os=mint
1674                 ;;
1675         *-wrs)
1676                 os=vxworks
1677                 ;;
1678         *)
1679                 os=none
1680                 ;;
1681 esac
1682
1683 fi
1684
1685 # Now, validate our (potentially fixed-up) OS.
1686 case $os in
1687         # Sometimes we do "kernel-libc", so those need to count as OSes.
1688         musl* | newlib* | uclibc*)
1689                 ;;
1690         # Likewise for "kernel-abi"
1691         eabi* | gnueabi*)
1692                 ;;
1693         # VxWorks passes extra cpu info in the 4th filed.
1694         simlinux | simwindows | spe)
1695                 ;;
1696         # Now accept the basic system types.
1697         # The portable systems comes first.
1698         # Each alternative MUST end in a * to match a version number.
1699         gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
1700              | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
1701              | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
1702              | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
1703              | hiux* | abug | nacl* | netware* | windows* \
1704              | os9* | macos* | osx* | ios* \
1705              | mpw* | magic* | mmixware* | mon960* | lnews* \
1706              | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
1707              | aos* | aros* | cloudabi* | sortix* | twizzler* \
1708              | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
1709              | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
1710              | mirbsd* | netbsd* | dicos* | openedition* | ose* \
1711              | bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \
1712              | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
1713              | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
1714              | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
1715              | udi* | lites* | ieee* | go32* | aux* | hcos* \
1716              | chorusrdb* | cegcc* | glidix* | serenity* \
1717              | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
1718              | midipix* | mingw32* | mingw64* | mint* \
1719              | uxpv* | beos* | mpeix* | udk* | moxiebox* \
1720              | interix* | uwin* | mks* | rhapsody* | darwin* \
1721              | openstep* | oskit* | conix* | pw32* | nonstopux* \
1722              | storm-chaos* | tops10* | tenex* | tops20* | its* \
1723              | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
1724              | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
1725              | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
1726              | skyos* | haiku* | rdos* | toppers* | drops* | es* \
1727              | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
1728              | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
1729              | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*)
1730                 ;;
1731         # This one is extra strict with allowed versions
1732         sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
1733                 # Don't forget version if it is 3.2v4 or newer.
1734                 ;;
1735         none)
1736                 ;;
1737         *)
1738                 echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
1739                 exit 1
1740                 ;;
1741 esac
1742
1743 # As a final step for OS-related things, validate the OS-kernel combination
1744 # (given a valid OS), if there is a kernel.
1745 case $kernel-$os in
1746         linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* )
1747                 ;;
1748         uclinux-uclibc* )
1749                 ;;
1750         -dietlibc* | -newlib* | -musl* | -uclibc* )
1751                 # These are just libc implementations, not actual OSes, and thus
1752                 # require a kernel.
1753                 echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
1754                 exit 1
1755                 ;;
1756         kfreebsd*-gnu* | kopensolaris*-gnu*)
1757                 ;;
1758         vxworks-simlinux | vxworks-simwindows | vxworks-spe)
1759                 ;;
1760         nto-qnx*)
1761                 ;;
1762         os2-emx)
1763                 ;;
1764         *-eabi* | *-gnueabi*)
1765                 ;;
1766         -*)
1767                 # Blank kernel with real OS is always fine.
1768                 ;;
1769         *-*)
1770                 echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
1771                 exit 1
1772                 ;;
1773 esac
1774
1775 # Here we handle the case where we know the os, and the CPU type, but not the
1776 # manufacturer.  We pick the logical manufacturer.
1777 case $vendor in
1778         unknown)
1779                 case $cpu-$os in
1780                         *-riscix*)
1781                                 vendor=acorn
1782                                 ;;
1783                         *-sunos*)
1784                                 vendor=sun
1785                                 ;;
1786                         *-cnk* | *-aix*)
1787                                 vendor=ibm
1788                                 ;;
1789                         *-beos*)
1790                                 vendor=be
1791                                 ;;
1792                         *-hpux*)
1793                                 vendor=hp
1794                                 ;;
1795                         *-mpeix*)
1796                                 vendor=hp
1797                                 ;;
1798                         *-hiux*)
1799                                 vendor=hitachi
1800                                 ;;
1801                         *-unos*)
1802                                 vendor=crds
1803                                 ;;
1804                         *-dgux*)
1805                                 vendor=dg
1806                                 ;;
1807                         *-luna*)
1808                                 vendor=omron
1809                                 ;;
1810                         *-genix*)
1811                                 vendor=ns
1812                                 ;;
1813                         *-clix*)
1814                                 vendor=intergraph
1815                                 ;;
1816                         *-mvs* | *-opened*)
1817                                 vendor=ibm
1818                                 ;;
1819                         *-os400*)
1820                                 vendor=ibm
1821                                 ;;
1822                         s390-* | s390x-*)
1823                                 vendor=ibm
1824                                 ;;
1825                         *-ptx*)
1826                                 vendor=sequent
1827                                 ;;
1828                         *-tpf*)
1829                                 vendor=ibm
1830                                 ;;
1831                         *-vxsim* | *-vxworks* | *-windiss*)
1832                                 vendor=wrs
1833                                 ;;
1834                         *-aux*)
1835                                 vendor=apple
1836                                 ;;
1837                         *-hms*)
1838                                 vendor=hitachi
1839                                 ;;
1840                         *-mpw* | *-macos*)
1841                                 vendor=apple
1842                                 ;;
1843                         *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
1844                                 vendor=atari
1845                                 ;;
1846                         *-vos*)
1847                                 vendor=stratus
1848                                 ;;
1849                 esac
1850                 ;;
1851 esac
1852
1853 echo "$cpu-$vendor-${kernel:+$kernel-}$os"
1854 exit
1855
1856 # Local variables:
1857 # eval: (add-hook 'before-save-hook 'time-stamp)
1858 # time-stamp-start: "timestamp='"
1859 # time-stamp-format: "%:y-%02m-%02d"
1860 # time-stamp-end: "'"
1861 # End: