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