blob: e4c4e09b6540ab06c90b3e8bdc75b92d28b77867 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301#! /bin/sh
2# Configuration validation subroutine script.
micky3879b9f5e72025-07-08 18:04:53 -04003# Copyright 1992-2023 Free Software Foundation, Inc.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05304
micky3879b9f5e72025-07-08 18:04:53 -04005# shellcheck disable=SC2006,SC2268 # see below for rationale
6
7timestamp='2023-12-02'
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05308
Steve Kondikae271bc2015-11-15 02:50:53 +01009# 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
micky3879b9f5e72025-07-08 18:04:53 -040011# the Free Software Foundation, either version 3 of the License, or
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053012# (at your option) any later version.
13#
Steve Kondikae271bc2015-11-15 02:50:53 +010014# 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.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053018#
19# You should have received a copy of the GNU General Public License
micky3879b9f5e72025-07-08 18:04:53 -040020# along with this program; if not, see <https://www.gnu.org/licenses/>.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053021#
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
Steve Kondikae271bc2015-11-15 02:50:53 +010025# 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").
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053028
29
Steve Kondikae271bc2015-11-15 02:50:53 +010030# Please send patches to <config-patches@gnu.org>.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053031#
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.
36
Steve Kondikae271bc2015-11-15 02:50:53 +010037# You can get the latest version of this script from:
micky3879b9f5e72025-07-08 18:04:53 -040038# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
Steve Kondikae271bc2015-11-15 02:50:53 +010039
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053040# 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.
47
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.
54
micky3879b9f5e72025-07-08 18:04:53 -040055# 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.
61
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053062me=`echo "$0" | sed -e 's,.*/,,'`
63
64usage="\
micky3879b9f5e72025-07-08 18:04:53 -040065Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053066
67Canonicalize a configuration name.
68
micky3879b9f5e72025-07-08 18:04:53 -040069Options:
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053070 -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
73
74Report bugs and patches to <config-patches@gnu.org>."
75
76version="\
77GNU config.sub ($timestamp)
78
micky3879b9f5e72025-07-08 18:04:53 -040079Copyright 1992-2023 Free Software Foundation, Inc.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053080
81This is free software; see the source for copying conditions. There is NO
82warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
83
84help="
micky3879b9f5e72025-07-08 18:04:53 -040085Try '$me --help' for more information."
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053086
87# Parse command line
88while 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 -* )
micky3879b9f5e72025-07-08 18:04:53 -0400101 echo "$me: invalid option $1$help" >&2
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530102 exit 1 ;;
103
104 *local*)
105 # First pass through any local machine types.
micky3879b9f5e72025-07-08 18:04:53 -0400106 echo "$1"
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530107 exit ;;
108
109 * )
110 break ;;
111 esac
112done
113
114case $# 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;;
120esac
121
micky3879b9f5e72025-07-08 18:04:53 -0400122# Split fields of configuration type
123# shellcheck disable=SC2162
124saved_IFS=$IFS
125IFS="-" read field1 field2 field3 field4 <<EOF
126$1
127EOF
128IFS=$saved_IFS
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530129
micky3879b9f5e72025-07-08 18:04:53 -0400130# Separate into logical components for further validation
131case $1 in
132 *-*-*-*-*)
133 echo "Invalid configuration '$1': more than four components" >&2
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530134 exit 1
135 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400136 *-*-*-*)
137 basic_machine=$field1-$field2
138 basic_os=$field3-$field4
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530139 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400140 *-*-*)
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
152 ;;
153 android-linux)
154 basic_machine=$field1-unknown
155 basic_os=linux-android
156 ;;
157 *)
158 basic_machine=$field1-$field2
159 basic_os=$field3
160 ;;
161 esac
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530162 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400163 *-*)
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=
169 ;;
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
177 ;;
178 zephyr*)
179 basic_machine=$field1-unknown
180 basic_os=$field2
181 ;;
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=
194 ;;
195 *)
196 basic_machine=$field1
197 basic_os=$field2
198 ;;
199 esac
200 ;;
201 esac
202 ;;
203 *)
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
210 ;;
211 a29khif)
212 basic_machine=a29k-amd
213 basic_os=udi
214 ;;
215 adobe68k)
216 basic_machine=m68010-adobe
217 basic_os=scout
218 ;;
219 alliant)
220 basic_machine=fx80-alliant
221 basic_os=
222 ;;
223 altos | altos3068)
224 basic_machine=m68k-altos
225 basic_os=
226 ;;
227 am29k)
228 basic_machine=a29k-none
229 basic_os=bsd
230 ;;
231 amdahl)
232 basic_machine=580-amdahl
233 basic_os=sysv
234 ;;
235 amiga)
236 basic_machine=m68k-unknown
237 basic_os=
238 ;;
239 amigaos | amigados)
240 basic_machine=m68k-unknown
241 basic_os=amigaos
242 ;;
243 amigaunix | amix)
244 basic_machine=m68k-unknown
245 basic_os=sysv4
246 ;;
247 apollo68)
248 basic_machine=m68k-apollo
249 basic_os=sysv
250 ;;
251 apollo68bsd)
252 basic_machine=m68k-apollo
253 basic_os=bsd
254 ;;
255 aros)
256 basic_machine=i386-pc
257 basic_os=aros
258 ;;
259 aux)
260 basic_machine=m68k-apple
261 basic_os=aux
262 ;;
263 balance)
264 basic_machine=ns32k-sequent
265 basic_os=dynix
266 ;;
267 blackfin)
268 basic_machine=bfin-unknown
269 basic_os=linux
270 ;;
271 cegcc)
272 basic_machine=arm-unknown
273 basic_os=cegcc
274 ;;
275 convex-c1)
276 basic_machine=c1-convex
277 basic_os=bsd
278 ;;
279 convex-c2)
280 basic_machine=c2-convex
281 basic_os=bsd
282 ;;
283 convex-c32)
284 basic_machine=c32-convex
285 basic_os=bsd
286 ;;
287 convex-c34)
288 basic_machine=c34-convex
289 basic_os=bsd
290 ;;
291 convex-c38)
292 basic_machine=c38-convex
293 basic_os=bsd
294 ;;
295 cray)
296 basic_machine=j90-cray
297 basic_os=unicos
298 ;;
299 crds | unos)
300 basic_machine=m68k-crds
301 basic_os=
302 ;;
303 da30)
304 basic_machine=m68k-da30
305 basic_os=
306 ;;
307 decstation | pmax | pmin | dec3100 | decstatn)
308 basic_machine=mips-dec
309 basic_os=
310 ;;
311 delta88)
312 basic_machine=m88k-motorola
313 basic_os=sysv3
314 ;;
315 dicos)
316 basic_machine=i686-pc
317 basic_os=dicos
318 ;;
319 djgpp)
320 basic_machine=i586-pc
321 basic_os=msdosdjgpp
322 ;;
323 ebmon29k)
324 basic_machine=a29k-amd
325 basic_os=ebmon
326 ;;
327 es1800 | OSE68k | ose68k | ose | OSE)
328 basic_machine=m68k-ericsson
329 basic_os=ose
330 ;;
331 gmicro)
332 basic_machine=tron-gmicro
333 basic_os=sysv
334 ;;
335 go32)
336 basic_machine=i386-pc
337 basic_os=go32
338 ;;
339 h8300hms)
340 basic_machine=h8300-hitachi
341 basic_os=hms
342 ;;
343 h8300xray)
344 basic_machine=h8300-hitachi
345 basic_os=xray
346 ;;
347 h8500hms)
348 basic_machine=h8500-hitachi
349 basic_os=hms
350 ;;
351 harris)
352 basic_machine=m88k-harris
353 basic_os=sysv3
354 ;;
355 hp300 | hp300hpux)
356 basic_machine=m68k-hp
357 basic_os=hpux
358 ;;
359 hp300bsd)
360 basic_machine=m68k-hp
361 basic_os=bsd
362 ;;
363 hppaosf)
364 basic_machine=hppa1.1-hp
365 basic_os=osf
366 ;;
367 hppro)
368 basic_machine=hppa1.1-hp
369 basic_os=proelf
370 ;;
371 i386mach)
372 basic_machine=i386-mach
373 basic_os=mach
374 ;;
375 isi68 | isi)
376 basic_machine=m68k-isi
377 basic_os=sysv
378 ;;
379 m68knommu)
380 basic_machine=m68k-unknown
381 basic_os=linux
382 ;;
383 magnum | m3230)
384 basic_machine=mips-mips
385 basic_os=sysv
386 ;;
387 merlin)
388 basic_machine=ns32k-utek
389 basic_os=sysv
390 ;;
391 mingw64)
392 basic_machine=x86_64-pc
393 basic_os=mingw64
394 ;;
395 mingw32)
396 basic_machine=i686-pc
397 basic_os=mingw32
398 ;;
399 mingw32ce)
400 basic_machine=arm-unknown
401 basic_os=mingw32ce
402 ;;
403 monitor)
404 basic_machine=m68k-rom68k
405 basic_os=coff
406 ;;
407 morphos)
408 basic_machine=powerpc-unknown
409 basic_os=morphos
410 ;;
411 moxiebox)
412 basic_machine=moxie-unknown
413 basic_os=moxiebox
414 ;;
415 msdos)
416 basic_machine=i386-pc
417 basic_os=msdos
418 ;;
419 msys)
420 basic_machine=i686-pc
421 basic_os=msys
422 ;;
423 mvs)
424 basic_machine=i370-ibm
425 basic_os=mvs
426 ;;
427 nacl)
428 basic_machine=le32-unknown
429 basic_os=nacl
430 ;;
431 ncr3000)
432 basic_machine=i486-ncr
433 basic_os=sysv4
434 ;;
435 netbsd386)
436 basic_machine=i386-pc
437 basic_os=netbsd
438 ;;
439 netwinder)
440 basic_machine=armv4l-rebel
441 basic_os=linux
442 ;;
443 news | news700 | news800 | news900)
444 basic_machine=m68k-sony
445 basic_os=newsos
446 ;;
447 news1000)
448 basic_machine=m68030-sony
449 basic_os=newsos
450 ;;
451 necv70)
452 basic_machine=v70-nec
453 basic_os=sysv
454 ;;
455 nh3000)
456 basic_machine=m68k-harris
457 basic_os=cxux
458 ;;
459 nh[45]000)
460 basic_machine=m88k-harris
461 basic_os=cxux
462 ;;
463 nindy960)
464 basic_machine=i960-intel
465 basic_os=nindy
466 ;;
467 mon960)
468 basic_machine=i960-intel
469 basic_os=mon960
470 ;;
471 nonstopux)
472 basic_machine=mips-compaq
473 basic_os=nonstopux
474 ;;
475 os400)
476 basic_machine=powerpc-ibm
477 basic_os=os400
478 ;;
479 OSE68000 | ose68000)
480 basic_machine=m68000-ericsson
481 basic_os=ose
482 ;;
483 os68k)
484 basic_machine=m68k-none
485 basic_os=os68k
486 ;;
487 paragon)
488 basic_machine=i860-intel
489 basic_os=osf
490 ;;
491 parisc)
492 basic_machine=hppa-unknown
493 basic_os=linux
494 ;;
495 psp)
496 basic_machine=mipsallegrexel-sony
497 basic_os=psp
498 ;;
499 pw32)
500 basic_machine=i586-unknown
501 basic_os=pw32
502 ;;
503 rdos | rdos64)
504 basic_machine=x86_64-pc
505 basic_os=rdos
506 ;;
507 rdos32)
508 basic_machine=i386-pc
509 basic_os=rdos
510 ;;
511 rom68k)
512 basic_machine=m68k-rom68k
513 basic_os=coff
514 ;;
515 sa29200)
516 basic_machine=a29k-amd
517 basic_os=udi
518 ;;
519 sei)
520 basic_machine=mips-sei
521 basic_os=seiux
522 ;;
523 sequent)
524 basic_machine=i386-sequent
525 basic_os=
526 ;;
527 sps7)
528 basic_machine=m68k-bull
529 basic_os=sysv2
530 ;;
531 st2000)
532 basic_machine=m68k-tandem
533 basic_os=
534 ;;
535 stratus)
536 basic_machine=i860-stratus
537 basic_os=sysv4
538 ;;
539 sun2)
540 basic_machine=m68000-sun
541 basic_os=
542 ;;
543 sun2os3)
544 basic_machine=m68000-sun
545 basic_os=sunos3
546 ;;
547 sun2os4)
548 basic_machine=m68000-sun
549 basic_os=sunos4
550 ;;
551 sun3)
552 basic_machine=m68k-sun
553 basic_os=
554 ;;
555 sun3os3)
556 basic_machine=m68k-sun
557 basic_os=sunos3
558 ;;
559 sun3os4)
560 basic_machine=m68k-sun
561 basic_os=sunos4
562 ;;
563 sun4)
564 basic_machine=sparc-sun
565 basic_os=
566 ;;
567 sun4os3)
568 basic_machine=sparc-sun
569 basic_os=sunos3
570 ;;
571 sun4os4)
572 basic_machine=sparc-sun
573 basic_os=sunos4
574 ;;
575 sun4sol2)
576 basic_machine=sparc-sun
577 basic_os=solaris2
578 ;;
579 sun386 | sun386i | roadrunner)
580 basic_machine=i386-sun
581 basic_os=
582 ;;
583 sv1)
584 basic_machine=sv1-cray
585 basic_os=unicos
586 ;;
587 symmetry)
588 basic_machine=i386-sequent
589 basic_os=dynix
590 ;;
591 t3e)
592 basic_machine=alphaev5-cray
593 basic_os=unicos
594 ;;
595 t90)
596 basic_machine=t90-cray
597 basic_os=unicos
598 ;;
599 toad1)
600 basic_machine=pdp10-xkl
601 basic_os=tops20
602 ;;
603 tpf)
604 basic_machine=s390x-ibm
605 basic_os=tpf
606 ;;
607 udi29k)
608 basic_machine=a29k-amd
609 basic_os=udi
610 ;;
611 ultra3)
612 basic_machine=a29k-nyu
613 basic_os=sym1
614 ;;
615 v810 | necv810)
616 basic_machine=v810-nec
617 basic_os=none
618 ;;
619 vaxv)
620 basic_machine=vax-dec
621 basic_os=sysv
622 ;;
623 vms)
624 basic_machine=vax-dec
625 basic_os=vms
626 ;;
627 vsta)
628 basic_machine=i386-pc
629 basic_os=vsta
630 ;;
631 vxworks960)
632 basic_machine=i960-wrs
633 basic_os=vxworks
634 ;;
635 vxworks68)
636 basic_machine=m68k-wrs
637 basic_os=vxworks
638 ;;
639 vxworks29k)
640 basic_machine=a29k-wrs
641 basic_os=vxworks
642 ;;
643 xbox)
644 basic_machine=i686-pc
645 basic_os=mingw32
646 ;;
647 ymp)
648 basic_machine=ymp-cray
649 basic_os=unicos
650 ;;
651 *)
652 basic_machine=$1
653 basic_os=
654 ;;
655 esac
656 ;;
657esac
658
659# Decode 1-component or ad-hoc basic machines
660case $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
666 ;;
667 op50n)
668 cpu=hppa1.1
669 vendor=oki
670 ;;
671 op60c)
672 cpu=hppa1.1
673 vendor=oki
674 ;;
675 ibm*)
676 cpu=i370
677 vendor=ibm
678 ;;
679 orion105)
680 cpu=clipper
681 vendor=highlevel
682 ;;
683 mac | mpw | mac-mpw)
684 cpu=m68k
685 vendor=apple
686 ;;
687 pmac | pmac-mpw)
688 cpu=powerpc
689 vendor=apple
690 ;;
691
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530692 # Recognize the various machine names and aliases which stand
693 # for a CPU type and a company and sometimes even an OS.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530694 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
micky3879b9f5e72025-07-08 18:04:53 -0400695 cpu=m68000
696 vendor=att
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530697 ;;
698 3b*)
micky3879b9f5e72025-07-08 18:04:53 -0400699 cpu=we32k
700 vendor=att
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530701 ;;
Steve Kondikae271bc2015-11-15 02:50:53 +0100702 bluegene*)
micky3879b9f5e72025-07-08 18:04:53 -0400703 cpu=powerpc
704 vendor=ibm
705 basic_os=cnk
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530706 ;;
707 decsystem10* | dec10*)
micky3879b9f5e72025-07-08 18:04:53 -0400708 cpu=pdp10
709 vendor=dec
710 basic_os=tops10
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530711 ;;
712 decsystem20* | dec20*)
micky3879b9f5e72025-07-08 18:04:53 -0400713 cpu=pdp10
714 vendor=dec
715 basic_os=tops20
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530716 ;;
717 delta | 3300 | motorola-3300 | motorola-delta \
718 | 3300-motorola | delta-motorola)
micky3879b9f5e72025-07-08 18:04:53 -0400719 cpu=m68k
720 vendor=motorola
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530721 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400722 dpx2*)
723 cpu=m68k
724 vendor=bull
725 basic_os=sysv3
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530726 ;;
727 encore | umax | mmax)
micky3879b9f5e72025-07-08 18:04:53 -0400728 cpu=ns32k
729 vendor=encore
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530730 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400731 elxsi)
732 cpu=elxsi
733 vendor=elxsi
734 basic_os=${basic_os:-bsd}
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530735 ;;
736 fx2800)
micky3879b9f5e72025-07-08 18:04:53 -0400737 cpu=i860
738 vendor=alliant
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530739 ;;
740 genix)
micky3879b9f5e72025-07-08 18:04:53 -0400741 cpu=ns32k
742 vendor=ns
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530743 ;;
744 h3050r* | hiux*)
micky3879b9f5e72025-07-08 18:04:53 -0400745 cpu=hppa1.1
746 vendor=hitachi
747 basic_os=hiuxwe2
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530748 ;;
749 hp3k9[0-9][0-9] | hp9[0-9][0-9])
micky3879b9f5e72025-07-08 18:04:53 -0400750 cpu=hppa1.0
751 vendor=hp
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530752 ;;
753 hp9k2[0-9][0-9] | hp9k31[0-9])
micky3879b9f5e72025-07-08 18:04:53 -0400754 cpu=m68000
755 vendor=hp
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530756 ;;
757 hp9k3[2-9][0-9])
micky3879b9f5e72025-07-08 18:04:53 -0400758 cpu=m68k
759 vendor=hp
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530760 ;;
761 hp9k6[0-9][0-9] | hp6[0-9][0-9])
micky3879b9f5e72025-07-08 18:04:53 -0400762 cpu=hppa1.0
763 vendor=hp
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530764 ;;
765 hp9k7[0-79][0-9] | hp7[0-79][0-9])
micky3879b9f5e72025-07-08 18:04:53 -0400766 cpu=hppa1.1
767 vendor=hp
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530768 ;;
769 hp9k78[0-9] | hp78[0-9])
770 # FIXME: really hppa2.0-hp
micky3879b9f5e72025-07-08 18:04:53 -0400771 cpu=hppa1.1
772 vendor=hp
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530773 ;;
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
micky3879b9f5e72025-07-08 18:04:53 -0400776 cpu=hppa1.1
777 vendor=hp
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530778 ;;
779 hp9k8[0-9][13679] | hp8[0-9][13679])
micky3879b9f5e72025-07-08 18:04:53 -0400780 cpu=hppa1.1
781 vendor=hp
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530782 ;;
783 hp9k8[0-9][0-9] | hp8[0-9][0-9])
micky3879b9f5e72025-07-08 18:04:53 -0400784 cpu=hppa1.0
785 vendor=hp
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530786 ;;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530787 i*86v32)
micky3879b9f5e72025-07-08 18:04:53 -0400788 cpu=`echo "$1" | sed -e 's/86.*/86/'`
789 vendor=pc
790 basic_os=sysv32
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530791 ;;
792 i*86v4*)
micky3879b9f5e72025-07-08 18:04:53 -0400793 cpu=`echo "$1" | sed -e 's/86.*/86/'`
794 vendor=pc
795 basic_os=sysv4
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530796 ;;
797 i*86v)
micky3879b9f5e72025-07-08 18:04:53 -0400798 cpu=`echo "$1" | sed -e 's/86.*/86/'`
799 vendor=pc
800 basic_os=sysv
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530801 ;;
802 i*86sol2)
micky3879b9f5e72025-07-08 18:04:53 -0400803 cpu=`echo "$1" | sed -e 's/86.*/86/'`
804 vendor=pc
805 basic_os=solaris2
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530806 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400807 j90 | j90-cray)
808 cpu=j90
809 vendor=cray
810 basic_os=${basic_os:-unicos}
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530811 ;;
812 iris | iris4d)
micky3879b9f5e72025-07-08 18:04:53 -0400813 cpu=mips
814 vendor=sgi
815 case $basic_os in
816 irix*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530817 ;;
818 *)
micky3879b9f5e72025-07-08 18:04:53 -0400819 basic_os=irix4
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530820 ;;
821 esac
822 ;;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530823 miniframe)
micky3879b9f5e72025-07-08 18:04:53 -0400824 cpu=m68000
825 vendor=convergent
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530826 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400827 *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
828 cpu=m68k
829 vendor=atari
830 basic_os=mint
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530831 ;;
832 news-3600 | risc-news)
micky3879b9f5e72025-07-08 18:04:53 -0400833 cpu=mips
834 vendor=sony
835 basic_os=newsos
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530836 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400837 next | m*-next)
838 cpu=m68k
839 vendor=next
840 case $basic_os in
841 openstep*)
842 ;;
843 nextstep*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530844 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400845 ns2*)
846 basic_os=nextstep2
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530847 ;;
848 *)
micky3879b9f5e72025-07-08 18:04:53 -0400849 basic_os=nextstep3
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530850 ;;
851 esac
852 ;;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530853 np1)
micky3879b9f5e72025-07-08 18:04:53 -0400854 cpu=np1
855 vendor=gould
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530856 ;;
857 op50n-* | op60c-*)
micky3879b9f5e72025-07-08 18:04:53 -0400858 cpu=hppa1.1
859 vendor=oki
860 basic_os=proelf
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530861 ;;
862 pa-hitachi)
micky3879b9f5e72025-07-08 18:04:53 -0400863 cpu=hppa1.1
864 vendor=hitachi
865 basic_os=hiuxwe2
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530866 ;;
867 pbd)
micky3879b9f5e72025-07-08 18:04:53 -0400868 cpu=sparc
869 vendor=tti
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530870 ;;
871 pbb)
micky3879b9f5e72025-07-08 18:04:53 -0400872 cpu=m68k
873 vendor=tti
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530874 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400875 pc532)
876 cpu=ns32k
877 vendor=pc532
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530878 ;;
879 pn)
micky3879b9f5e72025-07-08 18:04:53 -0400880 cpu=pn
881 vendor=gould
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530882 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400883 power)
884 cpu=power
885 vendor=ibm
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530886 ;;
887 ps2)
micky3879b9f5e72025-07-08 18:04:53 -0400888 cpu=i386
889 vendor=ibm
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530890 ;;
891 rm[46]00)
micky3879b9f5e72025-07-08 18:04:53 -0400892 cpu=mips
893 vendor=siemens
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530894 ;;
895 rtpc | rtpc-*)
micky3879b9f5e72025-07-08 18:04:53 -0400896 cpu=romp
897 vendor=ibm
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530898 ;;
899 sde)
micky3879b9f5e72025-07-08 18:04:53 -0400900 cpu=mipsisa32
901 vendor=sde
902 basic_os=${basic_os:-elf}
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530903 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400904 simso-wrs)
905 cpu=sparclite
906 vendor=wrs
907 basic_os=vxworks
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530908 ;;
909 tower | tower-32)
micky3879b9f5e72025-07-08 18:04:53 -0400910 cpu=m68k
911 vendor=ncr
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530912 ;;
913 vpp*|vx|vx-*)
micky3879b9f5e72025-07-08 18:04:53 -0400914 cpu=f301
915 vendor=fujitsu
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530916 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400917 w65)
918 cpu=w65
919 vendor=wdc
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530920 ;;
921 w89k-*)
micky3879b9f5e72025-07-08 18:04:53 -0400922 cpu=hppa1.1
923 vendor=winbond
924 basic_os=proelf
Steve Kondikae271bc2015-11-15 02:50:53 +0100925 ;;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530926 none)
micky3879b9f5e72025-07-08 18:04:53 -0400927 cpu=none
928 vendor=none
929 ;;
930 leon|leon[3-9])
931 cpu=sparc
932 vendor=$basic_machine
933 ;;
934 leon-*|leon[3-9]-*)
935 cpu=sparc
936 vendor=`echo "$basic_machine" | sed 's/-.*//'`
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530937 ;;
938
micky3879b9f5e72025-07-08 18:04:53 -0400939 *-*)
940 # shellcheck disable=SC2162
941 saved_IFS=$IFS
942 IFS="-" read cpu vendor <<EOF
943$basic_machine
944EOF
945 IFS=$saved_IFS
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530946 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400947 # 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
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530953 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400954 # 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
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530959 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400960 x64 | amd64)
961 cpu=x86_64
962 vendor=pc
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530963 ;;
micky3879b9f5e72025-07-08 18:04:53 -0400964 # Recognize the basic CPU types without company name.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530965 *)
micky3879b9f5e72025-07-08 18:04:53 -0400966 cpu=$basic_machine
967 vendor=unknown
968 ;;
969esac
970
971unset -v basic_machine
972
973# Decode basic machines in the full and proper CPU-Company form.
974case $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}
980 ;;
981 c90-unknown | c90-cray)
982 vendor=cray
983 basic_os=${Basic_os:-unicos}
984 ;;
985 fx80-unknown)
986 vendor=alliant
987 ;;
988 romp-unknown)
989 vendor=ibm
990 ;;
991 mmix-unknown)
992 vendor=knuth
993 ;;
994 microblaze-unknown | microblazeel-unknown)
995 vendor=xilinx
996 ;;
997 rs6000-unknown)
998 vendor=ibm
999 ;;
1000 vax-unknown)
1001 vendor=dec
1002 ;;
1003 pdp11-unknown)
1004 vendor=dec
1005 ;;
1006 we32k-unknown)
1007 vendor=att
1008 ;;
1009 cydra-unknown)
1010 vendor=cydrome
1011 ;;
1012 i370-ibm*)
1013 vendor=ibm
1014 ;;
1015 orion-unknown)
1016 vendor=highlevel
1017 ;;
1018 xps-unknown | xps100-unknown)
1019 cpu=xps100
1020 vendor=honeywell
1021 ;;
1022
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}
1028 ;;
1029 dpx20-unknown | dpx20-bull)
1030 cpu=rs6000
1031 vendor=bull
1032 basic_os=${basic_os:-bosx}
1033 ;;
1034
1035 # Here we normalize CPU types irrespective of the vendor
1036 amd64-*)
1037 cpu=x86_64
1038 ;;
1039 blackfin-*)
1040 cpu=bfin
1041 basic_os=linux
1042 ;;
1043 c54x-*)
1044 cpu=tic54x
1045 ;;
1046 c55x-*)
1047 cpu=tic55x
1048 ;;
1049 c6x-*)
1050 cpu=tic6x
1051 ;;
1052 e500v[12]-*)
1053 cpu=powerpc
1054 basic_os=${basic_os}"spe"
1055 ;;
1056 mips3*-*)
1057 cpu=mips64
1058 ;;
1059 ms1-*)
1060 cpu=mt
1061 ;;
1062 m68knommu-*)
1063 cpu=m68k
1064 basic_os=linux
1065 ;;
1066 m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
1067 cpu=s12z
1068 ;;
1069 openrisc-*)
1070 cpu=or32
1071 ;;
1072 parisc-*)
1073 cpu=hppa
1074 basic_os=linux
1075 ;;
1076 pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
1077 cpu=i586
1078 ;;
1079 pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*)
1080 cpu=i686
1081 ;;
1082 pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
1083 cpu=i686
1084 ;;
1085 pentium4-*)
1086 cpu=i786
1087 ;;
1088 pc98-*)
1089 cpu=i386
1090 ;;
1091 ppc-* | ppcbe-*)
1092 cpu=powerpc
1093 ;;
1094 ppcle-* | powerpclittle-*)
1095 cpu=powerpcle
1096 ;;
1097 ppc64-*)
1098 cpu=powerpc64
1099 ;;
1100 ppc64le-* | powerpc64little-*)
1101 cpu=powerpc64le
1102 ;;
1103 sb1-*)
1104 cpu=mipsisa64sb1
1105 ;;
1106 sb1el-*)
1107 cpu=mipsisa64sb1el
1108 ;;
1109 sh5e[lb]-*)
1110 cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
1111 ;;
1112 spur-*)
1113 cpu=spur
1114 ;;
1115 strongarm-* | thumb-*)
1116 cpu=arm
1117 ;;
1118 tx39-*)
1119 cpu=mipstx39
1120 ;;
1121 tx39el-*)
1122 cpu=mipstx39el
1123 ;;
1124 x64-*)
1125 cpu=x86_64
1126 ;;
1127 xscale-* | xscalee[bl]-*)
1128 cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
1129 ;;
1130 arm64-* | aarch64le-*)
1131 cpu=aarch64
1132 ;;
1133
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}
1138 ;;
1139 crisv32-* | etraxfs*-*)
1140 cpu=crisv32
1141 vendor=axis
1142 ;;
1143 cris-* | etrax*-*)
1144 cpu=cris
1145 vendor=axis
1146 ;;
1147 crx-*)
1148 basic_os=${basic_os:-elf}
1149 ;;
1150 neo-tandem)
1151 cpu=neo
1152 vendor=tandem
1153 ;;
1154 nse-tandem)
1155 cpu=nse
1156 vendor=tandem
1157 ;;
1158 nsr-tandem)
1159 cpu=nsr
1160 vendor=tandem
1161 ;;
1162 nsv-tandem)
1163 cpu=nsv
1164 vendor=tandem
1165 ;;
1166 nsx-tandem)
1167 cpu=nsx
1168 vendor=tandem
1169 ;;
1170 mipsallegrexel-sony)
1171 cpu=mipsallegrexel
1172 vendor=sony
1173 ;;
1174 tile*-*)
1175 basic_os=${basic_os:-linux-gnu}
1176 ;;
1177
1178 *)
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 | aarch64c | arm64ec \
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 | javascript \
1204 | h8300 | h8500 \
1205 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
1206 | hexagon \
1207 | i370 | i*86 | i860 | i960 | ia16 | ia64 \
1208 | ip2k | iq2000 \
1209 | k1om \
1210 | kvx \
1211 | le32 | le64 \
1212 | lm32 \
1213 | loongarch32 | loongarch64 \
1214 | m32c | m32r | m32rle \
1215 | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
1216 | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
1217 | m88110 | m88k | maxq | mb | mcore | mep | metag \
1218 | microblaze | microblazeel \
1219 | mips* \
1220 | mmix \
1221 | mn10200 | mn10300 \
1222 | moxie \
1223 | mt \
1224 | msp430 \
1225 | nanomips* \
1226 | nds32 | nds32le | nds32be \
1227 | nfp \
1228 | nios | nios2 | nios2eb | nios2el \
1229 | none | np1 | ns16k | ns32k | nvptx \
1230 | open8 \
1231 | or1k* \
1232 | or32 \
1233 | orion \
1234 | picochip \
1235 | pdp10 | pdp11 | pj | pjl | pn | power \
1236 | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
1237 | pru \
1238 | pyramid \
1239 | riscv | riscv32 | riscv32be | riscv64 | riscv64be \
1240 | rl78 | romp | rs6000 | rx \
1241 | s390 | s390x \
1242 | score \
1243 | sh | shl \
1244 | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
1245 | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
1246 | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
1247 | sparclite \
1248 | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
1249 | spu \
1250 | tahoe \
1251 | thumbv7* \
1252 | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
1253 | tron \
1254 | ubicom32 \
1255 | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
1256 | vax \
1257 | vc4 \
1258 | visium \
1259 | w65 \
1260 | wasm32 | wasm64 \
1261 | we32k \
1262 | x86 | x86_64 | xc16x | xgate | xps100 \
1263 | xstormy16 | xtensa* \
1264 | ymp \
1265 | z8k | z80)
1266 ;;
1267
1268 *)
1269 echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2
1270 exit 1
1271 ;;
1272 esac
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301273 ;;
1274esac
1275
1276# Here we canonicalize certain aliases for manufacturers.
micky3879b9f5e72025-07-08 18:04:53 -04001277case $vendor in
1278 digital*)
1279 vendor=dec
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301280 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001281 commodore*)
1282 vendor=cbm
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301283 ;;
1284 *)
1285 ;;
1286esac
1287
1288# Decode manufacturer-specific aliases for certain operating systems.
1289
micky3879b9f5e72025-07-08 18:04:53 -04001290if test x"$basic_os" != x
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301291then
micky3879b9f5e72025-07-08 18:04:53 -04001292
1293# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
1294# set os.
1295obj=
1296case $basic_os in
1297 gnu/linux*)
1298 kernel=linux
1299 os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
1300 ;;
1301 os2-emx)
1302 kernel=os2
1303 os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
1304 ;;
1305 nto-qnx*)
1306 kernel=nto
1307 os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
1308 ;;
1309 *-*)
1310 # shellcheck disable=SC2162
1311 saved_IFS=$IFS
1312 IFS="-" read kernel os <<EOF
1313$basic_os
1314EOF
1315 IFS=$saved_IFS
1316 ;;
1317 # Default OS when just kernel was specified
1318 nto*)
1319 kernel=nto
1320 os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
1321 ;;
1322 linux*)
1323 kernel=linux
1324 os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
1325 ;;
1326 managarm*)
1327 kernel=managarm
1328 os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'`
1329 ;;
1330 *)
1331 kernel=
1332 os=$basic_os
1333 ;;
1334esac
1335
1336# Now, normalize the OS (knowing we just have one component, it's not a kernel,
1337# etc.)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301338case $os in
micky3879b9f5e72025-07-08 18:04:53 -04001339 # First match some system type aliases that might get confused
1340 # with valid system types.
1341 # solaris* is a basic system type, with this one exception.
1342 auroraux)
1343 os=auroraux
Steve Kondikae271bc2015-11-15 02:50:53 +01001344 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001345 bluegene*)
1346 os=cnk
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301347 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001348 solaris1 | solaris1.*)
1349 os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301350 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001351 solaris)
1352 os=solaris2
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301353 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001354 unixware*)
1355 os=sysv4.2uw
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301356 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001357 # es1800 is here to avoid being matched by es* (a different OS)
1358 es1800*)
1359 os=ose
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301360 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001361 # Some version numbers need modification
1362 chorusos*)
1363 os=chorusos
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301364 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001365 isc)
1366 os=isc2.2
1367 ;;
1368 sco6)
1369 os=sco5v6
1370 ;;
1371 sco5)
1372 os=sco3.2v5
1373 ;;
1374 sco4)
1375 os=sco3.2v4
1376 ;;
1377 sco3.2.[4-9]*)
1378 os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
1379 ;;
1380 sco*v* | scout)
1381 # Don't match below
1382 ;;
1383 sco*)
1384 os=sco3.2v2
1385 ;;
1386 psos*)
1387 os=psos
1388 ;;
1389 qnx*)
1390 os=qnx
1391 ;;
1392 hiux*)
1393 os=hiuxwe2
1394 ;;
1395 lynx*178)
1396 os=lynxos178
1397 ;;
1398 lynx*5)
1399 os=lynxos5
1400 ;;
1401 lynxos*)
1402 # don't get caught up in next wildcard
1403 ;;
1404 lynx*)
1405 os=lynxos
1406 ;;
1407 mac[0-9]*)
1408 os=`echo "$os" | sed -e 's|mac|macos|'`
1409 ;;
1410 opened*)
1411 os=openedition
1412 ;;
1413 os400*)
1414 os=os400
1415 ;;
1416 sunos5*)
1417 os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
1418 ;;
1419 sunos6*)
1420 os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
1421 ;;
1422 wince*)
1423 os=wince
1424 ;;
1425 utek*)
1426 os=bsd
1427 ;;
1428 dynix*)
1429 os=bsd
1430 ;;
1431 acis*)
1432 os=aos
1433 ;;
1434 atheos*)
1435 os=atheos
1436 ;;
1437 syllable*)
1438 os=syllable
1439 ;;
1440 386bsd)
1441 os=bsd
1442 ;;
1443 ctix* | uts*)
1444 os=sysv
1445 ;;
1446 nova*)
1447 os=rtmk-nova
1448 ;;
1449 ns2)
1450 os=nextstep2
1451 ;;
1452 # Preserve the version number of sinix5.
1453 sinix5.*)
1454 os=`echo "$os" | sed -e 's|sinix|sysv|'`
1455 ;;
1456 sinix*)
1457 os=sysv4
1458 ;;
1459 tpf*)
1460 os=tpf
1461 ;;
1462 triton*)
1463 os=sysv3
1464 ;;
1465 oss*)
1466 os=sysv3
1467 ;;
1468 svr4*)
1469 os=sysv4
1470 ;;
1471 svr3)
1472 os=sysv3
1473 ;;
1474 sysvr4)
1475 os=sysv4
1476 ;;
1477 ose*)
1478 os=ose
1479 ;;
1480 *mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
1481 os=mint
1482 ;;
1483 dicos*)
1484 os=dicos
1485 ;;
1486 pikeos*)
1487 # Until real need of OS specific support for
1488 # particular features comes up, bare metal
1489 # configurations are quite functional.
1490 case $cpu in
1491 arm*)
1492 os=eabi
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301493 ;;
1494 *)
micky3879b9f5e72025-07-08 18:04:53 -04001495 os=
1496 obj=elf
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301497 ;;
1498 esac
1499 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001500 aout* | coff* | elf* | pe*)
1501 # These are machine code file formats, not OSes
1502 obj=$os
1503 os=
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301504 ;;
1505 *)
micky3879b9f5e72025-07-08 18:04:53 -04001506 # No normalization, but not necessarily accepted, that comes below.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301507 ;;
1508esac
micky3879b9f5e72025-07-08 18:04:53 -04001509
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301510else
1511
1512# Here we handle the default operating systems that come with various machines.
1513# The value should be what the vendor currently ships out the door with their
1514# machine or put another way, the most popular os provided with the machine.
1515
1516# Note that if you're going to try to match "-MANUFACTURER" here (say,
1517# "-sun"), then you have to tell the case statement up towards the top
1518# that MANUFACTURER isn't an operating system. Otherwise, code above
1519# will signal an error saying that MANUFACTURER isn't an operating
1520# system, and we'll never get to this point.
1521
micky3879b9f5e72025-07-08 18:04:53 -04001522kernel=
1523obj=
1524case $cpu-$vendor in
Steve Kondikae271bc2015-11-15 02:50:53 +01001525 score-*)
micky3879b9f5e72025-07-08 18:04:53 -04001526 os=
1527 obj=elf
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301528 ;;
Steve Kondikae271bc2015-11-15 02:50:53 +01001529 spu-*)
micky3879b9f5e72025-07-08 18:04:53 -04001530 os=
1531 obj=elf
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301532 ;;
1533 *-acorn)
micky3879b9f5e72025-07-08 18:04:53 -04001534 os=riscix1.2
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301535 ;;
1536 arm*-rebel)
micky3879b9f5e72025-07-08 18:04:53 -04001537 kernel=linux
1538 os=gnu
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301539 ;;
1540 arm*-semi)
micky3879b9f5e72025-07-08 18:04:53 -04001541 os=
1542 obj=aout
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301543 ;;
Steve Kondikae271bc2015-11-15 02:50:53 +01001544 c4x-* | tic4x-*)
micky3879b9f5e72025-07-08 18:04:53 -04001545 os=
1546 obj=coff
Steve Kondikae271bc2015-11-15 02:50:53 +01001547 ;;
1548 c8051-*)
micky3879b9f5e72025-07-08 18:04:53 -04001549 os=
1550 obj=elf
1551 ;;
1552 clipper-intergraph)
1553 os=clix
Steve Kondikae271bc2015-11-15 02:50:53 +01001554 ;;
1555 hexagon-*)
micky3879b9f5e72025-07-08 18:04:53 -04001556 os=
1557 obj=elf
Steve Kondikae271bc2015-11-15 02:50:53 +01001558 ;;
1559 tic54x-*)
micky3879b9f5e72025-07-08 18:04:53 -04001560 os=
1561 obj=coff
Steve Kondikae271bc2015-11-15 02:50:53 +01001562 ;;
1563 tic55x-*)
micky3879b9f5e72025-07-08 18:04:53 -04001564 os=
1565 obj=coff
Steve Kondikae271bc2015-11-15 02:50:53 +01001566 ;;
1567 tic6x-*)
micky3879b9f5e72025-07-08 18:04:53 -04001568 os=
1569 obj=coff
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301570 ;;
1571 # This must come before the *-dec entry.
1572 pdp10-*)
micky3879b9f5e72025-07-08 18:04:53 -04001573 os=tops20
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301574 ;;
1575 pdp11-*)
micky3879b9f5e72025-07-08 18:04:53 -04001576 os=none
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301577 ;;
1578 *-dec | vax-*)
micky3879b9f5e72025-07-08 18:04:53 -04001579 os=ultrix4.2
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301580 ;;
1581 m68*-apollo)
micky3879b9f5e72025-07-08 18:04:53 -04001582 os=domain
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301583 ;;
1584 i386-sun)
micky3879b9f5e72025-07-08 18:04:53 -04001585 os=sunos4.0.2
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301586 ;;
1587 m68000-sun)
micky3879b9f5e72025-07-08 18:04:53 -04001588 os=sunos3
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301589 ;;
1590 m68*-cisco)
micky3879b9f5e72025-07-08 18:04:53 -04001591 os=
1592 obj=aout
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301593 ;;
Steve Kondikae271bc2015-11-15 02:50:53 +01001594 mep-*)
micky3879b9f5e72025-07-08 18:04:53 -04001595 os=
1596 obj=elf
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301597 ;;
1598 mips*-cisco)
micky3879b9f5e72025-07-08 18:04:53 -04001599 os=
1600 obj=elf
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301601 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001602 mips*-*|nanomips*-*)
1603 os=
1604 obj=elf
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301605 ;;
1606 or32-*)
micky3879b9f5e72025-07-08 18:04:53 -04001607 os=
1608 obj=coff
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301609 ;;
1610 *-tti) # must be before sparc entry or we get the wrong os.
micky3879b9f5e72025-07-08 18:04:53 -04001611 os=sysv3
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301612 ;;
1613 sparc-* | *-sun)
micky3879b9f5e72025-07-08 18:04:53 -04001614 os=sunos4.1.1
1615 ;;
1616 pru-*)
1617 os=
1618 obj=elf
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301619 ;;
1620 *-be)
micky3879b9f5e72025-07-08 18:04:53 -04001621 os=beos
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301622 ;;
1623 *-ibm)
micky3879b9f5e72025-07-08 18:04:53 -04001624 os=aix
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301625 ;;
Steve Kondikae271bc2015-11-15 02:50:53 +01001626 *-knuth)
micky3879b9f5e72025-07-08 18:04:53 -04001627 os=mmixware
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301628 ;;
1629 *-wec)
micky3879b9f5e72025-07-08 18:04:53 -04001630 os=proelf
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301631 ;;
1632 *-winbond)
micky3879b9f5e72025-07-08 18:04:53 -04001633 os=proelf
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301634 ;;
1635 *-oki)
micky3879b9f5e72025-07-08 18:04:53 -04001636 os=proelf
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301637 ;;
1638 *-hp)
micky3879b9f5e72025-07-08 18:04:53 -04001639 os=hpux
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301640 ;;
1641 *-hitachi)
micky3879b9f5e72025-07-08 18:04:53 -04001642 os=hiux
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301643 ;;
1644 i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
micky3879b9f5e72025-07-08 18:04:53 -04001645 os=sysv
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301646 ;;
1647 *-cbm)
micky3879b9f5e72025-07-08 18:04:53 -04001648 os=amigaos
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301649 ;;
1650 *-dg)
micky3879b9f5e72025-07-08 18:04:53 -04001651 os=dgux
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301652 ;;
1653 *-dolphin)
micky3879b9f5e72025-07-08 18:04:53 -04001654 os=sysv3
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301655 ;;
1656 m68k-ccur)
micky3879b9f5e72025-07-08 18:04:53 -04001657 os=rtu
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301658 ;;
1659 m88k-omron*)
micky3879b9f5e72025-07-08 18:04:53 -04001660 os=luna
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301661 ;;
1662 *-next)
micky3879b9f5e72025-07-08 18:04:53 -04001663 os=nextstep
1664 ;;
1665 *-sequent)
1666 os=ptx
1667 ;;
1668 *-crds)
1669 os=unos
1670 ;;
1671 *-ns)
1672 os=genix
1673 ;;
1674 i370-*)
1675 os=mvs
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301676 ;;
1677 *-gould)
micky3879b9f5e72025-07-08 18:04:53 -04001678 os=sysv
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301679 ;;
1680 *-highlevel)
micky3879b9f5e72025-07-08 18:04:53 -04001681 os=bsd
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301682 ;;
1683 *-encore)
micky3879b9f5e72025-07-08 18:04:53 -04001684 os=bsd
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301685 ;;
1686 *-sgi)
micky3879b9f5e72025-07-08 18:04:53 -04001687 os=irix
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301688 ;;
1689 *-siemens)
micky3879b9f5e72025-07-08 18:04:53 -04001690 os=sysv4
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301691 ;;
1692 *-masscomp)
micky3879b9f5e72025-07-08 18:04:53 -04001693 os=rtu
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301694 ;;
1695 f30[01]-fujitsu | f700-fujitsu)
micky3879b9f5e72025-07-08 18:04:53 -04001696 os=uxpv
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301697 ;;
1698 *-rom68k)
micky3879b9f5e72025-07-08 18:04:53 -04001699 os=
1700 obj=coff
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301701 ;;
1702 *-*bug)
micky3879b9f5e72025-07-08 18:04:53 -04001703 os=
1704 obj=coff
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301705 ;;
1706 *-apple)
micky3879b9f5e72025-07-08 18:04:53 -04001707 os=macos
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301708 ;;
1709 *-atari*)
micky3879b9f5e72025-07-08 18:04:53 -04001710 os=mint
1711 ;;
1712 *-wrs)
1713 os=vxworks
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301714 ;;
1715 *)
micky3879b9f5e72025-07-08 18:04:53 -04001716 os=none
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301717 ;;
1718esac
micky3879b9f5e72025-07-08 18:04:53 -04001719
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301720fi
1721
micky3879b9f5e72025-07-08 18:04:53 -04001722# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ).
1723
1724case $os in
1725 # Sometimes we do "kernel-libc", so those need to count as OSes.
1726 llvm* | musl* | newlib* | relibc* | uclibc*)
1727 ;;
1728 # Likewise for "kernel-abi"
1729 eabi* | gnueabi*)
1730 ;;
1731 # VxWorks passes extra cpu info in the 4th filed.
1732 simlinux | simwindows | spe)
1733 ;;
1734 # See `case $cpu-$os` validation below
1735 ghcjs)
1736 ;;
1737 # Now accept the basic system types.
1738 # The portable systems comes first.
1739 # Each alternative MUST end in a * to match a version number.
1740 gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
1741 | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
1742 | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
1743 | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \
1744 | hiux* | abug | nacl* | netware* | windows* \
1745 | os9* | macos* | osx* | ios* | tvos* | watchos* \
1746 | mpw* | magic* | mmixware* | mon960* | lnews* \
1747 | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
1748 | aos* | aros* | cloudabi* | sortix* | twizzler* \
1749 | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
1750 | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
1751 | mirbsd* | netbsd* | dicos* | openedition* | ose* \
1752 | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
1753 | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
1754 | bosx* | nextstep* | cxux* | oabi* \
1755 | ptx* | ecoff* | winnt* | domain* | vsta* \
1756 | udi* | lites* | ieee* | go32* | aux* | hcos* \
1757 | chorusrdb* | cegcc* | glidix* | serenity* \
1758 | cygwin* | msys* | moss* | proelf* | rtems* \
1759 | midipix* | mingw32* | mingw64* | mint* \
1760 | uxpv* | beos* | mpeix* | udk* | moxiebox* \
1761 | interix* | uwin* | mks* | rhapsody* | darwin* \
1762 | openstep* | oskit* | conix* | pw32* | nonstopux* \
1763 | storm-chaos* | tops10* | tenex* | tops20* | its* \
1764 | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
1765 | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
1766 | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
1767 | skyos* | haiku* | rdos* | toppers* | drops* | es* \
1768 | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
1769 | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
1770 | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
1771 | fiwix* | mlibc* | cos* | mbr* | ironclad* )
1772 ;;
1773 # This one is extra strict with allowed versions
1774 sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
1775 # Don't forget version if it is 3.2v4 or newer.
1776 ;;
1777 # This refers to builds using the UEFI calling convention
1778 # (which depends on the architecture) and PE file format.
1779 # Note that this is both a different calling convention and
1780 # different file format than that of GNU-EFI
1781 # (x86_64-w64-mingw32).
1782 uefi)
1783 ;;
1784 none)
1785 ;;
1786 kernel* | msvc* )
1787 # Restricted further below
1788 ;;
1789 '')
1790 if test x"$obj" = x
1791 then
1792 echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2
1793 fi
1794 ;;
1795 *)
1796 echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2
1797 exit 1
1798 ;;
1799esac
1800
1801case $obj in
1802 aout* | coff* | elf* | pe*)
1803 ;;
1804 '')
1805 # empty is fine
1806 ;;
1807 *)
1808 echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2
1809 exit 1
1810 ;;
1811esac
1812
1813# Here we handle the constraint that a (synthetic) cpu and os are
1814# valid only in combination with each other and nowhere else.
1815case $cpu-$os in
1816 # The "javascript-unknown-ghcjs" triple is used by GHC; we
1817 # accept it here in order to tolerate that, but reject any
1818 # variations.
1819 javascript-ghcjs)
1820 ;;
1821 javascript-* | *-ghcjs)
1822 echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2
1823 exit 1
1824 ;;
1825esac
1826
1827# As a final step for OS-related things, validate the OS-kernel combination
1828# (given a valid OS), if there is a kernel.
1829case $kernel-$os-$obj in
1830 linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \
1831 | linux-mlibc*- | linux-musl*- | linux-newlib*- \
1832 | linux-relibc*- | linux-uclibc*- )
1833 ;;
1834 uclinux-uclibc*- )
1835 ;;
1836 managarm-mlibc*- | managarm-kernel*- )
1837 ;;
1838 windows*-msvc*-)
1839 ;;
1840 -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \
1841 | -uclibc*- )
1842 # These are just libc implementations, not actual OSes, and thus
1843 # require a kernel.
1844 echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2
1845 exit 1
1846 ;;
1847 -kernel*- )
1848 echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2
1849 exit 1
1850 ;;
1851 *-kernel*- )
1852 echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2
1853 exit 1
1854 ;;
1855 *-msvc*- )
1856 echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2
1857 exit 1
1858 ;;
1859 kfreebsd*-gnu*- | kopensolaris*-gnu*-)
1860 ;;
1861 vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-)
1862 ;;
1863 nto-qnx*-)
1864 ;;
1865 os2-emx-)
1866 ;;
1867 *-eabi*- | *-gnueabi*-)
1868 ;;
1869 none--*)
1870 # None (no kernel, i.e. freestanding / bare metal),
1871 # can be paired with an machine code file format
1872 ;;
1873 -*-)
1874 # Blank kernel with real OS is always fine.
1875 ;;
1876 --*)
1877 # Blank kernel and OS with real machine code file format is always fine.
1878 ;;
1879 *-*-*)
1880 echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2
1881 exit 1
1882 ;;
1883esac
1884
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301885# Here we handle the case where we know the os, and the CPU type, but not the
1886# manufacturer. We pick the logical manufacturer.
micky3879b9f5e72025-07-08 18:04:53 -04001887case $vendor in
1888 unknown)
1889 case $cpu-$os in
1890 *-riscix*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301891 vendor=acorn
1892 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001893 *-sunos*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301894 vendor=sun
1895 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001896 *-cnk* | *-aix*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301897 vendor=ibm
1898 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001899 *-beos*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301900 vendor=be
1901 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001902 *-hpux*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301903 vendor=hp
1904 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001905 *-mpeix*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301906 vendor=hp
1907 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001908 *-hiux*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301909 vendor=hitachi
1910 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001911 *-unos*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301912 vendor=crds
1913 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001914 *-dgux*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301915 vendor=dg
1916 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001917 *-luna*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301918 vendor=omron
1919 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001920 *-genix*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301921 vendor=ns
1922 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001923 *-clix*)
1924 vendor=intergraph
1925 ;;
1926 *-mvs* | *-opened*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301927 vendor=ibm
1928 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001929 *-os400*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301930 vendor=ibm
1931 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001932 s390-* | s390x-*)
1933 vendor=ibm
1934 ;;
1935 *-ptx*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301936 vendor=sequent
1937 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001938 *-tpf*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301939 vendor=ibm
1940 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001941 *-vxsim* | *-vxworks* | *-windiss*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301942 vendor=wrs
1943 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001944 *-aux*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301945 vendor=apple
1946 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001947 *-hms*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301948 vendor=hitachi
1949 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001950 *-mpw* | *-macos*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301951 vendor=apple
1952 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001953 *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301954 vendor=atari
1955 ;;
micky3879b9f5e72025-07-08 18:04:53 -04001956 *-vos*)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301957 vendor=stratus
1958 ;;
1959 esac
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301960 ;;
1961esac
1962
micky3879b9f5e72025-07-08 18:04:53 -04001963echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}"
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301964exit
1965
1966# Local variables:
micky3879b9f5e72025-07-08 18:04:53 -04001967# eval: (add-hook 'before-save-hook 'time-stamp)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301968# time-stamp-start: "timestamp='"
1969# time-stamp-format: "%:y-%02m-%02d"
1970# time-stamp-end: "'"
1971# End: