Initial revision
[external/binutils.git] / config.sub
1 #!/bin/sh
2
3 # Configuration subroutine to validate and canonicalize a configuration type.
4 # Supply the specified configuration type as an argument.
5 # If it is invalid, we print an error message on stderr and exit with code 1.
6 # Otherwise, we print the canonical config type on stdout and succeed.
7
8 # This file is supposed to be the same for all GNU packages
9 # and recognize all the CPU types, system types and aliases
10 # that are meaningful with *any* GNU software.
11 # Each package is responsible for reporting which valid configurations
12 # it does not support.  The user should be able to distinguish
13 # a failure to support a valid configuration from a meaningless
14 # configuration.
15
16 # Separate what the user gave into CPU-company and OS (if any).
17 basic_machine=`echo $1 | sed 's/-[^-]*$//'`
18 if [ $basic_machine != $1 ]
19 then os=`echo $1 | sed 's/^.*-/-/'`
20 else os=; fi
21
22 # Decode aliases for certain machine-company combinations.
23 case $basic_machine in
24         # Recognize the basic CPU types without company name.
25         vax | tahoe | i386 | i860 | m68k | m68000 | m88k | sparc | ns32k \
26             | alliant | arm | c1 | c2 | mips | pyramid | tron | a29k \
27             | rtpc | rs6000 | i960 | none)
28                 ;;
29         # Recognize the basic CPU types with company name.
30         vax-* | tahoe-* | i386-* | i860-* | m68k-* | m68000-* | m88k-* \
31                 | sparc-* | ns32k-* | alliant-* | arm-* | c1-* | c2-* \
32                 | mips-* | pyramid-* | tron-* | a29k-* | rtpc-* \
33                 | rs6000-* | i960-*)
34                 ;;
35         # Recognize the machine names
36         # which stand for a CPU time and a company.
37         nindy960)
38                 basic_machine=i960-intel
39                 os=-nindy
40                 ;;
41         vxworks68)
42                 basic_machine=m68k-wrs
43                 os=-vxworks
44                 ;;
45         vxworks960)
46                 basic_machine=i960-wrs
47                 os=-vxworks
48                 ;;
49         am29k)
50                 basic_machine=a29k-unknown
51                 os=-bsd
52                 ;;
53         umax)
54                 basic_machine=ns32k-umax
55                 os=-sysv # maybe?
56                 ;;
57         pn)
58                 basic_machine=pn-gould
59                 os=-sysv # maybe?
60                 ;;
61         np1)
62                 basic_machine=np1-gould
63                 os=-sysv # maybe?
64                 ;;
65         merlin)
66                 basic_machine=merlin-utek
67                 os=-sysv # maybe?
68                 ;;
69         iris | iris4d)
70                 basic_machine=mips-sgi
71                 os=-sysv # maybe?
72                 ;;
73         news1000)
74                 basic_machine=m68030-sony
75                 os=-sysv # maybe?
76                 ;;
77         news | news700 | news800 | news900)
78                 basic_machine=m68k-sony
79                 os=-sysv # maybe?
80                 ;;
81         unixpc | safari | pc7300 | 3b1 | 7300 | 7300-att | att-7300)
82                 basic_machine=m68k-att
83                 os=-sysv # maybe?
84                 ;;
85         delta | 3300 | motorola-3300 | motorola-delta \
86               | 3300-motorola | delta-motorola)
87                 basic_machine=m68k-motorola
88                 os=-sysv # maybe?
89                 ;;
90         vax-dec)
91                 basic_machine=vax
92                 os=-ultrix # maybe?
93                 ;;
94         balance)
95                 basic_machine=ns32k-sequent
96                 os=-dynix
97                 ;;
98         mmax)
99                 basic_machine=ns32k-encore
100                 os=-sysv # maybe?
101                 ;;
102         symmetry)
103                 basic_machine=i386-sequent
104                 os=-dynix
105                 ;;
106         sun2)
107                 basic_machine=m68000-sun
108                 os=-sunos4
109                 ;;
110         sun2os3)
111                 basic_machine=m68000-sun
112                 os=-sunos3
113                 ;;
114         sun2os4)
115                 basic_machine=m68000-sun
116                 os=-sunos4
117                 ;;
118         sun3)
119                 basic_machine=m68k-sun
120                 os=-sunos4
121                 ;;
122         sun3os3)
123                 basic_machine=m68k-sun
124                 os=-sunos3
125                 ;;
126         sun3os4)
127                 basic_machine=m68k-sun
128                 os=-sunos4
129                 ;;
130         sun4)
131                 basic_machine=sparc-sun
132                 os=-sunos4
133                 ;;
134         sun4os3)
135                 basic_machine=sparc-sun
136                 os=-sunos3
137                 ;;
138         sun4os4)
139                 basic_machine=sparc-sun
140                 os=-sunos4
141                 ;;
142         pbd)
143                 basic_machine=sparc-unicom
144                 os=-sysv
145                 ;;
146         roadrunner | sun386 | sun386i)
147                 basic_machine=i386-sun
148                 os=-sunos
149                 ;;
150         ps2)
151                 basic_machine=i386-ibm
152                 os=-sysv # maybe?
153                 ;;
154         i386sco)
155                 basic_machine=i386-sco
156                 os=-sysv # maybe?
157                 ;;
158         i386v)
159                 basic_machine=i386-unknown
160                 os=-sysv
161                 ;;
162         i386v32)
163                 basic_machine=i386-unknown
164                 os=-sysv32
165                 ;;
166         next)
167                 basic_machine=m68k-next
168                 os=-sysv # maybe?
169                 ;;
170         hp300bsd)
171                 basic_machine=m68k-hp
172                 os=-bsd
173                 ;;
174         hp300hpux | hpux | hp9k3[2-9][0-9])
175                 basic_machine=m68k-hp
176                 os=-hpux
177                 ;;
178         hp9k31[0-9] | hp9k2[0-9][0-9])
179                 basic_machine=m68000-hp
180                 os=-hpux
181                 ;;
182         isi | isi68)
183                 basic_machine=m68k-isi
184                 os=-sysv # maybe?
185                 ;;
186         apollo68)
187                 basic_machine=m68k-apollo
188                 os=-sysv # maybe?
189                 ;;
190         altos | altos3068)
191                 basic_machine=m68k-altos
192                 os=-sysv # maybe?
193                 ;;
194         altosgas)
195                 basic_machine=m68k-altos
196                 os=-gas
197                 ;;
198         miniframe)
199                 basic_machine=m68000-convergent
200                 os=-sysv # maybe?
201                 ;;
202         tower | tower-32)
203                 basic_machine=m68k-ncr
204                 os=-sysv # maybe?
205                 ;;
206         bigmips | news-3600 | risc-news)
207                 basic_machine=mips-sony
208                 os=-newsos # maybe?
209                 ;;
210         littlemips)
211                 basic_machine=mips-little
212                 os=-bsd
213                 ;;
214         dec3100 | decstatn | decstation | decstation-3100 | pmax)
215                 basic_machine=mips-dec
216                 os=-ultrix
217                 ;;
218         magnum | m3230)
219                 basic_machine=mips-mips
220                 os=-sysv # maybe?
221                 ;;
222         gmicro)
223                 basic_machine=tron
224                 os=-sysv # maybe?
225                 ;;
226         convex-c1)
227                 basic_machine=c1-convex
228                 os=-sysv # maybe?
229                 ;;
230         convex-c2)
231                 basic_machine=c2-convex
232                 os=-sysv # maybe?
233                 ;;
234         *)
235                 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
236                 exit 1
237                 ;;
238 esac
239
240 # Decode manufacturer-specific aliases for certain operating systems.
241
242 case $os in
243         # First accept the basic system types.
244         # The portable systems comes first.
245         -bsd* | -sysv* | -mach* \
246                 | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos* | -hpux* \
247                 | -unos* | -osf* | -v88r* | -aout | -coff | -bout \
248                 | -nindy | -vxworks)
249                 ;;
250         -newsos*)
251                 os=-bsd
252                 ;;
253         -ultrix*)
254                 os=-bsd
255                 ;;
256         -osfrose*)
257                 os=-osf
258                 ;;
259         -osf*)
260                 os=-bsd
261                 ;;
262         -dynix*)
263                 os=-bsd
264                 ;;
265         -ctix*)
266                 os=-sysv
267                 ;;
268         *)
269                 # Get rid of the `-' at the beginning of $os.
270                 os=`echo $1 | sed 's/[^-]*-//'`
271                 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
272                 exit 1
273                 ;;
274 esac
275
276 echo ${basic_machine}${os}