]> ncurses.scripts.mit.edu Git - ncurses.git/blob - config.sub
ncurses 6.2 - patch 20210626
[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-04-30'
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 | arc64 \
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                         | mipsisa32r3 | mipsisa32r3el \
1209                         | mipsisa32r5 | mipsisa32r5el \
1210                         | mipsisa32r6 | mipsisa32r6el \
1211                         | mipsisa64 | mipsisa64el \
1212                         | mipsisa64r2 | mipsisa64r2el \
1213                         | mipsisa64r3 | mipsisa64r3el \
1214                         | mipsisa64r5 | mipsisa64r5el \
1215                         | mipsisa64r6 | mipsisa64r6el \
1216                         | mipsisa64sb1 | mipsisa64sb1el \
1217                         | mipsisa64sr71k | mipsisa64sr71kel \
1218                         | mipsr5900 | mipsr5900el \
1219                         | mipstx39 | mipstx39el \
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 \
1238                         | riscv | riscv32 | riscv32be | riscv64 | riscv64be \
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 \
1250                         | thumbv7* \
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                         *)
1267                                 echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
1268                                 exit 1
1269                                 ;;
1270                 esac
1271                 ;;
1272 esac
1273
1274 # Here we canonicalize certain aliases for manufacturers.
1275 case $vendor in
1276         digital*)
1277                 vendor=dec
1278                 ;;
1279         commodore*)
1280                 vendor=cbm
1281                 ;;
1282         *)
1283                 ;;
1284 esac
1285
1286 # Decode manufacturer-specific aliases for certain operating systems.
1287
1288 if test x$basic_os != x
1289 then
1290
1291 # First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
1292 # set os.
1293 case $basic_os in
1294         gnu/linux*)
1295                 kernel=linux
1296                 os=`echo $basic_os | sed -e 's|gnu/linux|gnu|'`
1297                 ;;
1298         os2-emx)
1299                 kernel=os2
1300                 os=`echo $basic_os | sed -e 's|os2-emx|emx|'`
1301                 ;;
1302         nto-qnx*)
1303                 kernel=nto
1304                 os=`echo $basic_os | sed -e 's|nto-qnx|qnx|'`
1305                 ;;
1306         *-*)
1307                 # shellcheck disable=SC2162
1308                 IFS="-" read kernel os <<EOF
1309 $basic_os
1310 EOF
1311                 ;;
1312         # Default OS when just kernel was specified
1313         nto*)
1314                 kernel=nto
1315                 os=`echo $basic_os | sed -e 's|nto|qnx|'`
1316                 ;;
1317         linux*)
1318                 kernel=linux
1319                 os=`echo $basic_os | sed -e 's|linux|gnu|'`
1320                 ;;
1321         *)
1322                 kernel=
1323                 os=$basic_os
1324                 ;;
1325 esac
1326
1327 # Now, normalize the OS (knowing we just have one component, it's not a kernel,
1328 # etc.)
1329 case $os in
1330         # First match some system type aliases that might get confused
1331         # with valid system types.
1332         # solaris* is a basic system type, with this one exception.
1333         auroraux)
1334                 os=auroraux
1335                 ;;
1336         bluegene*)
1337                 os=cnk
1338                 ;;
1339         solaris1 | solaris1.*)
1340                 os=`echo $os | sed -e 's|solaris1|sunos4|'`
1341                 ;;
1342         solaris)
1343                 os=solaris2
1344                 ;;
1345         unixware*)
1346                 os=sysv4.2uw
1347                 ;;
1348         # es1800 is here to avoid being matched by es* (a different OS)
1349         es1800*)
1350                 os=ose
1351                 ;;
1352         # Some version numbers need modification
1353         chorusos*)
1354                 os=chorusos
1355                 ;;
1356         isc)
1357                 os=isc2.2
1358                 ;;
1359         sco6)
1360                 os=sco5v6
1361                 ;;
1362         sco5)
1363                 os=sco3.2v5
1364                 ;;
1365         sco4)
1366                 os=sco3.2v4
1367                 ;;
1368         sco3.2.[4-9]*)
1369                 os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
1370                 ;;
1371         sco*v* | scout)
1372                 # Don't match below
1373                 ;;
1374         sco*)
1375                 os=sco3.2v2
1376                 ;;
1377         psos*)
1378                 os=psos
1379                 ;;
1380         qnx*)
1381                 os=qnx
1382                 ;;
1383         hiux*)
1384                 os=hiuxwe2
1385                 ;;
1386         lynx*178)
1387                 os=lynxos178
1388                 ;;
1389         lynx*5)
1390                 os=lynxos5
1391                 ;;
1392         lynxos*)
1393                 # don't get caught up in next wildcard
1394                 ;;
1395         lynx*)
1396                 os=lynxos
1397                 ;;
1398         mac[0-9]*)
1399                 os=`echo "$os" | sed -e 's|mac|macos|'`
1400                 ;;
1401         opened*)
1402                 os=openedition
1403                 ;;
1404         os400*)
1405                 os=os400
1406                 ;;
1407         sunos5*)
1408                 os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
1409                 ;;
1410         sunos6*)
1411                 os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
1412                 ;;
1413         wince*)
1414                 os=wince
1415                 ;;
1416         utek*)
1417                 os=bsd
1418                 ;;
1419         dynix*)
1420                 os=bsd
1421                 ;;
1422         acis*)
1423                 os=aos
1424                 ;;
1425         atheos*)
1426                 os=atheos
1427                 ;;
1428         syllable*)
1429                 os=syllable
1430                 ;;
1431         386bsd)
1432                 os=bsd
1433                 ;;
1434         ctix* | uts*)
1435                 os=sysv
1436                 ;;
1437         nova*)
1438                 os=rtmk-nova
1439                 ;;
1440         ns2)
1441                 os=nextstep2
1442                 ;;
1443         # Preserve the version number of sinix5.
1444         sinix5.*)
1445                 os=`echo $os | sed -e 's|sinix|sysv|'`
1446                 ;;
1447         sinix*)
1448                 os=sysv4
1449                 ;;
1450         tpf*)
1451                 os=tpf
1452                 ;;
1453         triton*)
1454                 os=sysv3
1455                 ;;
1456         oss*)
1457                 os=sysv3
1458                 ;;
1459         svr4*)
1460                 os=sysv4
1461                 ;;
1462         svr3)
1463                 os=sysv3
1464                 ;;
1465         sysvr4)
1466                 os=sysv4
1467                 ;;
1468         ose*)
1469                 os=ose
1470                 ;;
1471         *mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
1472                 os=mint
1473                 ;;
1474         dicos*)
1475                 os=dicos
1476                 ;;
1477         pikeos*)
1478                 # Until real need of OS specific support for
1479                 # particular features comes up, bare metal
1480                 # configurations are quite functional.
1481                 case $cpu in
1482                     arm*)
1483                         os=eabi
1484                         ;;
1485                     *)
1486                         os=elf
1487                         ;;
1488                 esac
1489                 ;;
1490         *)
1491                 # No normalization, but not necessarily accepted, that comes below.
1492                 ;;
1493 esac
1494
1495 else
1496
1497 # Here we handle the default operating systems that come with various machines.
1498 # The value should be what the vendor currently ships out the door with their
1499 # machine or put another way, the most popular os provided with the machine.
1500
1501 # Note that if you're going to try to match "-MANUFACTURER" here (say,
1502 # "-sun"), then you have to tell the case statement up towards the top
1503 # that MANUFACTURER isn't an operating system.  Otherwise, code above
1504 # will signal an error saying that MANUFACTURER isn't an operating
1505 # system, and we'll never get to this point.
1506
1507 kernel=
1508 case $cpu-$vendor in
1509         score-*)
1510                 os=elf
1511                 ;;
1512         spu-*)
1513                 os=elf
1514                 ;;
1515         *-acorn)
1516                 os=riscix1.2
1517                 ;;
1518         arm*-rebel)
1519                 kernel=linux
1520                 os=gnu
1521                 ;;
1522         arm*-semi)
1523                 os=aout
1524                 ;;
1525         c4x-* | tic4x-*)
1526                 os=coff
1527                 ;;
1528         c8051-*)
1529                 os=elf
1530                 ;;
1531         clipper-intergraph)
1532                 os=clix
1533                 ;;
1534         hexagon-*)
1535                 os=elf
1536                 ;;
1537         tic54x-*)
1538                 os=coff
1539                 ;;
1540         tic55x-*)
1541                 os=coff
1542                 ;;
1543         tic6x-*)
1544                 os=coff
1545                 ;;
1546         # This must come before the *-dec entry.
1547         pdp10-*)
1548                 os=tops20
1549                 ;;
1550         pdp11-*)
1551                 os=none
1552                 ;;
1553         *-dec | vax-*)
1554                 os=ultrix4.2
1555                 ;;
1556         m68*-apollo)
1557                 os=domain
1558                 ;;
1559         i386-sun)
1560                 os=sunos4.0.2
1561                 ;;
1562         m68000-sun)
1563                 os=sunos3
1564                 ;;
1565         m68*-cisco)
1566                 os=aout
1567                 ;;
1568         mep-*)
1569                 os=elf
1570                 ;;
1571         mips*-cisco)
1572                 os=elf
1573                 ;;
1574         mips*-*)
1575                 os=elf
1576                 ;;
1577         or32-*)
1578                 os=coff
1579                 ;;
1580         *-tti)  # must be before sparc entry or we get the wrong os.
1581                 os=sysv3
1582                 ;;
1583         sparc-* | *-sun)
1584                 os=sunos4.1.1
1585                 ;;
1586         pru-*)
1587                 os=elf
1588                 ;;
1589         *-be)
1590                 os=beos
1591                 ;;
1592         *-ibm)
1593                 os=aix
1594                 ;;
1595         *-knuth)
1596                 os=mmixware
1597                 ;;
1598         *-wec)
1599                 os=proelf
1600                 ;;
1601         *-winbond)
1602                 os=proelf
1603                 ;;
1604         *-oki)
1605                 os=proelf
1606                 ;;
1607         *-hp)
1608                 os=hpux
1609                 ;;
1610         *-hitachi)
1611                 os=hiux
1612                 ;;
1613         i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1614                 os=sysv
1615                 ;;
1616         *-cbm)
1617                 os=amigaos
1618                 ;;
1619         *-dg)
1620                 os=dgux
1621                 ;;
1622         *-dolphin)
1623                 os=sysv3
1624                 ;;
1625         m68k-ccur)
1626                 os=rtu
1627                 ;;
1628         m88k-omron*)
1629                 os=luna
1630                 ;;
1631         *-next)
1632                 os=nextstep
1633                 ;;
1634         *-sequent)
1635                 os=ptx
1636                 ;;
1637         *-crds)
1638                 os=unos
1639                 ;;
1640         *-ns)
1641                 os=genix
1642                 ;;
1643         i370-*)
1644                 os=mvs
1645                 ;;
1646         *-gould)
1647                 os=sysv
1648                 ;;
1649         *-highlevel)
1650                 os=bsd
1651                 ;;
1652         *-encore)
1653                 os=bsd
1654                 ;;
1655         *-sgi)
1656                 os=irix
1657                 ;;
1658         *-siemens)
1659                 os=sysv4
1660                 ;;
1661         *-masscomp)
1662                 os=rtu
1663                 ;;
1664         f30[01]-fujitsu | f700-fujitsu)
1665                 os=uxpv
1666                 ;;
1667         *-rom68k)
1668                 os=coff
1669                 ;;
1670         *-*bug)
1671                 os=coff
1672                 ;;
1673         *-apple)
1674                 os=macos
1675                 ;;
1676         *-atari*)
1677                 os=mint
1678                 ;;
1679         *-wrs)
1680                 os=vxworks
1681                 ;;
1682         *)
1683                 os=none
1684                 ;;
1685 esac
1686
1687 fi
1688
1689 # Now, validate our (potentially fixed-up) OS.
1690 case $os in
1691         # Sometimes we do "kernel-libc", so those need to count as OSes.
1692         musl* | newlib* | uclibc*)
1693                 ;;
1694         # Likewise for "kernel-abi"
1695         eabi* | gnueabi*)
1696                 ;;
1697         # VxWorks passes extra cpu info in the 4th filed.
1698         simlinux | simwindows | spe)
1699                 ;;
1700         # Now accept the basic system types.
1701         # The portable systems comes first.
1702         # Each alternative MUST end in a * to match a version number.
1703         gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
1704              | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
1705              | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
1706              | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
1707              | hiux* | abug | nacl* | netware* | windows* \
1708              | os9* | macos* | osx* | ios* \
1709              | mpw* | magic* | mmixware* | mon960* | lnews* \
1710              | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
1711              | aos* | aros* | cloudabi* | sortix* | twizzler* \
1712              | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
1713              | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
1714              | mirbsd* | netbsd* | dicos* | openedition* | ose* \
1715              | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
1716              | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
1717              | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
1718              | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
1719              | udi* | lites* | ieee* | go32* | aux* | hcos* \
1720              | chorusrdb* | cegcc* | glidix* | serenity* \
1721              | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
1722              | midipix* | mingw32* | mingw64* | mint* \
1723              | uxpv* | beos* | mpeix* | udk* | moxiebox* \
1724              | interix* | uwin* | mks* | rhapsody* | darwin* \
1725              | openstep* | oskit* | conix* | pw32* | nonstopux* \
1726              | storm-chaos* | tops10* | tenex* | tops20* | its* \
1727              | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
1728              | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
1729              | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
1730              | skyos* | haiku* | rdos* | toppers* | drops* | es* \
1731              | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
1732              | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
1733              | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*)
1734                 ;;
1735         # This one is extra strict with allowed versions
1736         sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
1737                 # Don't forget version if it is 3.2v4 or newer.
1738                 ;;
1739         none)
1740                 ;;
1741         *)
1742                 echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
1743                 exit 1
1744                 ;;
1745 esac
1746
1747 # As a final step for OS-related things, validate the OS-kernel combination
1748 # (given a valid OS), if there is a kernel.
1749 case $kernel-$os in
1750         linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* )
1751                 ;;
1752         uclinux-uclibc* )
1753                 ;;
1754         -dietlibc* | -newlib* | -musl* | -uclibc* )
1755                 # These are just libc implementations, not actual OSes, and thus
1756                 # require a kernel.
1757                 echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
1758                 exit 1
1759                 ;;
1760         kfreebsd*-gnu* | kopensolaris*-gnu*)
1761                 ;;
1762         vxworks-simlinux | vxworks-simwindows | vxworks-spe)
1763                 ;;
1764         nto-qnx*)
1765                 ;;
1766         os2-emx)
1767                 ;;
1768         *-eabi* | *-gnueabi*)
1769                 ;;
1770         -*)
1771                 # Blank kernel with real OS is always fine.
1772                 ;;
1773         *-*)
1774                 echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
1775                 exit 1
1776                 ;;
1777 esac
1778
1779 # Here we handle the case where we know the os, and the CPU type, but not the
1780 # manufacturer.  We pick the logical manufacturer.
1781 case $vendor in
1782         unknown)
1783                 case $cpu-$os in
1784                         *-riscix*)
1785                                 vendor=acorn
1786                                 ;;
1787                         *-sunos*)
1788                                 vendor=sun
1789                                 ;;
1790                         *-cnk* | *-aix*)
1791                                 vendor=ibm
1792                                 ;;
1793                         *-beos*)
1794                                 vendor=be
1795                                 ;;
1796                         *-hpux*)
1797                                 vendor=hp
1798                                 ;;
1799                         *-mpeix*)
1800                                 vendor=hp
1801                                 ;;
1802                         *-hiux*)
1803                                 vendor=hitachi
1804                                 ;;
1805                         *-unos*)
1806                                 vendor=crds
1807                                 ;;
1808                         *-dgux*)
1809                                 vendor=dg
1810                                 ;;
1811                         *-luna*)
1812                                 vendor=omron
1813                                 ;;
1814                         *-genix*)
1815                                 vendor=ns
1816                                 ;;
1817                         *-clix*)
1818                                 vendor=intergraph
1819                                 ;;
1820                         *-mvs* | *-opened*)
1821                                 vendor=ibm
1822                                 ;;
1823                         *-os400*)
1824                                 vendor=ibm
1825                                 ;;
1826                         s390-* | s390x-*)
1827                                 vendor=ibm
1828                                 ;;
1829                         *-ptx*)
1830                                 vendor=sequent
1831                                 ;;
1832                         *-tpf*)
1833                                 vendor=ibm
1834                                 ;;
1835                         *-vxsim* | *-vxworks* | *-windiss*)
1836                                 vendor=wrs
1837                                 ;;
1838                         *-aux*)
1839                                 vendor=apple
1840                                 ;;
1841                         *-hms*)
1842                                 vendor=hitachi
1843                                 ;;
1844                         *-mpw* | *-macos*)
1845                                 vendor=apple
1846                                 ;;
1847                         *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
1848                                 vendor=atari
1849                                 ;;
1850                         *-vos*)
1851                                 vendor=stratus
1852                                 ;;
1853                 esac
1854                 ;;
1855 esac
1856
1857 echo "$cpu-$vendor-${kernel:+$kernel-}$os"
1858 exit
1859
1860 # Local variables:
1861 # eval: (add-hook 'before-save-hook 'time-stamp)
1862 # time-stamp-start: "timestamp='"
1863 # time-stamp-format: "%:y-%02m-%02d"
1864 # time-stamp-end: "'"
1865 # End: