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