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