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