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