config.sub & config.subr merge
[deliverable/binutils-gdb.git] / config.subr
1 #!/bin/sh
2 # Configuration validation subroutine script, version 1.0.
3 # Copyright (C) 1991 Free Software Foundation, Inc.
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
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
31 # configuration.
32
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
37
38 # First pass through any local machine types.
39 case $1 in
40 *local*)
41 echo $1
42 exit 0
43 ;;
44 *)
45 ;;
46 esac
47
48 # Separate what the user gave into CPU-COMPANY and OS (if any).
49 basic_machine=`echo $1 | sed 's/-[^-]*$//'`
50 if [ $basic_machine != $1 ]
51 then os=`echo $1 | sed 's/.*-/-/'`
52 else os=; fi
53
54 # Lets recognize common machines as not being OS so that things like
55 # config.subr decstation-3100 as legal.
56 case $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* | -c1* | \
61 -c2* | -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-hal
85 os=-v7
86 ;;
87 # end-sanitize-v9
88 esac
89
90 # Decode aliases for certain CPU-COMPANY combinations.
91 case $basic_machine in
92 # Recognize the basic CPU types with without company name.
93 tahoe | i386 | i860 | m68k | m68000 | m88k | ns32k | arm | pyramid \
94 | tron | a29k | 580 | i960 | h8300)
95 basic_machine=$basic_machine-unknown
96 ;;
97 # Recognize the basic CPU types with with company name.
98 vax-* | tahoe-* | i386-* | i860-* | m68k-* | m68000-* | m88k-* \
99 | sparc-* | ns32k-* | alliant-* | arm-* | c1-* | c2-* \
100 | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
101 | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-*)
102 ;;
103 # Recognize the various machine names and aliases which stand
104 # for a CPU type and a company and sometimes even an OS.
105 # start-sanitize-life
106 life-*) ;;
107 life)
108 basic_machine=life-philips
109 os=-none
110 ;;
111 # end-sanitize-life
112
113 # start-sanitize-v9
114 sparc64-*) ;;
115 hal-32 | hal32)
116 basic_machine=sparc64-hal
117 os=-hal32
118 ;;
119 hal-64 | hal64)
120 basic_machine=sparc64-hal
121 os=-hal64
122 ;;
123 sparc64)
124 basic_machine=sparc64-sun
125 os=-v9
126 ;;
127 sparc64-v7 | sparc64v7)
128 basic_machine=sparc64-sun
129 os=-v7
130 ;;
131 # end-sanitize-v9
132
133 vaxv)
134 basic_machine=vax-dec
135 os=-sysv
136 ;;
137 vms)
138 basic_machine=vax-dec
139 os=-vms
140 ;;
141 i386v32)
142 basic_machine=i386-unknown
143 os=-sysv32
144 ;;
145 i386-sco* | i386sco | sco)
146 basic_machine=i386-unknown
147 os=-scosysv322
148 ;;
149 i386-isc* | isc)
150 basic_machine=i386-unknown
151 os=-iscsysv
152 ;;
153 i386v4*)
154 basic_machine=i386-unknown
155 os=-sysv4
156 ;;
157 i386v)
158 basic_machine=i386-unknown
159 os=-sysv
160 ;;
161 spur)
162 basic_machine=spur-unknown
163 ;;
164 alliant)
165 basic_machine=alliant-alliant
166 ;;
167 c1 | convex-c1)
168 basic_machine=c1-convex
169 os=-sysv
170 ;;
171 c2 | convex-c2)
172 basic_machine=c2-convex
173 os=-sysv
174 ;;
175 m88k-omron*)
176 basic_machine=m88k-omron
177 ;;
178 merlin)
179 basic_machine=ns32k-utek
180 os=-sysv
181 ;;
182 crds | unos)
183 basic_machine=m68k-crds
184 ;;
185 encore | umax | mmax)
186 basic_machine=ns32k-encore
187 os=-sysv
188 ;;
189 genix)
190 basic_machine=ns32k-ns
191 ;;
192 iris | iris4d)
193 basic_machine=mips-sgi
194 os=-irix
195 ;;
196 news | news700 | news800 | news900)
197 basic_machine=m68k-sony
198 os=-newsos
199 ;;
200 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
201 basic_machine=m68k-att
202 ;;
203 delta | 3300 | motorola-3300 | motorola-delta \
204 | 3300-motorola | delta-motorola)
205 basic_machine=m68k-motorola
206 ;;
207 balance)
208 basic_machine=ns32k-sequent
209 os=-dynix
210 ;;
211 pc532)
212 basic_machine=ns32k-pc532
213 ;;
214 symmetry)
215 basic_machine=i386-sequent
216 os=-dynix
217 ;;
218 sun2)
219 basic_machine=m68000-sun
220 ;;
221 sun2os3)
222 basic_machine=m68000-sun
223 os=-sunos3
224 ;;
225 sun2os4)
226 basic_machine=m68000-sun
227 os=-sunos4
228 ;;
229 sun3os3)
230 basic_machine=m68k-sun
231 os=-sunos3
232 ;;
233 sun3os4)
234 basic_machine=m68k-sun
235 os=-sunos4
236 ;;
237 sun4os3)
238 basic_machine=sparc-sun
239 os=-sunos3
240 ;;
241 sun4os4)
242 basic_machine=sparc-sun
243 os=-sunos4
244 ;;
245 sun3)
246 basic_machine=m68k-sun
247 ;;
248 sun4)
249 basic_machine=sparc-sun
250 ;;
251 pbd)
252 basic_machine=sparc-unicom
253 ;;
254 sun386 | sun386i | roadrunner)
255 basic_machine=i386-sun
256 ;;
257 ps2)
258 basic_machine=i386-ibm
259 ;;
260 next)
261 basic_machine=m68k-next
262 os=-sysv
263 ;;
264 hp9k3[2-9][0-9])
265 basic_machine=m68k-hp
266 ;;
267 hp9k31[0-9] | hp9k2[0-9][0-9])
268 basic_machine=m68000-hp
269 ;;
270 isi68 | isi)
271 basic_machine=m68k-isi
272 os=-sysv
273 ;;
274 apollo68)
275 basic_machine=m68k-apollo
276 os=-sysv
277 ;;
278 altos | altos3068)
279 basic_machine=m68k-altos
280 ;;
281 miniframe)
282 basic_machine=m68000-convergent
283 ;;
284 tower | tower-32)
285 basic_machine=m68k-ncr
286 ;;
287 news-3600 | risc-news)
288 basic_machine=mips-sony
289 os=-newsos
290 ;;
291 decstation-dec | decstation | decstation-3100 | pmax | pmin | dec3100 | decstatn)
292 basic_machine=mips-dec
293 ;;
294 magnum | m3230)
295 basic_machine=mips-mips
296 os=-sysv
297 ;;
298 gmicro)
299 basic_machine=tron-gmicro
300 os=-sysv
301 ;;
302 rtpc | rtpc-*)
303 basic_machine=romp-ibm
304 ;;
305 am29k)
306 basic_machine=a29k-none
307 os=-bsd
308 ;;
309 amdahl)
310 basic_machine=580-amdahl
311 os=-uts
312 ;;
313 amigados)
314 basic_machine=m68k-cbm
315 os=-amigados
316 ;;
317 amigaunix | amix)
318 basic_machine=m68k-cbm
319 os=-svr4
320 ;;
321 cray | ymp)
322 basic_machine=ymp-cray
323 os=-unicos
324 ;;
325 cray2)
326 basic_machine=cray2-cray
327 os=-unicos
328 ;;
329 xmp)
330 basic_machine=xmp-cray
331 os=-unicos
332 ;;
333 delta88)
334 basic_machine=m88k-motorola
335 os=-m88kbcs
336 ;;
337 dpx2)
338 basic_machine=m68k-bull
339 os=-sysv
340 ;;
341 ebmon29k)
342 basic_machine=a29k-amd
343 os=-ebmon
344 ;;
345 h8300hds)
346 basic_machine=h8300-hitachi
347 os=-hds
348 ;;
349 harris)
350 basic_machine=m88k-harris
351 os=-m88kbcs
352 ;;
353 hp300bsd)
354 basic_machine=m68k-hp
355 os=-bsd
356 ;;
357 hp300hpux)
358 basic_machine=m68k-hp
359 os=-hpux
360 ;;
361 hp9k2[0-9][0-9] | hp9k31[0-9])
362 basic_machine=m68000-hp
363 os=-hpux
364 ;;
365 hp9k3[2-9][0-9])
366 basic_machine=m68k-hp
367 os=-hpux
368 ;;
369 hpux)
370 basic_machine=m68k-hp
371 os=-hpux
372 ;;
373 ncr3000)
374 basic_machine=i386-ncr
375 os=-svr4
376 ;;
377 news1000)
378 basic_machine=m68030-sony
379 os=-newsos
380 ;;
381 nindy960)
382 basic_machine=i960-intel
383 os=-nindy
384 ;;
385 pn)
386 basic_machine=pn-gould
387 os=-sysv
388 ;;
389 np1)
390 basic_machine=np1-gould
391 os=-sysv
392 ;;
393 ultra3)
394 basic_machine=a29k-nyu
395 os=-sym1
396 ;;
397 vxworks960)
398 basic_machine=i960-wrs
399 os=-vxworks
400 ;;
401 vxworks68)
402 basic_machine=m68k-wrs
403 os=-vxworks
404 ;;
405 none)
406 basic_machine=none-none
407 os=-none
408 ;;
409
410 # Here we handle the default manufacturer of certain CPU types. It is in
411 # some cases the only manufacturer, in others, it is the most popular.
412 mips)
413 basic_machine=mips-mips
414 ;;
415 romp)
416 basic_machine=romp-ibm
417 ;;
418 rs6000)
419 basic_machine=rs6000-ibm
420 ;;
421 vax)
422 basic_machine=vax-dec
423 ;;
424 sparc)
425 basic_machine=sparc-sun
426 ;;
427 *)
428 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
429 exit 1
430 ;;
431 esac
432
433 # Decode manufacturer-specific aliases for certain operating systems.
434
435 if [ "$os" ]
436 then
437 case $os in
438 # First accept the basic system types.
439 # The portable systems comes first.
440 # Each alternative must end in a *, to match a version number.
441 -bsd* | -sysv* | -mach* | -minix* | -genix* | -ultrix* \
442 | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos* | -hpux* \
443 | -unos* | -osf* | -v88r* | -luna* | -dgux* | -amigados* \
444 | -msdos* | -aout* | -bout* | -elf* | -coff* | -ebmon* | -hds* \
445 | -irix* | -kern* | -m88kbcs | -nindy* | -none | -svr4 \
446 | -unicos* | -uts* | -vxworks* | -sym[1-9]* | -solari* \
447 | -dynix* | -aos* | -ctix* | -newsos* | -osf*)
448 ;;
449 # start-sanitize-v9
450 -v7 | -v9 | -hal32 | -hal64) ;;
451 # end-sanitize-v9
452
453 *)
454 # Get rid of the `-' at the beginning of $os.
455 os=`echo $1 | sed 's/[^-]*-//'`
456 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
457 exit 1
458 ;;
459 esac
460 else
461
462 # Here we handle the default operating systems that come with various machines.
463 # The value should be what the vendor currently ships out the door with their
464 # machine or put another way, the most popular os provided with the machine.
465 case $basic_machine in
466 *-dec | vax-*)
467 os=-ultrix42
468 ;;
469 i386-sun)
470 os=-sunos402
471 ;;
472 m68000-sun)
473 os=-sunos3
474 # This also exists in the configure program, but was not the
475 # default.
476 # os=-sunos4
477 ;;
478 sparc-* | *-sun)
479 os=-sunos411
480 ;;
481 romp-*)
482 os=-bsd
483 ;;
484 *-ibm)
485 os=-aix
486 ;;
487 *-hp)
488 os=-hpux
489 ;;
490 *-sgi | i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
491 os=-sysv
492 ;;
493 *-dg)
494 os=-dgux
495 ;;
496 m88k-omron*)
497 os=-luna
498 ;;
499 *-crds)
500 os=-unos
501 ;;
502 *-ns)
503 os=-genix
504 ;;
505 i386-*)
506 os=-scosysv322
507 ;;
508 *)
509 os=-none
510 ;;
511 esac
512 fi
513
514 # Here we handle the case where we know the os, and the CPU type, but not the
515 # manufacturer. We pick the logical manufacturer.
516 vendor=unknown
517 case $basic_machine in
518 *-unknown)
519 case $os in
520 -sunos*)
521 vendor=sun
522 ;;
523 -aix*)
524 vendor=ibm
525 ;;
526 -hpux*)
527 vendor=hp
528 ;;
529 -unos*)
530 vendor=crds
531 ;;
532 -dgux*)
533 vendor=dg
534 ;;
535 -luna*)
536 vendor=omron
537 ;;
538 -genix*)
539 vendor=ns
540 ;;
541 esac
542 basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
543 ;;
544 esac
545
546 echo $basic_machine$os
This page took 0.046953 seconds and 4 git commands to generate.