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