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 | ||
921d7728 | 13 | AM_INIT_AUTOMAKE(gas, 2.9.4) |
e2b4bd2a ILT |
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 | 68 | # check for architecture variants |
2b09622a | 69 | arch= |
6ff87ead | 70 | endian= |
e7757ad0 | 71 | case ${cpu} in |
0170f1c3 | 72 | alpha*) cpu_type=alpha ;; |
ae09d880 ILT |
73 | armeb) cpu_type=arm endian=big ;; |
74 | arm*) cpu_type=arm endian=little ;; | |
76fb6d2f | 75 | thumb*) cpu_type=arm endian=little ;; |
e7757ad0 KR |
76 | hppa*) cpu_type=hppa ;; |
77 | changequote(,)dnl | |
7c2fadd1 | 78 | i[456]86) cpu_type=i386 ;; |
e7757ad0 | 79 | m680[012346]0) cpu_type=m68k ;; |
921d7728 | 80 | changequote([,])dnl |
e7757ad0 KR |
81 | m68008) cpu_type=m68k ;; |
82 | m683??) cpu_type=m68k ;; | |
921d7728 | 83 | m5200) cpu_type=m68k ;; |
e7757ad0 | 84 | m8*) cpu_type=m88k ;; |
e16b9537 | 85 | mips*el) cpu_type=mips endian=little ;; |
01c655cc | 86 | # start-sanitize-r5900 |
9587640a | 87 | mips*5900*) cpu_type=mips endian=little ;; |
01c655cc | 88 | # end-sanitize-r5900 |
e7757ad0 KR |
89 | mips*) cpu_type=mips endian=big ;; |
90 | powerpcle*) cpu_type=ppc endian=little ;; | |
91 | powerpc*) cpu_type=ppc endian=big ;; | |
92 | rs6000*) cpu_type=ppc ;; | |
2b09622a DE |
93 | sparclite*) cpu_type=sparc arch=sparclite ;; |
94 | sparclet*) cpu_type=sparc arch=sparclet ;; | |
70ee7782 | 95 | sparc64*) cpu_type=sparc arch=v9-64 ;; |
307edcc0 | 96 | sparc86x*) cpu_type=sparc arch=sparc86x ;; |
2b09622a | 97 | sparc*) cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c. |
756adc97 | 98 | v850*) cpu_type=v850 ;; |
a1c7c0f3 | 99 | *) cpu_type=${cpu} ;; |
e7757ad0 KR |
100 | esac |
101 | ||
102 | if test ${this_target} = $target ; then | |
103 | target_cpu_type=${cpu_type} | |
6ff87ead NC |
104 | if test x${endian} = xbig; then |
105 | AC_DEFINE(TARGET_BYTES_BIG_ENDIAN, 1) | |
106 | elif test x${endian} = xlittle; then | |
107 | AC_DEFINE(TARGET_BYTES_BIG_ENDIAN, 0) | |
108 | fi | |
e7757ad0 KR |
109 | elif test ${target_cpu_type} != ${cpu_type} ; then |
110 | continue | |
111 | fi | |
112 | ||
e7757ad0 KR |
113 | generic_target=${cpu_type}-$vendor-$os |
114 | dev=no | |
115 | bfd_gas=no | |
116 | em=generic | |
7cf4d7ff | 117 | |
e7757ad0 KR |
118 | # assign object format |
119 | case ${generic_target} in | |
6ff87ead NC |
120 | a29k-*-coff) fmt=coff ;; |
121 | a29k-amd-udi) fmt=coff ;; | |
122 | a29k-amd-ebmon) fmt=coff ;; | |
123 | a29k-nyu-sym1) fmt=coff ;; | |
e7757ad0 KR |
124 | a29k-*-vxworks*) fmt=coff ;; |
125 | ||
0170f1c3 RH |
126 | alpha*-*-*vms*) fmt=evax ;; |
127 | alpha*-*-netware*) fmt=ecoff ;; | |
128 | alpha*-*-openbsd*) fmt=ecoff ;; | |
129 | alpha*-*-osf*) fmt=ecoff ;; | |
130 | alpha*-*-linuxecoff*) fmt=ecoff ;; | |
22d3fbd6 NC |
131 | alpha*-*-linux-gnu*) fmt=elf em=linux ;; |
132 | alpha*-*-netbsd*) fmt=elf em=nbsd ;; | |
816153a3 | 133 | |
e7757ad0 | 134 | arc-*-elf*) fmt=elf bfd_gas=yes ;; |
4181c985 | 135 | |
6ff87ead NC |
136 | arm-*-riscix*) fmt=aout em=riscix ;; |
137 | arm-*-aout) fmt=aout ;; | |
76fb6d2f | 138 | arm-*-coff | thumb-*-coff) fmt=coff ;; |
e7757ad0 | 139 | arm-*-riscix*) fmt=aout ;; |
22d3fbd6 | 140 | arm-*-pe | thumb-*-pe) fmt=coff em=pe ;; |
e7757ad0 | 141 | |
05a8bf33 | 142 | d10v-*-*) fmt=elf bfd_gas=yes ;; |
7d0f8249 | 143 | d30v-*-*) fmt=elf bfd_gas=yes ;; |
7be9a312 | 144 | |
e7757ad0 KR |
145 | hppa-*-*elf*) fmt=elf em=hppa ;; |
146 | hppa-*-lites*) fmt=elf em=hppa ;; | |
147 | hppa-*-osf*) fmt=som em=hppa ;; | |
332d5c49 | 148 | hppa-*-rtems*) fmt=elf em=hppa ;; |
e7757ad0 KR |
149 | hppa-*-hpux*) fmt=som em=hppa ;; |
150 | hppa-*-bsd*) fmt=som em=hppa ;; | |
151 | hppa-*-hiux*) fmt=som em=hppa ;; | |
152 | ||
153 | h8300-*-coff) fmt=coff ;; | |
154 | ||
6ff87ead | 155 | i386-ibm-aix*) fmt=coff em=i386aix ;; |
7d0f8249 | 156 | i386-sequent-bsd*) fmt=aout em=dynix bfd_gas=yes ;; |
cc88a106 ILT |
157 | dnl start-sanitize-beos |
158 | i386-*-beospe*) fmt=coff em=pe bfd_gas=yes ;; | |
159 | i386-*-beoself* | i386-*-beos*) fmt=elf ;; | |
160 | dnl end-sanitize-beos | |
e7757ad0 KR |
161 | i386-*-bsd*) fmt=aout em=386bsd ;; |
162 | i386-*-netbsd0.8) fmt=aout em=386bsd ;; | |
163 | i386-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes;; | |
76fb6d2f | 164 | i386-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes;; |
a1c7c0f3 | 165 | i386-*-linux*aout* | i386-*-linuxoldld) fmt=aout em=linux ;; |
6ff87ead | 166 | i386-*-linux*coff*) fmt=coff em=linux ;; |
22d3fbd6 | 167 | i386-*-linux-gnu*) fmt=elf em=linux ;; |
6ff87ead | 168 | i386-*-lynxos*) fmt=coff em=lynx ;; |
15ddb4c9 | 169 | i386-*-sysv4* | i386-*-solaris* | i386-*-elf) |
e7757ad0 | 170 | fmt=elf ;; |
15ddb4c9 AC |
171 | i386-*-freebsdelf*) fmt=elf ;; |
172 | i386-*-freebsd*) fmt=aout em=386bsd ;; | |
6cc7a938 ILT |
173 | i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*) |
174 | fmt=coff ;; | |
175 | i386-*-sco3.2v5*) fmt=elf | |
6ff87ead NC |
176 | if test ${this_target} = $target; then |
177 | AC_DEFINE(SCO_ELF) | |
178 | fi | |
179 | ;; | |
6cc7a938 | 180 | i386-*-sco3.2*) fmt=coff ;; |
e7757ad0 | 181 | i386-*-vsta) fmt=aout ;; |
60dc9fb2 | 182 | i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*) |
6ff87ead NC |
183 | fmt=coff em=go32;; |
184 | i386-*-rtems*) fmt=coff ;; | |
6c186c48 SC |
185 | i386-*-gnu*) fmt=elf ;; |
186 | i386-*-mach*) | |
e7757ad0 KR |
187 | fmt=aout em=mach bfd_gas=yes ;; |
188 | i386-*-msdos*) fmt=aout ;; | |
6c186c48 | 189 | i386-*-moss*) fmt=elf ;; |
6ff87ead | 190 | i386-*-pe) fmt=coff em=pe ;; |
0040c1e9 ILT |
191 | i386-*-cygwin32*) fmt=coff em=pe bfd_gas=yes ;; |
192 | i386-*-mingw32*) fmt=coff em=pe bfd_gas=yes ;; | |
193 | i386-*-*nt*) fmt=coff em=pe ;; | |
e7757ad0 | 194 | i960-*-bout) fmt=bout ;; |
6ff87ead NC |
195 | i960-*-coff) fmt=coff em=ic960 ;; |
196 | i960-*-rtems*) fmt=coff em=ic960 ;; | |
e7757ad0 KR |
197 | i960-*-nindy*) fmt=bout ;; |
198 | i960-*-vxworks4*) fmt=bout ;; | |
199 | i960-*-vxworks5.0) fmt=bout ;; | |
6ff87ead | 200 | i960-*-vxworks5.*) fmt=coff em=ic960 ;; |
e7757ad0 KR |
201 | i960-*-vxworks*) fmt=bout ;; |
202 | ||
374bdac7 DE |
203 | m32r-*-*) fmt=elf bfd_gas=yes ;; |
204 | ||
e7757ad0 KR |
205 | m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*) |
206 | fmt=aout em=sun3 ;; | |
6ff87ead NC |
207 | m68k-motorola-sysv*) fmt=coff em=delta ;; |
208 | m68k-bull-sysv3*) fmt=coff em=dpx2 ;; | |
209 | m68k-apollo-*) fmt=coff em=apollo ;; | |
fee3e248 ILT |
210 | m68k-*-sysv4*) # must be before -sysv* |
211 | fmt=elf em=svr4 ;; | |
212 | m68k-*-elf*) fmt=elf ;; | |
1c94de4d | 213 | m68k-*-coff | m68k-*-sysv* | m68k-*-rtems*) |
6ff87ead | 214 | fmt=coff ;; |
e7757ad0 | 215 | m68k-*-hpux*) fmt=hp300 em=hp300 ;; |
535cfd0f | 216 | m68k-*-linux*aout*) fmt=aout em=linux ;; |
22d3fbd6 | 217 | m68k-*-linux-gnu*) fmt=elf em=linux ;; |
6ff87ead | 218 | m68k-*-lynxos*) fmt=coff em=lynx ;; |
e7757ad0 | 219 | m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; |
76fb6d2f | 220 | m68k-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;; |
6ff87ead | 221 | m68k-apple-aux*) fmt=coff em=aux ;; |
8a6f53e9 | 222 | m68k-*-psos*) fmt=elf em=psos;; |
e7757ad0 | 223 | |
6ff87ead NC |
224 | m88k-motorola-sysv3*) fmt=coff em=delt88 ;; |
225 | m88k-*-coff*) fmt=coff ;; | |
e7757ad0 KR |
226 | |
227 | # don't change em like *-*-bsd does | |
6ff87ead NC |
228 | mips-dec-netbsd*) fmt=elf endian=little ;; |
229 | mips-dec-openbsd*) fmt=elf endian=little ;; | |
230 | mips-dec-bsd*) fmt=aout ;; | |
231 | mips-sony-bsd*) fmt=ecoff ;; | |
e7757ad0 | 232 | mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;; |
6ff87ead NC |
233 | mips-*-ultrix*) fmt=ecoff endian=little ;; |
234 | mips-*-osf*) fmt=ecoff endian=little ;; | |
235 | mips-*-ecoff*) fmt=ecoff ;; | |
236 | mips-*-ecoff*) fmt=ecoff ;; | |
237 | mips-*-irix6*) fmt=elf ;; | |
238 | mips-*-irix5*) fmt=elf ;; | |
239 | mips-*-irix*) fmt=ecoff ;; | |
240 | mips-*-lnews*) fmt=ecoff em=lnews ;; | |
241 | mips-*-riscos*) fmt=ecoff ;; | |
242 | mips-*-sysv*) fmt=ecoff ;; | |
22d3fbd6 | 243 | mips-*-elf* | mips-*-rtems* | mips-*-linux-gnu* | mips-*-gnu* | mips-*-openbsd*) |
6ff87ead | 244 | fmt=elf ;; |
ae1b99e4 JL |
245 | mn10200-*-*) fmt=elf bfd_gas=yes ;; |
246 | mn10300-*-*) fmt=elf bfd_gas=yes ;; | |
0ff513d9 | 247 | ppc-*-pe | ppc-*-cygwin32 | ppc-*-winnt*) |
6ff87ead | 248 | fmt=coff em=pe ;; |
e7757ad0 | 249 | ppc-*-aix*) fmt=coff ;; |
515c7142 | 250 | ppc-*-beos*) fmt=coff ;; |
76fb6d2f | 251 | ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*) |
6ff87ead | 252 | fmt=elf ;; |
22d3fbd6 | 253 | ppc-*-linux-gnu*) fmt=elf |
159e6ef8 | 254 | case "$endian" in |
6ff87ead | 255 | big) ;; |
22d3fbd6 | 256 | *) AC_MSG_ERROR(GNU/Linux must be configured big endian) ;; |
159e6ef8 MM |
257 | esac |
258 | ;; | |
259 | ppc-*-solaris*) fmt=elf | |
6ff87ead NC |
260 | if test ${this_target} = $target; then |
261 | AC_DEFINE(TARGET_SOLARIS_COMMENT) | |
262 | fi | |
263 | if test x${endian} = xbig; then | |
264 | AC_MSG_ERROR(Solaris must be configured little endian) | |
265 | fi | |
1c94de4d | 266 | ;; |
6ff87ead | 267 | ppc-*-rtems*) fmt=elf ;; |
880b7429 KR |
268 | ppc-*-macos* | ppc-*-mpw*) |
269 | fmt=coff em=macos ;; | |
e7757ad0 KR |
270 | ppc-*-netware*) fmt=elf em=ppcnw ;; |
271 | ||
fed13a5e ILT |
272 | sh-*-elf*) fmt=elf ;; |
273 | sh-*-coff*) fmt=coff ;; | |
f3aa01e2 | 274 | sh-*-rtems*) fmt=coff ;; |
816153a3 | 275 | |
5f757edc ILT |
276 | ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;; |
277 | ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;; | |
76fb6d2f | 278 | ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;; |
e7757ad0 | 279 | |
1c94de4d | 280 | sparc-*-rtems*) fmt=aout ;; |
e7757ad0 | 281 | sparc-*-sunos4*) fmt=aout em=sun3 ;; |
df586de2 | 282 | sparc-*-aout | sparc*-*-vxworks*) |
fed13a5e | 283 | fmt=aout em=sparcaout ;; |
e7757ad0 | 284 | sparc-*-coff) fmt=coff ;; |
2e013bb7 | 285 | sparc-*-linux*aout*) fmt=aout em=linux ;; |
22d3fbd6 | 286 | sparc-*-linux-gnu*) fmt=elf em=linux ;; |
e7757ad0 KR |
287 | sparc-*-lynxos*) fmt=coff em=lynx ;; |
288 | sparc-fujitsu-none) fmt=aout ;; | |
0b27ea39 | 289 | sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*) |
e7757ad0 KR |
290 | fmt=elf ;; |
291 | sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; | |
76fb6d2f | 292 | sparc-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;; |
c6aa56bc | 293 | |
0e034c77 ILT |
294 | tic30-*-*aout*) fmt=aout bfd_gas=yes ;; |
295 | tic30-*-*coff*) fmt=coff bfd_gas=yes ;; | |
64556643 | 296 | # start-sanitize-tic80 |
6ff87ead | 297 | tic80-*-*) fmt=coff ;; |
64556643 | 298 | # end-sanitize-tic80 |
103dd764 DE |
299 | |
300 | # start-sanitize-sky | |
98b155a2 | 301 | dvp-*-*) fmt=elf bfd_gas=yes ;; |
103dd764 DE |
302 | # end-sanitize-sky |
303 | ||
c6aa56bc | 304 | v850-*-*) fmt=elf bfd_gas=yes ;; |
e7757ad0 | 305 | |
6ff87ead NC |
306 | # start-sanitize-v850e |
307 | v850e-*-*) fmt=elf bfd_gas=yes ;; | |
60dc9fb2 | 308 | v850ea-*-*) fmt=elf bfd_gas=yes ;; |
5e4e4739 | 309 | # end-sanitize-v850e |
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 | |
0170f1c3 | 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 | |
0e034c77 | 354 | vax | i386 | tic30) |
7c2fadd1 ILT |
355 | ;; |
356 | *) | |
357 | need_opcodes=yes | |
f2e272e0 ILT |
358 | |
359 | case "${enable_shared}" in | |
360 | yes) shared_opcodes=true ;; | |
361 | *opcodes*) shared_opcodes=true ;; | |
362 | *) shared_opcodes=false ;; | |
363 | esac | |
159e6ef8 | 364 | if test "${shared_opcodes}" = "true"; then |
7c2fadd1 ILT |
365 | # A shared libopcodes must be linked against libbfd. |
366 | need_bfd=yes | |
367 | fi | |
368 | ;; | |
ae09d880 ILT |
369 | esac |
370 | ||
5f757edc | 371 | case ${cpu_type} in |
374bdac7 | 372 | m32r) |
7c269afb | 373 | case "x${extra_objects}" in |
374bdac7 DE |
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 | ||
2b09622a | 405 | sparc) |
e01e18a8 DE |
406 | if test $this_target = $target ; then |
407 | AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}") | |
408 | fi | |
2b09622a DE |
409 | ;; |
410 | ||
efec4a28 DP |
411 | *) |
412 | ;; | |
5f757edc ILT |
413 | esac |
414 | ||
e7757ad0 KR |
415 | # See if we really can support this configuration with the emulation code. |
416 | ||
417 | if test $this_target = $target ; then | |
418 | primary_bfd_gas=$bfd_gas | |
419 | obj_format=$fmt | |
e7757ad0 KR |
420 | te_file=$em |
421 | ||
422 | if test $bfd_gas = no ; then | |
423 | # Can't support other configurations this way. | |
424 | break | |
425 | fi | |
426 | elif test $bfd_gas = no ; then | |
427 | # Can't support this configuration. | |
428 | break | |
429 | fi | |
430 | ||
431 | # From target name and format, produce a list of supported emulations. | |
432 | ||
433 | case ${generic_target}-${fmt} in | |
1cb0d00d | 434 | mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; |
22d3fbd6 | 435 | mips-*-linux-gnu*-*) case "$endian" in |
515c7142 ILT |
436 | big) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; |
437 | *) emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;; | |
438 | esac ;; | |
439 | mips-*-lnews*-ecoff) ;; | |
e7757ad0 | 440 | mips-*-*-ecoff) case "$endian" in |
1cb0d00d KR |
441 | big) emulation="mipsbecoff mipslecoff mipsecoff" ;; |
442 | *) emulation="mipslecoff mipsbecoff mipsecoff" ;; | |
e7757ad0 KR |
443 | esac ;; |
444 | mips-*-*-elf) case "$endian" in | |
1cb0d00d KR |
445 | big) emulation="mipsbelf mipslelf mipself" ;; |
446 | *) emulation="mipslelf mipsbelf mipself" ;; | |
515c7142 ILT |
447 | # Uncommenting the next line will turn on support for i386 COFF |
448 | # in any i386 ELF configuration. This probably doesn't work | |
449 | # correctly. | |
450 | # i386-*-*-elf) emulation="i386coff i386elf" ;; | |
e7757ad0 KR |
451 | esac ;; |
452 | esac | |
453 | ||
454 | emulations="$emulations $emulation" | |
455 | ||
e7757ad0 | 456 | done |
fecd2382 | 457 | |
8cac6ca6 KR |
458 | # Assign floating point type. Most processors with FP support |
459 | # IEEE FP. On those that don't support FP at all, usually IEEE | |
460 | # is emulated. | |
b678740d | 461 | case ${target_cpu} in |
904b6037 | 462 | vax | tahoe ) atof=${target_cpu} ;; |
e7757ad0 | 463 | *) atof=ieee ;; |
fecd2382 RP |
464 | esac |
465 | ||
8cac6ca6 | 466 | case "${obj_format}" in |
b11fb939 | 467 | "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;; |
8cac6ca6 | 468 | esac |
7cf4d7ff | 469 | |
7c269afb DE |
470 | # Unfortunately the cpu in cpu-opc.h file isn't always $(TARGET_CPU). |
471 | cgen_cpu_prefix="" | |
472 | case "x${extra_objects}" in | |
473 | *cgen.o*) | |
474 | case ${target_cpu} in | |
475 | *) cgen_cpu_prefix=${target_cpu} ;; | |
476 | esac | |
477 | ;; | |
478 | esac | |
479 | AC_SUBST(cgen_cpu_prefix) | |
480 | ||
b11fb939 KR |
481 | dnl |
482 | dnl Make sure the desired support files exist. | |
483 | dnl | |
484 | ||
bf4bd1fc ILT |
485 | if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then |
486 | AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type}) | |
b11fb939 KR |
487 | fi |
488 | ||
fb589130 | 489 | if test ! -r ${srcdir}/config/obj-${obj_format}.c; then |
b11fb939 | 490 | AC_MSG_ERROR(GAS does not have support for object file format ${obj_format}) |
7cf4d7ff KR |
491 | fi |
492 | ||
e7757ad0 | 493 | case ${user_bfd_gas}-${primary_bfd_gas} in |
a8285504 | 494 | yes-yes | no-no) |
7cf4d7ff KR |
495 | # We didn't override user's choice. |
496 | ;; | |
a8285504 | 497 | no-yes) |
b11fb939 | 498 | AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.) |
7cf4d7ff | 499 | ;; |
a8285504 | 500 | no-preferred) |
e7757ad0 | 501 | primary_bfd_gas=no |
a8285504 DZ |
502 | ;; |
503 | *-preferred) | |
e7757ad0 | 504 | primary_bfd_gas=yes |
a8285504 | 505 | ;; |
f2889110 | 506 | yes-*) |
e7757ad0 | 507 | primary_bfd_gas=yes |
f2889110 | 508 | ;; |
a8285504 DZ |
509 | -*) |
510 | # User specified nothing. | |
511 | ;; | |
7cf4d7ff KR |
512 | esac |
513 | ||
e7757ad0 KR |
514 | # Some COFF configurations want these random other flags set. |
515 | case ${obj_format} in | |
516 | coff) | |
517 | case ${target_cpu_type} in | |
518 | i386) AC_DEFINE(I386COFF) ;; | |
519 | m68k) AC_DEFINE(M68KCOFF) ;; | |
520 | m88k) AC_DEFINE(M88KCOFF) ;; | |
521 | esac | |
522 | ;; | |
523 | esac | |
524 | ||
525 | # Getting this done right is going to be a bitch. Each configuration specified | |
526 | # with --enable-targets=... should be checked for environment, format, cpu, and | |
527 | # bfd_gas setting. | |
528 | # | |
529 | # For each configuration, the necessary object file support code must be linked | |
530 | # in. This might be only one, it might be up to four. The necessary emulation | |
531 | # code needs to be provided, too. | |
532 | # | |
533 | # And then there's "--enable-targets=all".... | |
534 | # | |
535 | # For now, just always do it for MIPS ELF or ECOFF configurations. Sigh. | |
536 | ||
537 | formats="${obj_format}" | |
538 | emfiles="" | |
539 | EMULATIONS="" | |
540 | GAS_UNIQ(emulations) | |
541 | for em in . $emulations ; do | |
542 | case $em in | |
543 | .) continue ;; | |
544 | mipsbelf | mipslelf) | |
545 | fmt=elf file=mipself ;; | |
546 | mipsbecoff | mipslecoff) | |
547 | fmt=ecoff file=mipsecoff ;; | |
515c7142 ILT |
548 | i386coff) |
549 | fmt=coff file=i386coff ;; | |
550 | i386elf) | |
551 | fmt=elf file=i386elf ;; | |
e7757ad0 KR |
552 | esac |
553 | formats="$formats $fmt" | |
554 | emfiles="$emfiles e-$file.o" | |
555 | EMULATIONS="$EMULATIONS &$em," | |
556 | done | |
557 | GAS_UNIQ(formats) | |
558 | GAS_UNIQ(emfiles) | |
559 | if test `set . $formats ; shift ; echo $#` -gt 1 ; then | |
560 | for fmt in $formats ; do | |
561 | case $fmt in | |
562 | aout) AC_DEFINE(OBJ_MAYBE_AOUT) ;; | |
563 | bout) AC_DEFINE(OBJ_MAYBE_BOUT) ;; | |
564 | coff) AC_DEFINE(OBJ_MAYBE_COFF) ;; | |
565 | ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF) ;; | |
566 | elf) AC_DEFINE(OBJ_MAYBE_ELF) ;; | |
567 | generic) AC_DEFINE(OBJ_MAYBE_GENERIC) ;; | |
568 | hp300) AC_DEFINE(OBJ_MAYBE_HP300) ;; | |
569 | ieee) AC_DEFINE(OBJ_MAYBE_IEEE) ;; | |
570 | som) AC_DEFINE(OBJ_MAYBE_SOM) ;; | |
571 | vms) AC_DEFINE(OBJ_MAYBE_VMS) ;; | |
572 | esac | |
573 | extra_objects="$extra_objects obj-$fmt.o" | |
574 | done | |
575 | obj_format=multi | |
576 | fi | |
577 | if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then | |
578 | te_file=multi | |
579 | extra_objects="$extra_objects $emfiles" | |
580 | DEFAULT_EMULATION=`set . $emulations ; echo $2` | |
581 | AC_DEFINE(USE_EMULATIONS) | |
582 | fi | |
583 | AC_SUBST(extra_objects) | |
584 | AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS) | |
585 | AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION") | |
586 | ||
bf4bd1fc | 587 | case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in |
318b02b6 KR |
588 | yes-*-coff) need_bfd=yes ;; |
589 | no-*-coff) need_bfd=yes | |
590 | AC_DEFINE(MANY_SEGMENTS) ;; | |
591 | esac | |
592 | ||
69ecc03f | 593 | reject_dev_configs=yes |
8cac6ca6 KR |
594 | |
595 | case ${reject_dev_configs}-${dev} in | |
596 | yes-yes) # Oops. | |
b11fb939 | 597 | AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.) |
8cac6ca6 KR |
598 | ;; |
599 | esac | |
600 | ||
bf4bd1fc | 601 | AC_SUBST(target_cpu_type) |
833c46e1 | 602 | AC_SUBST(obj_format) |
515c7142 | 603 | AC_SUBST(te_file) |
833c46e1 | 604 | AC_SUBST(atof) |
e7757ad0 | 605 | dnl AC_SUBST(emulation) |
833c46e1 | 606 | |
e7757ad0 | 607 | case "${primary_bfd_gas}" in |
b11fb939 KR |
608 | yes) AC_DEFINE(BFD_ASSEMBLER) |
609 | need_bfd=yes ;; | |
4f6f4aa8 KR |
610 | esac |
611 | ||
ae09d880 ILT |
612 | # do we need the opcodes library? |
613 | case "${need_opcodes}" in | |
1c94de4d | 614 | yes) |
e2b4bd2a | 615 | OPCODES_LIB=../opcodes/libopcodes.la |
1c94de4d | 616 | ;; |
ae09d880 | 617 | esac |
ae09d880 | 618 | |
b11fb939 | 619 | case "${need_bfd}" in |
1c94de4d | 620 | yes) |
e2b4bd2a | 621 | BFDLIB=../bfd/libbfd.la |
1c94de4d | 622 | ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h" |
1c94de4d | 623 | ;; |
4f6f4aa8 | 624 | esac |
2e013bb7 | 625 | |
b11fb939 | 626 | AC_SUBST(BFDLIB) |
2e013bb7 ILT |
627 | AC_SUBST(OPCODES_LIB) |
628 | ||
b11fb939 | 629 | AC_SUBST(ALL_OBJ_DEPS) |
4f6f4aa8 | 630 | |
b11fb939 KR |
631 | AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}") |
632 | AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}") | |
633 | AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}") | |
634 | AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}") | |
635 | AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}") | |
636 | ||
b11fb939 | 637 | AC_PROG_CC |
b11fb939 | 638 | |
e2b4bd2a | 639 | AC_PROG_YACC |
b2bb41f6 | 640 | AM_PROG_LEX |
e2b4bd2a | 641 | |
48401fcf TT |
642 | ALL_LINGUAS= |
643 | CY_GNU_GETTEXT | |
644 | ||
e2b4bd2a ILT |
645 | AM_MAINTAINER_MODE |
646 | AM_CYGWIN32 | |
647 | AM_EXEEXT | |
648 | ||
b11fb939 KR |
649 | AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h) |
650 | ||
bf111c9f KR |
651 | # Put this here so that autoconf's "cross-compiling" message doesn't confuse |
652 | # people who are not cross-compiling but are compiling cross-assemblers. | |
653 | AC_MSG_CHECKING(whether compiling a cross-assembler) | |
654 | if test "${host}" = "${target}"; then | |
f2889110 KR |
655 | cross_gas=no |
656 | else | |
bf111c9f KR |
657 | cross_gas=yes |
658 | AC_DEFINE(CROSS_COMPILE) | |
bf111c9f KR |
659 | fi |
660 | AC_MSG_RESULT($cross_gas) | |
661 | ||
b11fb939 KR |
662 | dnl ansidecl.h will deal with const |
663 | dnl AC_CONST | |
664 | AC_FUNC_ALLOCA | |
665 | AC_C_INLINE | |
666 | ||
f2889110 KR |
667 | # VMS doesn't have unlink. |
668 | AC_CHECK_FUNCS(unlink remove, break) | |
28d3e4a3 | 669 | |
e63c594d FF |
670 | # Some systems don't have sbrk(). |
671 | AC_CHECK_FUNCS(sbrk) | |
672 | ||
b11fb939 KR |
673 | # Some non-ANSI preprocessors botch requoting inside strings. That's bad |
674 | # enough, but on some of those systems, the assert macro relies on requoting | |
675 | # working properly! | |
bf111c9f | 676 | GAS_WORKING_ASSERT |
b11fb939 KR |
677 | |
678 | # On some systems, the system header files may not declare malloc, realloc, | |
679 | # and free. There are places where gas needs these functions to have been | |
680 | # declared -- such as when taking their addresses. | |
bf111c9f | 681 | gas_test_headers=" |
b11fb939 KR |
682 | #ifdef HAVE_MEMORY_H |
683 | #include <memory.h> | |
684 | #endif | |
685 | #ifdef HAVE_STRING_H | |
686 | #include <string.h> | |
5cece526 ILT |
687 | #else |
688 | #ifdef HAVE_STRINGS_H | |
689 | #include <strings.h> | |
690 | #endif | |
b11fb939 KR |
691 | #endif |
692 | #ifdef HAVE_STDLIB_H | |
693 | #include <stdlib.h> | |
694 | #endif | |
695 | #ifdef HAVE_UNISTD_H | |
696 | #include <unistd.h> | |
697 | #endif | |
bf111c9f | 698 | " |
5cece526 | 699 | GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers) |
bf111c9f | 700 | GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers) |
5f757edc | 701 | GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers) |
5cece526 | 702 | GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers) |
b11fb939 KR |
703 | |
704 | # Does errno.h declare errno, or do we have to add a separate declaration | |
705 | # for it? | |
bf111c9f | 706 | GAS_CHECK_DECL_NEEDED(errno, f, int f, [ |
b11fb939 KR |
707 | #ifdef HAVE_ERRNO_H |
708 | #include <errno.h> | |
709 | #endif | |
bf111c9f | 710 | ]) |
b11fb939 | 711 | |
b11fb939 | 712 | dnl This must come last. |
515c7142 ILT |
713 | |
714 | dnl We used to make symlinks to files in the source directory, but now | |
715 | dnl we just use the right name for .c files, and create .h files in | |
716 | dnl the build directory which include the right .h file. Make sure | |
717 | dnl the old symlinks don't exist, so that a reconfigure in an existing | |
718 | dnl directory behaves reasonably. | |
719 | ||
48401fcf | 720 | AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in po/Makefile.in:po/Make-in, |
515c7142 ILT |
721 | [rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h |
722 | echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h | |
723 | echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h | |
724 | echo '#include "te-'"${te_file}"'.h"' > targ-env.h | |
39ffbb4d DE |
725 | echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h |
726 | case ${target_cpu_type} in | |
727 | m32r) echo '#include "opcodes/'"${target_cpu_type}"'-opc.h"' > cgen-opc.h ;; | |
48401fcf TT |
728 | esac |
729 | ||
730 | sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile], | |
515c7142 ILT |
731 | [target_cpu_type=${target_cpu_type} |
732 | obj_format=${obj_format} | |
733 | te_file=${te_file}]) |