Commit | Line | Data |
---|---|---|
b11fb939 KR |
1 | dnl Process this file with autoconf to produce a configure script. |
2 | dnl | |
3 | dnl And be careful when changing it! If you must add tests with square | |
4 | dnl brackets, be sure changequote invocations surround it. | |
5 | dnl | |
b11fb939 | 6 | dnl |
e2b4bd2a ILT |
7 | dnl v2.5 needed for --bindir et al |
8 | AC_PREREQ(2.5) | |
9 | AC_INIT(as.h) | |
10 | ||
11 | AC_CANONICAL_SYSTEM | |
12 | ||
13 | AM_INIT_AUTOMAKE(gas, 2.8.2) | |
14 | ||
15 | AM_PROG_LIBTOOL | |
16 | ||
318b02b6 | 17 | user_bfd_gas= |
b11fb939 | 18 | AC_ARG_ENABLE(bfd-assembler, |
d7b2038f | 19 | [ --enable-bfd-assembler use BFD back end for writing object files], |
b11fb939 | 20 | [case "${enableval}" in |
318b02b6 KR |
21 | yes) need_bfd=yes user_bfd_gas=yes ;; |
22 | no) user_bfd_gas=no ;; | |
b11fb939 KR |
23 | *) AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;; |
24 | esac])dnl | |
e7757ad0 KR |
25 | AC_ARG_ENABLE(targets, |
26 | [ targets alternative target configurations besides the primary], | |
27 | [case "${enableval}" in | |
28 | yes | "") AC_ERROR(enable-targets option must specify target names or 'all') | |
29 | ;; | |
30 | no) enable_targets= ;; | |
31 | *) enable_targets=$enableval ;; | |
32 | esac])dnl | |
2e013bb7 ILT |
33 | AC_ARG_ENABLE(commonbfdlib, |
34 | [ --enable-commonbfdlib build shared BFD/opcodes/libiberty library], | |
35 | [case "${enableval}" in | |
36 | yes) commonbfdlib=true ;; | |
37 | no) commonbfdlib=false ;; | |
38 | *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;; | |
39 | esac])dnl | |
b11fb939 | 40 | |
e2b4bd2a ILT |
41 | # Generate a header file |
42 | AM_CONFIG_HEADER(config.h:config.in) | |
7cf4d7ff | 43 | |
e7757ad0 | 44 | te_file=generic |
b678740d | 45 | |
e7757ad0 KR |
46 | canon_targets="" |
47 | if test -n "$enable_targets" ; then | |
48 | for t in `echo $enable_targets | sed 's/,/ /g'`; do | |
ec2f730d | 49 | result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $t 2>/dev/null` |
e7757ad0 KR |
50 | if test -n "$result" ; then |
51 | canon_targets="$canon_targets $result" | |
52 | # else | |
53 | # # Permit "all", etc. We don't support it yet though. | |
54 | # canon_targets="$canon_targets $t" | |
55 | fi | |
56 | done | |
57 | GAS_UNIQ(canon_targets) | |
58 | fi | |
59 | ||
60 | emulations="" | |
61 | ||
62 | for this_target in $target $canon_targets ; do | |
63 | ||
64556643 FF |
64 | changequote(,)dnl |
65 | eval `echo $this_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'` | |
66 | changequote([,])dnl | |
8cac6ca6 | 67 | |
e7757ad0 KR |
68 | # check for architecture variants |
69 | case ${cpu} in | |
ae09d880 ILT |
70 | armeb) cpu_type=arm endian=big ;; |
71 | arm*) cpu_type=arm endian=little ;; | |
76fb6d2f | 72 | thumb*) cpu_type=arm endian=little ;; |
e7757ad0 KR |
73 | hppa*) cpu_type=hppa ;; |
74 | changequote(,)dnl | |
7c2fadd1 | 75 | i[456]86) cpu_type=i386 ;; |
e7757ad0 KR |
76 | m680[012346]0) cpu_type=m68k ;; |
77 | m68008) cpu_type=m68k ;; | |
78 | m683??) cpu_type=m68k ;; | |
79 | changequote([,])dnl | |
80 | m8*) cpu_type=m88k ;; | |
e16b9537 | 81 | mips*el) cpu_type=mips endian=little ;; |
9587640a | 82 | mips*5900*) cpu_type=mips endian=little ;; |
e7757ad0 KR |
83 | mips*) cpu_type=mips endian=big ;; |
84 | powerpcle*) cpu_type=ppc endian=little ;; | |
85 | powerpc*) cpu_type=ppc endian=big ;; | |
86 | rs6000*) cpu_type=ppc ;; | |
6df07e7f | 87 | sparc64) cpu_type=sparc want_sparc_v9=true ;; |
63e4edb5 | 88 | sparc*) cpu_type=sparc ;; |
a1c7c0f3 | 89 | *) cpu_type=${cpu} ;; |
e7757ad0 KR |
90 | esac |
91 | ||
92 | if test ${this_target} = $target ; then | |
93 | target_cpu_type=${cpu_type} | |
94 | elif test ${target_cpu_type} != ${cpu_type} ; then | |
95 | continue | |
96 | fi | |
97 | ||
98 | targ=${cpu_type} | |
99 | generic_target=${cpu_type}-$vendor-$os | |
100 | dev=no | |
101 | bfd_gas=no | |
102 | em=generic | |
7cf4d7ff | 103 | |
e7757ad0 KR |
104 | # assign object format |
105 | case ${generic_target} in | |
805e36ab | 106 | a29k-*-coff) fmt=coff targ=ebmon29k ;; |
e7757ad0 KR |
107 | a29k-amd-udi) fmt=coff targ=ebmon29k ;; |
108 | a29k-amd-ebmon) fmt=coff targ=ebmon29k ;; | |
880b7429 | 109 | a29k-nyu-sym1) fmt=coff targ=ebmon29k ;; |
e7757ad0 KR |
110 | a29k-*-vxworks*) fmt=coff ;; |
111 | ||
c6aa56bc | 112 | alpha-*-*vms*) fmt=evax ;; |
e7757ad0 | 113 | alpha-*-netware*) fmt=ecoff ;; |
894cca25 | 114 | alpha-*-openbsd*) fmt=ecoff ;; |
e7757ad0 | 115 | alpha-*-osf*) fmt=ecoff ;; |
df586de2 ILT |
116 | alpha-*-linuxecoff*) fmt=ecoff ;; |
117 | alpha-*-linux*) fmt=elf em=linux ;; | |
816153a3 | 118 | |
4181c985 | 119 | # start-sanitize-arc |
e7757ad0 | 120 | arc-*-elf*) fmt=elf bfd_gas=yes ;; |
4181c985 KR |
121 | # end-sanitize-arc |
122 | ||
7be9a312 | 123 | arm-*-riscix*) fmt=aout targ=arm-lit em=riscix ;; |
1cb0d00d KR |
124 | arm-*-aout) fmt=aout |
125 | case "$endian" in | |
126 | big) targ=arm-big ;; | |
127 | *) targ=arm-lit ;; | |
128 | esac | |
129 | ;; | |
76fb6d2f | 130 | arm-*-coff | thumb-*-coff) fmt=coff ;; |
e7757ad0 | 131 | arm-*-riscix*) fmt=aout ;; |
1cb0d00d | 132 | arm-*-pe) fmt=coff targ=armcoff em=pe ;; |
e7757ad0 | 133 | |
05a8bf33 | 134 | d10v-*-*) fmt=elf bfd_gas=yes ;; |
7d0f8249 MH |
135 | # start-sanitize-d30v |
136 | d30v-*-*) fmt=elf bfd_gas=yes ;; | |
137 | # end-sanitize-d30v | |
7be9a312 | 138 | |
e7757ad0 KR |
139 | hppa-*-*elf*) fmt=elf em=hppa ;; |
140 | hppa-*-lites*) fmt=elf em=hppa ;; | |
141 | hppa-*-osf*) fmt=som em=hppa ;; | |
332d5c49 | 142 | hppa-*-rtems*) fmt=elf em=hppa ;; |
e7757ad0 KR |
143 | hppa-*-hpux*) fmt=som em=hppa ;; |
144 | hppa-*-bsd*) fmt=som em=hppa ;; | |
145 | hppa-*-hiux*) fmt=som em=hppa ;; | |
146 | ||
147 | h8300-*-coff) fmt=coff ;; | |
148 | ||
149 | i386-ibm-aix*) fmt=coff targ=i386coff | |
150 | em=i386aix ;; | |
7d0f8249 | 151 | i386-sequent-bsd*) fmt=aout em=dynix bfd_gas=yes ;; |
e7757ad0 KR |
152 | i386-*-bsd*) fmt=aout em=386bsd ;; |
153 | i386-*-netbsd0.8) fmt=aout em=386bsd ;; | |
154 | i386-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes;; | |
76fb6d2f | 155 | i386-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes;; |
a1c7c0f3 | 156 | i386-*-linux*aout* | i386-*-linuxoldld) fmt=aout em=linux ;; |
e7757ad0 KR |
157 | i386-*-linux*coff*) fmt=coff em=linux |
158 | targ=i386coff ;; | |
159 | i386-*-linux*) fmt=elf em=linux ;; | |
160 | i386-*-lynxos*) fmt=coff targ=i386coff | |
161 | em=lynx ;; | |
2ae5f50b | 162 | i386-*-sysv4* | i386-*-solaris* | i386-*-elf | i386-*-freebsdelf*) |
e7757ad0 | 163 | fmt=elf ;; |
66b935da | 164 | i386-*-sco*elf*) fmt=elf targ=sco5 ;; |
e7757ad0 KR |
165 | i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*) |
166 | fmt=coff targ=i386coff ;; | |
167 | i386-*-vsta) fmt=aout ;; | |
ea1c39ce ILT |
168 | i386-*-msdosdjgpp* | i386-*-go32*) |
169 | fmt=coff targ=coffgo32 em=go32;; | |
1c94de4d | 170 | i386-*-rtems*) fmt=coff targ=i386coff ;; |
6c186c48 SC |
171 | i386-*-gnu*) fmt=elf ;; |
172 | i386-*-mach*) | |
e7757ad0 KR |
173 | fmt=aout em=mach bfd_gas=yes ;; |
174 | i386-*-msdos*) fmt=aout ;; | |
6c186c48 | 175 | i386-*-moss*) fmt=elf ;; |
d0352cbb | 176 | i386-*-pe) fmt=coff targ=i386coff em=pe ;; |
76fb6d2f | 177 | i386-*-cygwin32) fmt=coff targ=i386coff em=pe bfd_gas=yes ;; |
d0352cbb | 178 | i386-*-*nt) fmt=coff targ=i386coff em=pe ;; |
e7757ad0 KR |
179 | i960-*-bout) fmt=bout ;; |
180 | i960-*-coff) fmt=coff em=ic960 targ=ic960coff ;; | |
1c94de4d | 181 | i960-*-rtems*) fmt=coff em=ic960 targ=ic960coff ;; |
e7757ad0 KR |
182 | i960-*-nindy*) fmt=bout ;; |
183 | i960-*-vxworks4*) fmt=bout ;; | |
184 | i960-*-vxworks5.0) fmt=bout ;; | |
185 | i960-*-vxworks5.*) fmt=coff em=ic960 targ=ic960coff ;; | |
186 | i960-*-vxworks*) fmt=bout ;; | |
187 | ||
374bdac7 DE |
188 | m32r-*-*) fmt=elf bfd_gas=yes ;; |
189 | ||
e7757ad0 KR |
190 | m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*) |
191 | fmt=aout em=sun3 ;; | |
880b7429 | 192 | m68k-motorola-sysv*) fmt=coff targ=m68kcoff em=delta ;; |
e7757ad0 KR |
193 | m68k-bull-sysv3*) fmt=coff targ=m68kcoff em=dpx2 ;; |
194 | m68k-apollo-*) fmt=coff targ=apollo em=apollo ;; | |
fee3e248 ILT |
195 | m68k-*-sysv4*) # must be before -sysv* |
196 | fmt=elf em=svr4 ;; | |
197 | m68k-*-elf*) fmt=elf ;; | |
1c94de4d | 198 | m68k-*-coff | m68k-*-sysv* | m68k-*-rtems*) |
e7757ad0 | 199 | fmt=coff targ=m68kcoff ;; |
e7757ad0 | 200 | m68k-*-hpux*) fmt=hp300 em=hp300 ;; |
535cfd0f ILT |
201 | m68k-*-linux*aout*) fmt=aout em=linux ;; |
202 | m68k-*-linux*) fmt=elf em=linux ;; | |
e7757ad0 KR |
203 | m68k-*-lynxos*) fmt=coff targ=m68kcoff |
204 | em=lynx ;; | |
205 | m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; | |
76fb6d2f | 206 | m68k-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;; |
8a6f53e9 ILT |
207 | m68k-apple-aux*) fmt=coff targ=m68kcoff em=aux ;; |
208 | m68k-*-psos*) fmt=elf em=psos;; | |
e7757ad0 | 209 | |
880b7429 | 210 | m88k-motorola-sysv3*) fmt=coff targ=m88kcoff em=delt88 ;; |
e7757ad0 KR |
211 | m88k-*-coff*) fmt=coff targ=m88kcoff ;; |
212 | ||
213 | # don't change em like *-*-bsd does | |
057a4d41 | 214 | mips-dec-netbsd*) fmt=elf targ=mips-lit endian=little ;; |
76fb6d2f | 215 | mips-dec-openbsd*) fmt=elf targ=mips-lit endian=little ;; |
e7757ad0 KR |
216 | mips-dec-bsd*) fmt=aout targ=mips-lit ;; |
217 | mips-sony-bsd*) fmt=ecoff targ=mips-big ;; | |
218 | mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;; | |
70f4dbce | 219 | mips-*-ultrix*) fmt=ecoff targ=mips-lit endian=little ;; |
7be9a312 | 220 | mips-*-osf*) fmt=ecoff targ=mips-lit endian=little ;; |
e7757ad0 KR |
221 | mips-*-ecoff*) fmt=ecoff |
222 | case "$endian" in | |
223 | big) targ=mips-big ;; | |
224 | *) targ=mips-lit ;; | |
225 | esac | |
226 | ;; | |
227 | mips-*-ecoff*) fmt=ecoff targ=mips-big ;; | |
cbe7dccb | 228 | mips-*-irix6*) fmt=elf targ=mips-big ;; |
e7757ad0 KR |
229 | mips-*-irix5*) fmt=elf targ=mips-big ;; |
230 | mips-*-irix*) fmt=ecoff targ=mips-big ;; | |
515c7142 | 231 | mips-*-lnews*) fmt=ecoff targ=mips-lit em=lnews ;; |
e7757ad0 KR |
232 | mips-*-riscos*) fmt=ecoff targ=mips-big ;; |
233 | mips-*-sysv*) fmt=ecoff targ=mips-big ;; | |
fc984eb0 | 234 | mips-*-elf* | mips-*-rtems* | mips-*-linux* | mips-*-gnu* | mips-*-openbsd*) |
fed13a5e | 235 | fmt=elf |
e7757ad0 KR |
236 | case "$endian" in |
237 | big) targ=mips-big ;; | |
238 | *) targ=mips-lit ;; | |
239 | esac | |
240 | ;; | |
ae1b99e4 JL |
241 | mn10200-*-*) fmt=elf bfd_gas=yes ;; |
242 | mn10300-*-*) fmt=elf bfd_gas=yes ;; | |
0ff513d9 SC |
243 | ppc-*-pe | ppc-*-cygwin32 | ppc-*-winnt*) |
244 | fmt=coff em=pe | |
85cc2190 KK |
245 | case "$endian" in |
246 | big) targ=ppc-big ;; | |
247 | *) targ=ppc-lit ;; | |
248 | esac | |
249 | ;; | |
e7757ad0 | 250 | ppc-*-aix*) fmt=coff ;; |
515c7142 | 251 | ppc-*-beos*) fmt=coff ;; |
76fb6d2f | 252 | ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*) |
e7757ad0 KR |
253 | fmt=elf |
254 | case "$endian" in | |
255 | big) targ=ppc-big ;; | |
256 | *) targ=ppc-lit ;; | |
257 | esac | |
258 | ;; | |
159e6ef8 MM |
259 | ppc-*-linux*) fmt=elf |
260 | case "$endian" in | |
261 | big) targ=ppc-big ;; | |
262 | *) AC_MSG_ERROR(Linux must be configured big endian) ;; | |
263 | esac | |
264 | ;; | |
265 | ppc-*-solaris*) fmt=elf | |
266 | case "$endian" in | |
267 | big) AC_MSG_ERROR(Solaris must be configured little endian) ;; | |
268 | *) targ=ppc-sol ;; | |
269 | esac | |
270 | ;; | |
1c94de4d JM |
271 | ppc-*-rtems*) |
272 | fmt=elf | |
273 | case "$endian" in | |
274 | big) targ=ppc-big ;; | |
275 | *) targ=ppc-lit ;; | |
276 | esac | |
277 | ;; | |
880b7429 KR |
278 | ppc-*-macos* | ppc-*-mpw*) |
279 | fmt=coff em=macos ;; | |
e7757ad0 KR |
280 | ppc-*-netware*) fmt=elf em=ppcnw ;; |
281 | ||
fed13a5e ILT |
282 | sh-*-elf*) fmt=elf ;; |
283 | sh-*-coff*) fmt=coff ;; | |
816153a3 | 284 | |
5f757edc ILT |
285 | ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;; |
286 | ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;; | |
76fb6d2f | 287 | ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;; |
e7757ad0 | 288 | |
1c94de4d | 289 | sparc-*-rtems*) fmt=aout ;; |
e7757ad0 | 290 | sparc-*-sunos4*) fmt=aout em=sun3 ;; |
df586de2 | 291 | sparc-*-aout | sparc*-*-vxworks*) |
fed13a5e | 292 | fmt=aout em=sparcaout ;; |
e7757ad0 | 293 | sparc-*-coff) fmt=coff ;; |
2e013bb7 ILT |
294 | sparc-*-linux*aout*) fmt=aout em=linux ;; |
295 | sparc-*-linux*) fmt=elf em=linux ;; | |
e7757ad0 KR |
296 | sparc-*-lynxos*) fmt=coff em=lynx ;; |
297 | sparc-fujitsu-none) fmt=aout ;; | |
0b27ea39 | 298 | sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*) |
e7757ad0 KR |
299 | fmt=elf ;; |
300 | sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; | |
76fb6d2f | 301 | sparc-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;; |
c6aa56bc | 302 | |
64556643 | 303 | # start-sanitize-tic80 |
7d0f8249 | 304 | tic80-*-*) fmt=coff targ=tic80coff;; |
64556643 | 305 | # end-sanitize-tic80 |
ec2f730d | 306 | # start-sanitize-v850 |
c6aa56bc | 307 | v850-*-*) fmt=elf bfd_gas=yes ;; |
e7757ad0 | 308 | |
ec2f730d | 309 | # end-sanitize-v850 |
e7757ad0 KR |
310 | vax-*-bsd* | vax-*-ultrix*) |
311 | fmt=aout ;; | |
312 | vax-*-vms) fmt=vms ;; | |
313 | ||
314 | z8k-*-coff | z8k-*-sim) | |
315 | fmt=coff ;; | |
316 | ||
317 | w65-*-*) fmt=coff ;; | |
318 | ||
319 | *-*-aout | *-*-scout) | |
320 | fmt=aout ;; | |
321 | *-*-nindy*) | |
322 | fmt=bout ;; | |
323 | *-*-bsd*) | |
324 | fmt=aout em=sun3 ;; | |
325 | *-*-generic) fmt=generic ;; | |
326 | *-*-xray | *-*-hms) fmt=coff ;; | |
327 | *-*-sim) fmt=coff ;; | |
328 | *-*-elf | *-*-sysv4* | *-*-solaris*) | |
6df07e7f | 329 | AC_MSG_WARN(GAS support for ${generic_target} is incomplete.) |
e7757ad0 KR |
330 | fmt=elf dev=yes ;; |
331 | *-*-vxworks) fmt=aout ;; | |
332 | *-*-netware) fmt=elf ;; | |
333 | esac | |
334 | ||
335 | case ${cpu_type}-${fmt} in | |
df586de2 | 336 | alpha-*) bfd_gas=yes ;; |
e7757ad0 KR |
337 | arm-*) bfd_gas=yes ;; |
338 | # not yet | |
339 | # i386-aout) bfd_gas=preferred ;; | |
340 | mips-*) bfd_gas=yes ;; | |
341 | ns32k-*) bfd_gas=yes ;; | |
342 | ppc-*) bfd_gas=yes ;; | |
343 | sparc-*) bfd_gas=yes ;; | |
344 | *-elf) bfd_gas=yes ;; | |
345 | *-ecoff) bfd_gas=yes ;; | |
346 | *-som) bfd_gas=yes ;; | |
347 | *) ;; | |
348 | esac | |
349 | ||
5f757edc ILT |
350 | # Other random stuff. |
351 | ||
ae09d880 ILT |
352 | # do we need the opcodes library? |
353 | case ${cpu_type} in | |
df586de2 | 354 | vax | i386) |
7c2fadd1 ILT |
355 | ;; |
356 | *) | |
357 | need_opcodes=yes | |
159e6ef8 | 358 | if test "${shared_opcodes}" = "true"; then |
7c2fadd1 ILT |
359 | # A shared libopcodes must be linked against libbfd. |
360 | need_bfd=yes | |
361 | fi | |
362 | ;; | |
ae09d880 ILT |
363 | esac |
364 | ||
6df07e7f DE |
365 | test -n "$want_sparc_v9" && AC_DEFINE(SPARC_V9) |
366 | ||
367 | case ${cpu}-${vendor}-${os} in | |
368 | sparc64-*-elf*) AC_DEFINE(SPARC_ARCH64) ;; | |
369 | esac | |
5f757edc ILT |
370 | |
371 | case ${cpu_type} in | |
374bdac7 DE |
372 | m32r) |
373 | case ${extra_objects} in | |
374 | *cgen.o*) ;; | |
375 | *) extra_objects="$extra_objects cgen.o" | |
374bdac7 DE |
376 | AC_DEFINE(USING_CGEN) |
377 | ;; | |
378 | esac | |
379 | ;; | |
380 | ||
1c9dbb83 ILT |
381 | m68k) |
382 | case ${extra_objects} in | |
383 | *m68k-parse.o*) ;; | |
384 | *) extra_objects="$extra_objects m68k-parse.o" ;; | |
385 | esac | |
386 | ;; | |
efec4a28 DP |
387 | |
388 | mips) | |
515c7142 | 389 | echo ${extra_objects} | grep -s "itbl-parse.o" |
efec4a28 | 390 | if test $? -ne 0 ; then |
515c7142 | 391 | extra_objects="$extra_objects itbl-parse.o" |
efec4a28 DP |
392 | fi |
393 | ||
515c7142 | 394 | echo ${extra_objects} | grep -s "itbl-lex.o" |
efec4a28 | 395 | if test $? -ne 0 ; then |
515c7142 | 396 | extra_objects="$extra_objects itbl-lex.o" |
efec4a28 DP |
397 | fi |
398 | ||
515c7142 | 399 | echo ${extra_objects} | grep -s "itbl-ops.o" |
efec4a28 | 400 | if test $? -ne 0 ; then |
515c7142 | 401 | extra_objects="$extra_objects itbl-ops.o" |
efec4a28 DP |
402 | fi |
403 | ;; | |
404 | ||
405 | *) | |
406 | ;; | |
5f757edc ILT |
407 | esac |
408 | ||
e7757ad0 KR |
409 | # See if we really can support this configuration with the emulation code. |
410 | ||
411 | if test $this_target = $target ; then | |
412 | primary_bfd_gas=$bfd_gas | |
413 | obj_format=$fmt | |
414 | gas_target=$targ | |
415 | te_file=$em | |
416 | ||
417 | if test $bfd_gas = no ; then | |
418 | # Can't support other configurations this way. | |
419 | break | |
420 | fi | |
421 | elif test $bfd_gas = no ; then | |
422 | # Can't support this configuration. | |
423 | break | |
424 | fi | |
425 | ||
426 | # From target name and format, produce a list of supported emulations. | |
427 | ||
428 | case ${generic_target}-${fmt} in | |
1cb0d00d | 429 | mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; |
515c7142 ILT |
430 | mips-*-linux*-*) case "$endian" in |
431 | big) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; | |
432 | *) emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;; | |
433 | esac ;; | |
434 | mips-*-lnews*-ecoff) ;; | |
e7757ad0 | 435 | mips-*-*-ecoff) case "$endian" in |
1cb0d00d KR |
436 | big) emulation="mipsbecoff mipslecoff mipsecoff" ;; |
437 | *) emulation="mipslecoff mipsbecoff mipsecoff" ;; | |
e7757ad0 KR |
438 | esac ;; |
439 | mips-*-*-elf) case "$endian" in | |
1cb0d00d KR |
440 | big) emulation="mipsbelf mipslelf mipself" ;; |
441 | *) emulation="mipslelf mipsbelf mipself" ;; | |
515c7142 ILT |
442 | # Uncommenting the next line will turn on support for i386 COFF |
443 | # in any i386 ELF configuration. This probably doesn't work | |
444 | # correctly. | |
445 | # i386-*-*-elf) emulation="i386coff i386elf" ;; | |
e7757ad0 KR |
446 | esac ;; |
447 | esac | |
448 | ||
449 | emulations="$emulations $emulation" | |
450 | ||
e7757ad0 | 451 | done |
fecd2382 | 452 | |
8cac6ca6 KR |
453 | # Assign floating point type. Most processors with FP support |
454 | # IEEE FP. On those that don't support FP at all, usually IEEE | |
455 | # is emulated. | |
b678740d | 456 | case ${target_cpu} in |
904b6037 | 457 | vax | tahoe ) atof=${target_cpu} ;; |
e7757ad0 | 458 | *) atof=ieee ;; |
fecd2382 RP |
459 | esac |
460 | ||
8cac6ca6 | 461 | case "${obj_format}" in |
b11fb939 | 462 | "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;; |
8cac6ca6 | 463 | esac |
7cf4d7ff | 464 | |
b11fb939 KR |
465 | dnl |
466 | dnl Make sure the desired support files exist. | |
467 | dnl | |
468 | ||
bf4bd1fc ILT |
469 | if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then |
470 | AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type}) | |
b11fb939 KR |
471 | fi |
472 | ||
fb589130 | 473 | if test ! -r ${srcdir}/config/obj-${obj_format}.c; then |
b11fb939 | 474 | AC_MSG_ERROR(GAS does not have support for object file format ${obj_format}) |
7cf4d7ff KR |
475 | fi |
476 | ||
8a24a37c SC |
477 | # and target makefile frag |
478 | ||
b11fb939 | 479 | target_frag=${srcdir}/config/${gas_target}.mt |
f2889110 KR |
480 | if test ! -r ${target_frag}; then |
481 | target_frag=/dev/null # ick! but subst_file can't be conditionalized | |
482 | fi | |
b11fb939 | 483 | AC_SUBST_FILE(target_frag) |
8a24a37c | 484 | |
e7757ad0 | 485 | case ${user_bfd_gas}-${primary_bfd_gas} in |
a8285504 | 486 | yes-yes | no-no) |
7cf4d7ff KR |
487 | # We didn't override user's choice. |
488 | ;; | |
a8285504 | 489 | no-yes) |
b11fb939 | 490 | AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.) |
7cf4d7ff | 491 | ;; |
a8285504 | 492 | no-preferred) |
e7757ad0 | 493 | primary_bfd_gas=no |
a8285504 DZ |
494 | ;; |
495 | *-preferred) | |
e7757ad0 | 496 | primary_bfd_gas=yes |
a8285504 | 497 | ;; |
f2889110 | 498 | yes-*) |
e7757ad0 | 499 | primary_bfd_gas=yes |
f2889110 | 500 | ;; |
a8285504 DZ |
501 | -*) |
502 | # User specified nothing. | |
503 | ;; | |
7cf4d7ff KR |
504 | esac |
505 | ||
e7757ad0 KR |
506 | # Some COFF configurations want these random other flags set. |
507 | case ${obj_format} in | |
508 | coff) | |
509 | case ${target_cpu_type} in | |
510 | i386) AC_DEFINE(I386COFF) ;; | |
511 | m68k) AC_DEFINE(M68KCOFF) ;; | |
512 | m88k) AC_DEFINE(M88KCOFF) ;; | |
513 | esac | |
514 | ;; | |
515 | esac | |
516 | ||
517 | # Getting this done right is going to be a bitch. Each configuration specified | |
518 | # with --enable-targets=... should be checked for environment, format, cpu, and | |
519 | # bfd_gas setting. | |
520 | # | |
521 | # For each configuration, the necessary object file support code must be linked | |
522 | # in. This might be only one, it might be up to four. The necessary emulation | |
523 | # code needs to be provided, too. | |
524 | # | |
525 | # And then there's "--enable-targets=all".... | |
526 | # | |
527 | # For now, just always do it for MIPS ELF or ECOFF configurations. Sigh. | |
528 | ||
529 | formats="${obj_format}" | |
530 | emfiles="" | |
531 | EMULATIONS="" | |
532 | GAS_UNIQ(emulations) | |
533 | for em in . $emulations ; do | |
534 | case $em in | |
535 | .) continue ;; | |
536 | mipsbelf | mipslelf) | |
537 | fmt=elf file=mipself ;; | |
538 | mipsbecoff | mipslecoff) | |
539 | fmt=ecoff file=mipsecoff ;; | |
515c7142 ILT |
540 | i386coff) |
541 | fmt=coff file=i386coff ;; | |
542 | i386elf) | |
543 | fmt=elf file=i386elf ;; | |
e7757ad0 KR |
544 | esac |
545 | formats="$formats $fmt" | |
546 | emfiles="$emfiles e-$file.o" | |
547 | EMULATIONS="$EMULATIONS &$em," | |
548 | done | |
549 | GAS_UNIQ(formats) | |
550 | GAS_UNIQ(emfiles) | |
551 | if test `set . $formats ; shift ; echo $#` -gt 1 ; then | |
552 | for fmt in $formats ; do | |
553 | case $fmt in | |
554 | aout) AC_DEFINE(OBJ_MAYBE_AOUT) ;; | |
555 | bout) AC_DEFINE(OBJ_MAYBE_BOUT) ;; | |
556 | coff) AC_DEFINE(OBJ_MAYBE_COFF) ;; | |
557 | ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF) ;; | |
558 | elf) AC_DEFINE(OBJ_MAYBE_ELF) ;; | |
559 | generic) AC_DEFINE(OBJ_MAYBE_GENERIC) ;; | |
560 | hp300) AC_DEFINE(OBJ_MAYBE_HP300) ;; | |
561 | ieee) AC_DEFINE(OBJ_MAYBE_IEEE) ;; | |
562 | som) AC_DEFINE(OBJ_MAYBE_SOM) ;; | |
563 | vms) AC_DEFINE(OBJ_MAYBE_VMS) ;; | |
564 | esac | |
565 | extra_objects="$extra_objects obj-$fmt.o" | |
566 | done | |
567 | obj_format=multi | |
568 | fi | |
569 | if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then | |
570 | te_file=multi | |
571 | extra_objects="$extra_objects $emfiles" | |
572 | DEFAULT_EMULATION=`set . $emulations ; echo $2` | |
573 | AC_DEFINE(USE_EMULATIONS) | |
574 | fi | |
575 | AC_SUBST(extra_objects) | |
576 | AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS) | |
577 | AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION") | |
578 | ||
bf4bd1fc | 579 | case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in |
318b02b6 KR |
580 | yes-*-coff) need_bfd=yes ;; |
581 | no-*-coff) need_bfd=yes | |
582 | AC_DEFINE(MANY_SEGMENTS) ;; | |
583 | esac | |
584 | ||
69ecc03f | 585 | reject_dev_configs=yes |
8cac6ca6 KR |
586 | |
587 | case ${reject_dev_configs}-${dev} in | |
588 | yes-yes) # Oops. | |
b11fb939 | 589 | AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.) |
8cac6ca6 KR |
590 | ;; |
591 | esac | |
592 | ||
bf4bd1fc | 593 | AC_SUBST(target_cpu_type) |
833c46e1 | 594 | AC_SUBST(obj_format) |
515c7142 | 595 | AC_SUBST(te_file) |
833c46e1 | 596 | AC_SUBST(atof) |
e7757ad0 | 597 | dnl AC_SUBST(emulation) |
833c46e1 | 598 | |
e7757ad0 | 599 | case "${primary_bfd_gas}" in |
b11fb939 KR |
600 | yes) AC_DEFINE(BFD_ASSEMBLER) |
601 | need_bfd=yes ;; | |
4f6f4aa8 KR |
602 | esac |
603 | ||
ae09d880 ILT |
604 | # do we need the opcodes library? |
605 | case "${need_opcodes}" in | |
1c94de4d | 606 | yes) |
e2b4bd2a | 607 | OPCODES_LIB=../opcodes/libopcodes.la |
1c94de4d | 608 | ;; |
ae09d880 | 609 | esac |
ae09d880 | 610 | |
b11fb939 | 611 | case "${need_bfd}" in |
1c94de4d | 612 | yes) |
e2b4bd2a | 613 | BFDLIB=../bfd/libbfd.la |
1c94de4d | 614 | ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h" |
1c94de4d | 615 | ;; |
4f6f4aa8 | 616 | esac |
2e013bb7 | 617 | |
b11fb939 | 618 | AC_SUBST(BFDLIB) |
2e013bb7 ILT |
619 | AC_SUBST(OPCODES_LIB) |
620 | ||
b11fb939 | 621 | AC_SUBST(ALL_OBJ_DEPS) |
4f6f4aa8 | 622 | |
b11fb939 KR |
623 | AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}") |
624 | AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}") | |
625 | AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}") | |
626 | AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}") | |
627 | AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}") | |
628 | ||
b11fb939 KR |
629 | AC_PROG_CC |
630 | AC_PROG_INSTALL | |
631 | ||
e2b4bd2a ILT |
632 | AC_PROG_YACC |
633 | AC_PROG_LEX | |
634 | AC_DECL_YYTEXT | |
635 | ||
636 | AM_MAINTAINER_MODE | |
637 | AM_CYGWIN32 | |
638 | AM_EXEEXT | |
639 | ||
b11fb939 KR |
640 | AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h) |
641 | ||
bf111c9f KR |
642 | # Put this here so that autoconf's "cross-compiling" message doesn't confuse |
643 | # people who are not cross-compiling but are compiling cross-assemblers. | |
644 | AC_MSG_CHECKING(whether compiling a cross-assembler) | |
645 | if test "${host}" = "${target}"; then | |
f2889110 KR |
646 | cross_gas=no |
647 | else | |
bf111c9f KR |
648 | cross_gas=yes |
649 | AC_DEFINE(CROSS_COMPILE) | |
bf111c9f KR |
650 | fi |
651 | AC_MSG_RESULT($cross_gas) | |
652 | ||
b11fb939 KR |
653 | dnl ansidecl.h will deal with const |
654 | dnl AC_CONST | |
655 | AC_FUNC_ALLOCA | |
656 | AC_C_INLINE | |
657 | ||
f2889110 KR |
658 | # VMS doesn't have unlink. |
659 | AC_CHECK_FUNCS(unlink remove, break) | |
28d3e4a3 | 660 | |
e63c594d FF |
661 | # Some systems don't have sbrk(). |
662 | AC_CHECK_FUNCS(sbrk) | |
663 | ||
b11fb939 KR |
664 | # Some non-ANSI preprocessors botch requoting inside strings. That's bad |
665 | # enough, but on some of those systems, the assert macro relies on requoting | |
666 | # working properly! | |
bf111c9f | 667 | GAS_WORKING_ASSERT |
b11fb939 KR |
668 | |
669 | # On some systems, the system header files may not declare malloc, realloc, | |
670 | # and free. There are places where gas needs these functions to have been | |
671 | # declared -- such as when taking their addresses. | |
bf111c9f | 672 | gas_test_headers=" |
b11fb939 KR |
673 | #ifdef HAVE_MEMORY_H |
674 | #include <memory.h> | |
675 | #endif | |
676 | #ifdef HAVE_STRING_H | |
677 | #include <string.h> | |
5cece526 ILT |
678 | #else |
679 | #ifdef HAVE_STRINGS_H | |
680 | #include <strings.h> | |
681 | #endif | |
b11fb939 KR |
682 | #endif |
683 | #ifdef HAVE_STDLIB_H | |
684 | #include <stdlib.h> | |
685 | #endif | |
686 | #ifdef HAVE_UNISTD_H | |
687 | #include <unistd.h> | |
688 | #endif | |
bf111c9f | 689 | " |
5cece526 | 690 | GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers) |
bf111c9f | 691 | GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers) |
5f757edc | 692 | GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers) |
5cece526 | 693 | GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers) |
b11fb939 KR |
694 | |
695 | # Does errno.h declare errno, or do we have to add a separate declaration | |
696 | # for it? | |
bf111c9f | 697 | GAS_CHECK_DECL_NEEDED(errno, f, int f, [ |
b11fb939 KR |
698 | #ifdef HAVE_ERRNO_H |
699 | #include <errno.h> | |
700 | #endif | |
bf111c9f | 701 | ]) |
b11fb939 | 702 | |
b11fb939 | 703 | dnl This must come last. |
515c7142 ILT |
704 | |
705 | dnl We used to make symlinks to files in the source directory, but now | |
706 | dnl we just use the right name for .c files, and create .h files in | |
707 | dnl the build directory which include the right .h file. Make sure | |
708 | dnl the old symlinks don't exist, so that a reconfigure in an existing | |
709 | dnl directory behaves reasonably. | |
710 | ||
711 | AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in, | |
712 | [rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h | |
713 | echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h | |
714 | echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h | |
715 | echo '#include "te-'"${te_file}"'.h"' > targ-env.h | |
39ffbb4d DE |
716 | echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h |
717 | case ${target_cpu_type} in | |
718 | m32r) echo '#include "opcodes/'"${target_cpu_type}"'-opc.h"' > cgen-opc.h ;; | |
719 | esac], | |
515c7142 ILT |
720 | [target_cpu_type=${target_cpu_type} |
721 | obj_format=${obj_format} | |
722 | te_file=${te_file}]) |