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