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