recurse explicitly with -f test-build.mk when appropriate.
[deliverable/binutils-gdb.git] / config.sub
CommitLineData
4f183929 1#!/bin/sh
a2ee3e6d 2# Configuration validation subroutine script, version 1.0.
68cd7865 3# Copyright (C) 1991, 1992 Free Software Foundation, Inc.
a2ee3e6d
JW
4
5#This file is free software; you can redistribute it and/or modify
6#it under the terms of the GNU General Public License as published by
7#the Free Software Foundation; either version 2 of the License, or
8#(at your option) any later version.
9
10#This program is distributed in the hope that it will be useful,
11#but WITHOUT ANY WARRANTY; without even the implied warranty of
12#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13#GNU General Public License for more details.
14
15#You should have received a copy of the GNU General Public License
16#along with this program; if not, write to the Free Software
17#Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
4f183929
RP
19
20# Configuration subroutine to validate and canonicalize a configuration type.
21# Supply the specified configuration type as an argument.
22# If it is invalid, we print an error message on stderr and exit with code 1.
23# Otherwise, we print the canonical config type on stdout and succeed.
24
25# This file is supposed to be the same for all GNU packages
26# and recognize all the CPU types, system types and aliases
27# that are meaningful with *any* GNU software.
28# Each package is responsible for reporting which valid configurations
29# it does not support. The user should be able to distinguish
30# a failure to support a valid configuration from a meaningless
a2ee3e6d 31# configuration.
4f183929 32
a2ee3e6d
JW
33# The goal of this file is to map all the various variations of a given
34# machine specification into a single specification in the form:
35# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
36# it is wrong to echo any other type of specification
8b204e6e 37
a2ee3e6d
JW
38# First pass through any local machine types.
39case $1 in
40 *local*)
41 echo $1
42 exit 0
43 ;;
44 *)
69e87de2 45 ;;
a2ee3e6d 46esac
b9fe720d 47
a2ee3e6d 48# Separate what the user gave into CPU-COMPANY and OS (if any).
8bcd7db2 49basic_machine=`echo $1 | sed 's/-[^-][^-]*$//'`
a2ee3e6d
JW
50if [ $basic_machine != $1 ]
51then os=`echo $1 | sed 's/.*-/-/'`
52else os=; fi
caebaa16 53
a2ee3e6d
JW
54# Lets recognize common machines as not being OS so that things like
55# config.subr decstation-3100 as legal.
56case $os in
57 -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
58 -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
59 -unicom* | -ibm* | -next* | -hp | -isi* | -apollo | -altos* | \
60 -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -osf* | \
61 -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
62 -harris)
63 os=
64 basic_machine=$1
65 ;;
66 -sco*)
67 os=-scosysv322
68 basic_machine=i386-unknown
69 ;;
70 -isc*)
71 os=-iscsysv
72 basic_machine=i386-unknown
73 ;;
74# start-sanitize-v9
75 -32)
76 basic_machine=sparc64-hal
77 os=-hal32
78 ;;
79 -64)
80 basic_machine=sparc64-hal
81 os=-hal64
82 ;;
83 -v7)
84 basic_machine=sparc64-sun
85 os=-v7
86 ;;
87# end-sanitize-v9
88esac
b9fe720d 89
a2ee3e6d
JW
90# Decode aliases for certain CPU-COMPANY combinations.
91case $basic_machine in
92 # Recognize the basic CPU types with without company name.
a5992d11 93 tahoe | i386 | i860 | m68k | m680[01234]0 | m88k | ns32k | arm | pyramid \
8bcd7db2
JW
94 | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 | we32k\
95 | v70)
a2ee3e6d
JW
96 basic_machine=$basic_machine-unknown
97 ;;
98 # Recognize the basic CPU types with with company name.
a5992d11 99 vax-* | tahoe-* | i386-* | i860-* | m68k-* | m680[01234]0-* | m88k-* \
a2ee3e6d
JW
100 | sparc-* | ns32k-* | alliant-* | arm-* | c[123]* \
101 | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
102 | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
8bcd7db2 103 | hppa1.0-* | hppa1.1-* | we32k-*)
a2ee3e6d
JW
104 ;;
105 # Recognize the various machine names and aliases which stand
106 # for a CPU type and a company and sometimes even an OS.
e6602723 107# start-sanitize-life
a2ee3e6d
JW
108 life-*) ;;
109 life)
110 basic_machine=life-philips
111 os=-none
112 ;;
e6602723
JG
113# end-sanitize-life
114
25fa8f53 115# start-sanitize-v9
a2ee3e6d
JW
116 sparc64-*) ;;
117 hal-32 | hal32)
118 basic_machine=sparc64-hal
119 os=-hal32
120 ;;
121 hal-64 | hal64)
122 basic_machine=sparc64-hal
123 os=-hal64
124 ;;
125 sparc64)
126 basic_machine=sparc64-sun
127 os=-v9
128 ;;
129 sparc64-v7 | sparc64v7)
130 basic_machine=sparc64-sun
131 os=-v7
132 ;;
25fa8f53 133# end-sanitize-v9
7054ee6d 134
a2ee3e6d
JW
135 vaxv)
136 basic_machine=vax-dec
137 os=-sysv
138 ;;
139 vms)
140 basic_machine=vax-dec
141 os=-vms
142 ;;
68cd7865
SEF
143 i386mach)
144 basic_machine=i386-mach
145 os=-mach
146 ;;
a2ee3e6d
JW
147 i386v32)
148 basic_machine=i386-unknown
149 os=-sysv32
150 ;;
151 i386-sco* | i386sco | sco)
152 basic_machine=i386-unknown
153 os=-scosysv322
154 ;;
2501643a
PB
155 go32 | i386-go32)
156 basic_machine=i386-unknown
157 os=-go32
158 ;;
a2ee3e6d
JW
159 i386-isc* | isc)
160 basic_machine=i386-unknown
161 os=-iscsysv
162 ;;
8bcd7db2
JW
163 i386-linux* | linux)
164 basic_machine=i386-unknown
165 os=-linux
166 ;;
a2ee3e6d
JW
167 i386v4*)
168 basic_machine=i386-unknown
169 os=-sysv4
170 ;;
171 i386v)
172 basic_machine=i386-unknown
173 os=-sysv
174 ;;
175 spur)
176 basic_machine=spur-unknown
177 ;;
178 alliant)
179 basic_machine=alliant-alliant
180 ;;
181 convex-c1)
182 basic_machine=c1-convex
183 os=-sysv
184 ;;
185 convex-c2)
186 basic_machine=c2-convex
187 os=-sysv
188 ;;
189 convex-c32)
190 basic_machine=c32-convex
191 os=-sysv
192 ;;
193 convex-c34)
194 basic_machine=c34-convex
195 os=-sysv
196 ;;
197 convex-c38)
198 basic_machine=c38-convex
199 os=-sysv
200 ;;
201 m88k-omron*)
202 basic_machine=m88k-omron
203 ;;
204 merlin)
205 basic_machine=ns32k-utek
206 os=-sysv
207 ;;
208 crds | unos)
209 basic_machine=m68k-crds
210 ;;
211 encore | umax | mmax)
212 basic_machine=ns32k-encore
213 os=-sysv
214 ;;
215 genix)
216 basic_machine=ns32k-ns
217 ;;
68cd7865
SEF
218 iris | iris3 | iris4d)
219 basic_machine=mips-sgi
220 os=-irix3
221 ;;
222 iris4)
a2ee3e6d 223 basic_machine=mips-sgi
68cd7865 224 os=-irix4
a2ee3e6d
JW
225 ;;
226 news | news700 | news800 | news900)
227 basic_machine=m68k-sony
228 os=-newsos
229 ;;
230 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
231 basic_machine=m68k-att
232 ;;
233 delta | 3300 | motorola-3300 | motorola-delta \
234 | 3300-motorola | delta-motorola)
235 basic_machine=m68k-motorola
236 ;;
237 balance)
238 basic_machine=ns32k-sequent
239 os=-dynix
240 ;;
241 pc532)
242 basic_machine=ns32k-pc532
243 ;;
244 symmetry)
245 basic_machine=i386-sequent
246 os=-dynix
247 ;;
248 sun2)
249 basic_machine=m68000-sun
250 ;;
251 sun2os3)
252 basic_machine=m68000-sun
253 os=-sunos3
254 ;;
255 sun2os4)
256 basic_machine=m68000-sun
257 os=-sunos4
258 ;;
259 sun3os3)
260 basic_machine=m68k-sun
261 os=-sunos3
262 ;;
263 sun3os4)
264 basic_machine=m68k-sun
265 os=-sunos4
266 ;;
267 sun4os3)
268 basic_machine=sparc-sun
269 os=-sunos3
270 ;;
271 sun4os4)
272 basic_machine=sparc-sun
273 os=-sunos4
274 ;;
8bcd7db2
JW
275 sun4sol2)
276 basic_machine=sparc-sun
277 os=-solaris2
278 ;;
a2ee3e6d
JW
279 sun3)
280 basic_machine=m68k-sun
281 ;;
282 sun4)
283 basic_machine=sparc-sun
284 ;;
285 pbd)
286 basic_machine=sparc-unicom
287 ;;
288 sun386 | sun386i | roadrunner)
289 basic_machine=i386-sun
290 ;;
291 ps2)
292 basic_machine=i386-ibm
293 ;;
294 next)
295 basic_machine=m68k-next
ad1f7512 296 os=-bsd
a2ee3e6d
JW
297 ;;
298 hp9k3[2-9][0-9])
299 basic_machine=m68k-hp
300 ;;
301 hp9k31[0-9] | hp9k2[0-9][0-9])
302 basic_machine=m68000-hp
303 ;;
8bcd7db2
JW
304 hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
305 basic_machine=hppa1.1-hp
306 ;;
307 hp9k8[0-9][0-9] | hp8[0-9][0-9])
308 basic_machine=hppa1.0-hp
a2ee3e6d
JW
309 ;;
310 isi68 | isi)
311 basic_machine=m68k-isi
312 os=-sysv
313 ;;
314 apollo68)
315 basic_machine=m68k-apollo
316 os=-sysv
317 ;;
68cd7865
SEF
318 apollo68bsd)
319 basic_machine=m68k-apollo
320 os=-bsd
321 ;;
a2ee3e6d
JW
322 altos | altos3068)
323 basic_machine=m68k-altos
324 ;;
325 miniframe)
326 basic_machine=m68000-convergent
327 ;;
328 tower | tower-32)
329 basic_machine=m68k-ncr
330 ;;
331 news-3600 | risc-news)
332 basic_machine=mips-sony
333 os=-newsos
334 ;;
68cd7865
SEF
335 st2000)
336 basic_machine=m68kmote-tandem
337 ;;
a2ee3e6d
JW
338 decstation-dec | decstation | decstation-3100 | pmax | pmin | dec3100 | decstatn)
339 basic_machine=mips-dec
340 ;;
341 magnum | m3230)
342 basic_machine=mips-mips
343 os=-sysv
344 ;;
345 gmicro)
346 basic_machine=tron-gmicro
347 os=-sysv
348 ;;
349 rtpc | rtpc-*)
350 basic_machine=romp-ibm
351 ;;
352 am29k)
353 basic_machine=a29k-none
354 os=-bsd
355 ;;
356 amdahl)
357 basic_machine=580-amdahl
358 os=-sysv
359 ;;
360 amigados)
361 basic_machine=m68k-cbm
362 os=-amigados
363 ;;
364 amigaunix | amix)
365 basic_machine=m68k-cbm
366 os=-sysv4
367 ;;
dd16baba
SEF
368 stratus)
369 basic_machine=i860-stratus
370 os=-sysv4
371 ;;
a2ee3e6d
JW
372 cray | ymp)
373 basic_machine=ymp-cray
374 os=-unicos
375 ;;
376 cray2)
377 basic_machine=cray2-cray
378 os=-unicos
379 ;;
380 xmp)
381 basic_machine=xmp-cray
382 os=-unicos
383 ;;
384 delta88)
385 basic_machine=m88k-motorola
386 os=-m88kbcs
387 ;;
388 dpx2)
389 basic_machine=m68k-bull
390 os=-sysv
391 ;;
392 ebmon29k)
393 basic_machine=a29k-amd
394 os=-ebmon
395 ;;
2501643a
PB
396
397 h8300hms)
a2ee3e6d 398 basic_machine=h8300-hitachi
2501643a
PB
399 os=-hms
400 ;;
401 udi29k)
402 basic_machine=a29k-amd
403 os=-udi
404 ;;
405 a29khif)
406 basic_machine=a29k-amd
407 os=-udi
408 ;;
409 sa29200)
410 basic_machine=a29k-amd
411 os=-udi
412 ;;
413 h8300xray)
414 basic_machine=h8300-hitachi
415 os=-xray
a2ee3e6d
JW
416 ;;
417 harris)
418 basic_machine=m88k-harris
419 os=-m88kbcs
420 ;;
421 hp300bsd)
422 basic_machine=m68k-hp
423 os=-bsd
424 ;;
425 hp300hpux)
426 basic_machine=m68k-hp
427 os=-hpux
428 ;;
429 hp9k2[0-9][0-9] | hp9k31[0-9])
430 basic_machine=m68000-hp
431 os=-hpux
432 ;;
433 hp9k3[2-9][0-9])
434 basic_machine=m68k-hp
435 os=-hpux
436 ;;
8bcd7db2
JW
437 hppabsd)
438 basic_machine=hppa-hp
439 os=-bsd
440 ;;
441 hppahpux)
442 basic_machine=hppa-hp
443 os=-hpux
444 ;;
a2ee3e6d
JW
445 ncr3000)
446 basic_machine=i386-ncr
447 os=-sysv4
448 ;;
68cd7865
SEF
449 necv70)
450 basic_machine=v70-nec
451 os=-sysv
452 ;;
a2ee3e6d
JW
453 news1000)
454 basic_machine=m68030-sony
455 os=-newsos
456 ;;
457 nindy960)
458 basic_machine=i960-intel
459 os=-nindy
460 ;;
461 pn)
462 basic_machine=pn-gould
463 os=-sysv
464 ;;
465 np1)
466 basic_machine=np1-gould
467 os=-sysv
468 ;;
469 ultra3)
470 basic_machine=a29k-nyu
c1e296fc 471 os=-sym1
a2ee3e6d
JW
472 ;;
473 vxworks960)
474 basic_machine=i960-wrs
475 os=-vxworks
476 ;;
477 vxworks68)
478 basic_machine=m68k-wrs
479 os=-vxworks
480 ;;
dd16baba
SEF
481 os68k)
482 basic_machine=m68k-none
483 os=-os68k
484 ;;
ad1f7512
MT
485 sparclite)
486 basic_machine=sparclite-fujitsu
487 os=-none
488 ;;
c73e3fe4
JW
489 sparcfrw)
490 basic_machine=sparcfrw-sun
491 os=-sunos4
492 ;;
493 sparcfrwcompat)
494 basic_machine=sparcfrwcompat-sun
495 os=-sunos4
496 ;;
497 sparclitefrw)
498 basic_machine=sparclitefrw-fujitsu
499 os=-none
500 ;;
501 sparclitefrwcompat)
502 basic_machine=sparclitefrwcompat-fujitsu
503 os=-none
504 ;;
ad1f7512 505
a2ee3e6d
JW
506 none)
507 basic_machine=none-none
508 os=-none
509 ;;
69e87de2 510
a2ee3e6d
JW
511# Here we handle the default manufacturer of certain CPU types. It is in
512# some cases the only manufacturer, in others, it is the most popular.
513 mips)
514 basic_machine=mips-mips
515 ;;
516 romp)
517 basic_machine=romp-ibm
518 ;;
519 rs6000)
520 basic_machine=rs6000-ibm
521 ;;
522 vax)
523 basic_machine=vax-dec
524 ;;
525 sparc)
526 basic_machine=sparc-sun
527 ;;
c1e296fc
SG
528 fx2800)
529 basic_machine=i860-alliant
530 ;;
a2ee3e6d
JW
531 *)
532 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
4f183929 533 exit 1
a2ee3e6d 534 ;;
4f183929
RP
535esac
536
a2ee3e6d 537# Decode manufacturer-specific aliases for certain operating systems.
e6602723 538
a2ee3e6d
JW
539if [ "$os" ]
540then
541case $os in
542 # First accept the basic system types.
543 # The portable systems comes first.
544 # Each alternative must end in a *, to match a version number.
ad1f7512 545 -bsd* | -sysv* | -mach* | -minix* | -genix* | -ultrix* | -aout \
a2ee3e6d 546 | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos* | -hpux* \
8bcd7db2 547 | -unos* | -osf* | -v88r* | -luna* | -dgux* | -solaris* | -sym* \
2501643a 548 | -newsos | -amigados* | -msdos* | -none* | -os68k* | -irix* \
8bcd7db2
JW
549 | -nindy* | -vxworks* | -ebmon* | -udi | -hms* | -xray \
550 | -m88kbcs* | -go32 | -linux*)
2501643a 551 ;;
25fa8f53 552# start-sanitize-v9
a2ee3e6d 553 -v7 | -v9 | -hal32 | -hal64) ;;
25fa8f53
RP
554# end-sanitize-v9
555
2501643a
PB
556# Note that readline checks for newsos
557# -newsos*)
558# os=-bsd
559# ;;
a2ee3e6d
JW
560 -osfrose*)
561 os=-osf
562 ;;
563 -osf*)
564 os=-bsd
565 ;;
566 -dynix*)
567 os=-bsd
568 ;;
569 -aos*)
570 os=-bsd
571 ;;
68cd7865 572 -ctix* | -uts*)
a2ee3e6d
JW
573 os=-sysv
574 ;;
c1e296fc
SG
575 -svr4)
576 os=-sysv4
577 ;;
578 -svr3)
579 os=-sysv3
580 ;;
a2ee3e6d
JW
581 *)
582 # Get rid of the `-' at the beginning of $os.
583 os=`echo $1 | sed 's/[^-]*-//'`
584 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
585 exit 1
586 ;;
69e87de2 587esac
a2ee3e6d 588else
69e87de2 589
a2ee3e6d
JW
590# Here we handle the default operating systems that come with various machines.
591# The value should be what the vendor currently ships out the door with their
592# machine or put another way, the most popular os provided with the machine.
593case $basic_machine in
594 *-dec | vax-*)
595 os=-ultrix42
596 ;;
597 i386-sun)
598 os=-sunos402
599 ;;
600 m68000-sun)
601 os=-sunos3
602 # This also exists in the configure program, but was not the
603 # default.
604 # os=-sunos4
605 ;;
606 sparc-* | *-sun)
607 os=-sunos411
608 ;;
609 romp-*)
610 os=-bsd
611 ;;
612 *-ibm)
613 os=-aix
614 ;;
615 *-hp)
616 os=-hpux
617 ;;
618 *-sgi | i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
619 os=-sysv
620 ;;
621 *-dg)
622 os=-dgux
623 ;;
624 m88k-omron*)
625 os=-luna
626 ;;
627 *-crds)
628 os=-unos
629 ;;
630 *-ns)
631 os=-genix
632 ;;
633 i386-*)
634 os=-scosysv322
635 ;;
636 *)
637 os=-none
638 ;;
69e87de2 639esac
a2ee3e6d 640fi
69e87de2 641
a2ee3e6d
JW
642# Here we handle the case where we know the os, and the CPU type, but not the
643# manufacturer. We pick the logical manufacturer.
644vendor=unknown
645case $basic_machine in
646 *-unknown)
647 case $os in
648 -sunos*)
649 vendor=sun
650 ;;
651 -aix*)
652 vendor=ibm
653 ;;
654 -hpux*)
655 vendor=hp
656 ;;
657 -unos*)
658 vendor=crds
659 ;;
660 -dgux*)
661 vendor=dg
662 ;;
663 -luna*)
664 vendor=omron
665 ;;
666 -genix*)
667 vendor=ns
668 ;;
669 esac
670 basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
671 ;;
4f183929
RP
672esac
673
a2ee3e6d 674echo $basic_machine$os
This page took 0.079011 seconds and 4 git commands to generate.