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 |
833c46e1 | 7 | AC_PREREQ(2.3)dnl We only need 2.0, but pre-2.3 loses on some AIX version. |
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 | |
29 | yes) shared=true ;; | |
30 | no) shared=false ;; | |
31 | *) AC_MSG_ERROR([bad value ${enableval} for BFD shared option]) ;; | |
32 | esac])dnl | |
b11fb939 KR |
33 | |
34 | # Generate a header file -- gets more post-processing by Makefile later. | |
35 | AC_CONFIG_HEADER(conf) | |
36 | ||
37 | dnl For recursion to work right, this must be an absolute pathname. | |
38 | AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..) | |
39 | AC_CANONICAL_SYSTEM | |
bf111c9f | 40 | AC_ARG_PROGRAM |
7cf4d7ff | 41 | |
e7757ad0 | 42 | te_file=generic |
b678740d | 43 | |
e7757ad0 KR |
44 | canon_targets="" |
45 | if test -n "$enable_targets" ; then | |
46 | for t in `echo $enable_targets | sed 's/,/ /g'`; do | |
47 | result=`$ac_config_sub $t 2>/dev/null` | |
48 | if test -n "$result" ; then | |
49 | canon_targets="$canon_targets $result" | |
50 | # else | |
51 | # # Permit "all", etc. We don't support it yet though. | |
52 | # canon_targets="$canon_targets $t" | |
53 | fi | |
54 | done | |
55 | GAS_UNIQ(canon_targets) | |
56 | fi | |
57 | ||
58 | emulations="" | |
59 | ||
60 | for this_target in $target $canon_targets ; do | |
61 | ||
62 | eval `echo $this_target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'` | |
8cac6ca6 | 63 | |
e7757ad0 KR |
64 | # check for architecture variants |
65 | case ${cpu} in | |
ae09d880 ILT |
66 | armeb) cpu_type=arm endian=big ;; |
67 | arm*) cpu_type=arm endian=little ;; | |
e7757ad0 KR |
68 | hppa*) cpu_type=hppa ;; |
69 | changequote(,)dnl | |
7c2fadd1 | 70 | i[456]86) cpu_type=i386 ;; |
e7757ad0 KR |
71 | m680[012346]0) cpu_type=m68k ;; |
72 | m68008) cpu_type=m68k ;; | |
73 | m683??) cpu_type=m68k ;; | |
74 | changequote([,])dnl | |
75 | m8*) cpu_type=m88k ;; | |
76 | mips*el) cpu_type=mips endian=little;; | |
77 | mips*) cpu_type=mips endian=big ;; | |
78 | powerpcle*) cpu_type=ppc endian=little ;; | |
79 | powerpc*) cpu_type=ppc endian=big ;; | |
80 | rs6000*) cpu_type=ppc ;; | |
6df07e7f | 81 | sparc64) cpu_type=sparc want_sparc_v9=true ;; |
63e4edb5 | 82 | sparc*) cpu_type=sparc ;; |
a1c7c0f3 | 83 | *) cpu_type=${cpu} ;; |
e7757ad0 KR |
84 | esac |
85 | ||
86 | if test ${this_target} = $target ; then | |
87 | target_cpu_type=${cpu_type} | |
88 | elif test ${target_cpu_type} != ${cpu_type} ; then | |
89 | continue | |
90 | fi | |
91 | ||
92 | targ=${cpu_type} | |
93 | generic_target=${cpu_type}-$vendor-$os | |
94 | dev=no | |
95 | bfd_gas=no | |
96 | em=generic | |
7cf4d7ff | 97 | |
e7757ad0 KR |
98 | # assign object format |
99 | case ${generic_target} in | |
805e36ab | 100 | a29k-*-coff) fmt=coff targ=ebmon29k ;; |
e7757ad0 KR |
101 | a29k-amd-udi) fmt=coff targ=ebmon29k ;; |
102 | a29k-amd-ebmon) fmt=coff targ=ebmon29k ;; | |
880b7429 | 103 | a29k-nyu-sym1) fmt=coff targ=ebmon29k ;; |
e7757ad0 KR |
104 | a29k-*-vxworks*) fmt=coff ;; |
105 | ||
106 | alpha-*-netware*) fmt=ecoff ;; | |
107 | alpha-*-osf*) fmt=ecoff ;; | |
d7b2038f | 108 | alpha-*-linux*) fmt=ecoff ;; |
816153a3 | 109 | |
4181c985 | 110 | # start-sanitize-arc |
e7757ad0 | 111 | arc-*-elf*) fmt=elf bfd_gas=yes ;; |
4181c985 KR |
112 | # end-sanitize-arc |
113 | ||
a1c7c0f3 | 114 | arm-*-riscix*) fmt=aout targ=arm-lit ;; |
1cb0d00d KR |
115 | arm-*-aout) fmt=aout |
116 | case "$endian" in | |
117 | big) targ=arm-big ;; | |
118 | *) targ=arm-lit ;; | |
119 | esac | |
120 | ;; | |
d7b2038f | 121 | arm-*-coff) fmt=coff ;; |
e7757ad0 | 122 | arm-*-riscix*) fmt=aout ;; |
1cb0d00d | 123 | arm-*-pe) fmt=coff targ=armcoff em=pe ;; |
e7757ad0 KR |
124 | |
125 | hppa-*-*elf*) fmt=elf em=hppa ;; | |
126 | hppa-*-lites*) fmt=elf em=hppa ;; | |
127 | hppa-*-osf*) fmt=som em=hppa ;; | |
128 | hppa-*-hpux*) fmt=som em=hppa ;; | |
129 | hppa-*-bsd*) fmt=som em=hppa ;; | |
130 | hppa-*-hiux*) fmt=som em=hppa ;; | |
131 | ||
132 | h8300-*-coff) fmt=coff ;; | |
133 | ||
134 | i386-ibm-aix*) fmt=coff targ=i386coff | |
135 | em=i386aix ;; | |
136 | i386-*-bsd*) fmt=aout em=386bsd ;; | |
137 | i386-*-netbsd0.8) fmt=aout em=386bsd ;; | |
138 | i386-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes;; | |
a1c7c0f3 | 139 | i386-*-linux*aout* | i386-*-linuxoldld) fmt=aout em=linux ;; |
e7757ad0 KR |
140 | i386-*-linux*coff*) fmt=coff em=linux |
141 | targ=i386coff ;; | |
142 | i386-*-linux*) fmt=elf em=linux ;; | |
143 | i386-*-lynxos*) fmt=coff targ=i386coff | |
144 | em=lynx ;; | |
145 | i386-*-sysv4* | i386-*-solaris* | i386-*-elf) | |
146 | fmt=elf ;; | |
66b935da | 147 | i386-*-sco*elf*) fmt=elf targ=sco5 ;; |
e7757ad0 KR |
148 | i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*) |
149 | fmt=coff targ=i386coff ;; | |
150 | i386-*-vsta) fmt=aout ;; | |
151 | i386-*-go32) fmt=coff targ=i386coff ;; | |
6c186c48 SC |
152 | i386-*-gnu*) fmt=elf ;; |
153 | i386-*-mach*) | |
e7757ad0 KR |
154 | fmt=aout em=mach bfd_gas=yes ;; |
155 | i386-*-msdos*) fmt=aout ;; | |
6c186c48 | 156 | i386-*-moss*) fmt=elf ;; |
d0352cbb DE |
157 | i386-*-pe) fmt=coff targ=i386coff em=pe ;; |
158 | i386-*-cygwin32) fmt=coff targ=i386coff em=pe ;; | |
159 | i386-*-*nt) fmt=coff targ=i386coff em=pe ;; | |
e7757ad0 KR |
160 | i960-*-bout) fmt=bout ;; |
161 | i960-*-coff) fmt=coff em=ic960 targ=ic960coff ;; | |
162 | i960-*-nindy*) fmt=bout ;; | |
163 | i960-*-vxworks4*) fmt=bout ;; | |
164 | i960-*-vxworks5.0) fmt=bout ;; | |
165 | i960-*-vxworks5.*) fmt=coff em=ic960 targ=ic960coff ;; | |
166 | i960-*-vxworks*) fmt=bout ;; | |
167 | ||
168 | m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*) | |
169 | fmt=aout em=sun3 ;; | |
880b7429 | 170 | m68k-motorola-sysv*) fmt=coff targ=m68kcoff em=delta ;; |
e7757ad0 KR |
171 | m68k-bull-sysv3*) fmt=coff targ=m68kcoff em=dpx2 ;; |
172 | m68k-apollo-*) fmt=coff targ=apollo em=apollo ;; | |
9d5aef80 KR |
173 | m68k-*-sysv4 | m68k-*-elf) # must be before -sysv* |
174 | fmt=elf ;; | |
e7757ad0 KR |
175 | m68k-*-coff | m68k-*-sysv*) |
176 | fmt=coff targ=m68kcoff ;; | |
e7757ad0 | 177 | m68k-*-hpux*) fmt=hp300 em=hp300 ;; |
535cfd0f ILT |
178 | m68k-*-linux*aout*) fmt=aout em=linux ;; |
179 | m68k-*-linux*) fmt=elf em=linux ;; | |
e7757ad0 KR |
180 | m68k-*-lynxos*) fmt=coff targ=m68kcoff |
181 | em=lynx ;; | |
182 | m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; | |
8a6f53e9 ILT |
183 | m68k-apple-aux*) fmt=coff targ=m68kcoff em=aux ;; |
184 | m68k-*-psos*) fmt=elf em=psos;; | |
e7757ad0 | 185 | |
880b7429 | 186 | m88k-motorola-sysv3*) fmt=coff targ=m88kcoff em=delt88 ;; |
e7757ad0 KR |
187 | m88k-*-coff*) fmt=coff targ=m88kcoff ;; |
188 | ||
189 | # don't change em like *-*-bsd does | |
057a4d41 | 190 | mips-dec-netbsd*) fmt=elf targ=mips-lit endian=little ;; |
e7757ad0 KR |
191 | mips-dec-bsd*) fmt=aout targ=mips-lit ;; |
192 | mips-sony-bsd*) fmt=ecoff targ=mips-big ;; | |
193 | mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;; | |
70f4dbce | 194 | mips-*-ultrix*) fmt=ecoff targ=mips-lit endian=little ;; |
e7757ad0 KR |
195 | mips-*-ecoff*) fmt=ecoff |
196 | case "$endian" in | |
197 | big) targ=mips-big ;; | |
198 | *) targ=mips-lit ;; | |
199 | esac | |
200 | ;; | |
201 | mips-*-ecoff*) fmt=ecoff targ=mips-big ;; | |
202 | mips-*-gnu*) fmt=aout | |
203 | case "$endian" in | |
204 | big) targ=mips-big ;; | |
205 | *) targ=mips-lit ;; | |
206 | esac | |
207 | ;; | |
208 | mips-*-irix5*) fmt=elf targ=mips-big ;; | |
209 | mips-*-irix*) fmt=ecoff targ=mips-big ;; | |
210 | mips-*-riscos*) fmt=ecoff targ=mips-big ;; | |
211 | mips-*-sysv*) fmt=ecoff targ=mips-big ;; | |
212 | mips-*-elf*) fmt=elf | |
213 | case "$endian" in | |
214 | big) targ=mips-big ;; | |
215 | *) targ=mips-lit ;; | |
216 | esac | |
217 | ;; | |
0ff513d9 SC |
218 | ppc-*-pe | ppc-*-cygwin32 | ppc-*-winnt*) |
219 | fmt=coff em=pe | |
85cc2190 KK |
220 | case "$endian" in |
221 | big) targ=ppc-big ;; | |
222 | *) targ=ppc-lit ;; | |
223 | esac | |
224 | ;; | |
e7757ad0 KR |
225 | ppc-*-aix*) fmt=coff ;; |
226 | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*) | |
227 | fmt=elf | |
228 | case "$endian" in | |
229 | big) targ=ppc-big ;; | |
230 | *) targ=ppc-lit ;; | |
231 | esac | |
232 | ;; | |
880b7429 KR |
233 | ppc-*-macos* | ppc-*-mpw*) |
234 | fmt=coff em=macos ;; | |
e7757ad0 KR |
235 | ppc-*-netware*) fmt=elf em=ppcnw ;; |
236 | ||
237 | sh-*-coff) fmt=coff ;; | |
816153a3 | 238 | |
03c4ce2f | 239 | # start-sanitize-rce |
e7757ad0 | 240 | rce-*-aout) fmt=aout ;; |
03c4ce2f | 241 | # end-sanitize-rce |
d94aca1a | 242 | |
5f757edc ILT |
243 | ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;; |
244 | ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;; | |
e7757ad0 KR |
245 | |
246 | sparc-*-sunos4*) fmt=aout em=sun3 ;; | |
247 | sparc-*-aout | sparc*-*-vxworks) | |
248 | fmt=aout ;; | |
249 | sparc-*-coff) fmt=coff ;; | |
250 | sparc-*-lynxos*) fmt=coff em=lynx ;; | |
251 | sparc-fujitsu-none) fmt=aout ;; | |
d0352cbb | 252 | sparc-*-elf | sparc-*-solaris*) |
e7757ad0 KR |
253 | fmt=elf ;; |
254 | sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; | |
255 | ||
256 | vax-*-bsd* | vax-*-ultrix*) | |
257 | fmt=aout ;; | |
258 | vax-*-vms) fmt=vms ;; | |
259 | ||
260 | z8k-*-coff | z8k-*-sim) | |
261 | fmt=coff ;; | |
262 | ||
263 | w65-*-*) fmt=coff ;; | |
264 | ||
265 | *-*-aout | *-*-scout) | |
266 | fmt=aout ;; | |
267 | *-*-nindy*) | |
268 | fmt=bout ;; | |
269 | *-*-bsd*) | |
270 | fmt=aout em=sun3 ;; | |
271 | *-*-generic) fmt=generic ;; | |
272 | *-*-xray | *-*-hms) fmt=coff ;; | |
273 | *-*-sim) fmt=coff ;; | |
274 | *-*-elf | *-*-sysv4* | *-*-solaris*) | |
6df07e7f | 275 | AC_MSG_WARN(GAS support for ${generic_target} is incomplete.) |
e7757ad0 KR |
276 | fmt=elf dev=yes ;; |
277 | *-*-vxworks) fmt=aout ;; | |
278 | *-*-netware) fmt=elf ;; | |
279 | esac | |
280 | ||
281 | case ${cpu_type}-${fmt} in | |
282 | arm-*) bfd_gas=yes ;; | |
283 | # not yet | |
284 | # i386-aout) bfd_gas=preferred ;; | |
285 | mips-*) bfd_gas=yes ;; | |
286 | ns32k-*) bfd_gas=yes ;; | |
287 | ppc-*) bfd_gas=yes ;; | |
288 | sparc-*) bfd_gas=yes ;; | |
289 | *-elf) bfd_gas=yes ;; | |
290 | *-ecoff) bfd_gas=yes ;; | |
291 | *-som) bfd_gas=yes ;; | |
292 | *) ;; | |
293 | esac | |
294 | ||
5f757edc ILT |
295 | # Other random stuff. |
296 | ||
ae09d880 ILT |
297 | # do we need the opcodes library? |
298 | case ${cpu_type} in | |
7c2fadd1 ILT |
299 | alpha | vax | i386) |
300 | ;; | |
301 | *) | |
302 | need_opcodes=yes | |
303 | if test "${shared}" = "true"; then | |
304 | # A shared libopcodes must be linked against libbfd. | |
305 | need_bfd=yes | |
306 | fi | |
307 | ;; | |
ae09d880 ILT |
308 | esac |
309 | ||
6df07e7f DE |
310 | test -n "$want_sparc_v9" && AC_DEFINE(SPARC_V9) |
311 | ||
312 | case ${cpu}-${vendor}-${os} in | |
313 | sparc64-*-elf*) AC_DEFINE(SPARC_ARCH64) ;; | |
314 | esac | |
5f757edc ILT |
315 | |
316 | case ${cpu_type} in | |
1c9dbb83 ILT |
317 | m68k) |
318 | case ${extra_objects} in | |
319 | *m68k-parse.o*) ;; | |
320 | *) extra_objects="$extra_objects m68k-parse.o" ;; | |
321 | esac | |
322 | ;; | |
5f757edc ILT |
323 | esac |
324 | ||
e7757ad0 KR |
325 | # See if we really can support this configuration with the emulation code. |
326 | ||
327 | if test $this_target = $target ; then | |
328 | primary_bfd_gas=$bfd_gas | |
329 | obj_format=$fmt | |
330 | gas_target=$targ | |
331 | te_file=$em | |
332 | ||
333 | if test $bfd_gas = no ; then | |
334 | # Can't support other configurations this way. | |
335 | break | |
336 | fi | |
337 | elif test $bfd_gas = no ; then | |
338 | # Can't support this configuration. | |
339 | break | |
340 | fi | |
341 | ||
342 | # From target name and format, produce a list of supported emulations. | |
343 | ||
344 | case ${generic_target}-${fmt} in | |
1cb0d00d | 345 | mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; |
e7757ad0 | 346 | mips-*-*-ecoff) case "$endian" in |
1cb0d00d KR |
347 | big) emulation="mipsbecoff mipslecoff mipsecoff" ;; |
348 | *) emulation="mipslecoff mipsbecoff mipsecoff" ;; | |
e7757ad0 KR |
349 | esac ;; |
350 | mips-*-*-elf) case "$endian" in | |
1cb0d00d KR |
351 | big) emulation="mipsbelf mipslelf mipself" ;; |
352 | *) emulation="mipslelf mipsbelf mipself" ;; | |
e7757ad0 KR |
353 | esac ;; |
354 | esac | |
355 | ||
356 | emulations="$emulations $emulation" | |
357 | ||
e7757ad0 | 358 | done |
fecd2382 | 359 | |
8cac6ca6 KR |
360 | # Assign floating point type. Most processors with FP support |
361 | # IEEE FP. On those that don't support FP at all, usually IEEE | |
362 | # is emulated. | |
b678740d | 363 | case ${target_cpu} in |
904b6037 | 364 | vax | tahoe ) atof=${target_cpu} ;; |
e7757ad0 | 365 | *) atof=ieee ;; |
fecd2382 RP |
366 | esac |
367 | ||
8cac6ca6 | 368 | case "${obj_format}" in |
b11fb939 | 369 | "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;; |
8cac6ca6 | 370 | esac |
7cf4d7ff | 371 | |
b11fb939 KR |
372 | dnl |
373 | dnl Make sure the desired support files exist. | |
374 | dnl | |
375 | ||
bf4bd1fc ILT |
376 | if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then |
377 | AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type}) | |
b11fb939 KR |
378 | fi |
379 | ||
fb589130 | 380 | if test ! -r ${srcdir}/config/obj-${obj_format}.c; then |
b11fb939 | 381 | AC_MSG_ERROR(GAS does not have support for object file format ${obj_format}) |
7cf4d7ff KR |
382 | fi |
383 | ||
8a24a37c SC |
384 | # and target makefile frag |
385 | ||
b11fb939 | 386 | target_frag=${srcdir}/config/${gas_target}.mt |
f2889110 KR |
387 | if test ! -r ${target_frag}; then |
388 | target_frag=/dev/null # ick! but subst_file can't be conditionalized | |
389 | fi | |
b11fb939 | 390 | AC_SUBST_FILE(target_frag) |
8a24a37c | 391 | |
e7757ad0 | 392 | case ${user_bfd_gas}-${primary_bfd_gas} in |
a8285504 | 393 | yes-yes | no-no) |
7cf4d7ff KR |
394 | # We didn't override user's choice. |
395 | ;; | |
a8285504 | 396 | no-yes) |
b11fb939 | 397 | AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.) |
7cf4d7ff | 398 | ;; |
a8285504 | 399 | no-preferred) |
e7757ad0 | 400 | primary_bfd_gas=no |
a8285504 DZ |
401 | ;; |
402 | *-preferred) | |
e7757ad0 | 403 | primary_bfd_gas=yes |
a8285504 | 404 | ;; |
f2889110 | 405 | yes-*) |
e7757ad0 | 406 | primary_bfd_gas=yes |
f2889110 | 407 | ;; |
a8285504 DZ |
408 | -*) |
409 | # User specified nothing. | |
410 | ;; | |
7cf4d7ff KR |
411 | esac |
412 | ||
e7757ad0 KR |
413 | # Some COFF configurations want these random other flags set. |
414 | case ${obj_format} in | |
415 | coff) | |
416 | case ${target_cpu_type} in | |
417 | i386) AC_DEFINE(I386COFF) ;; | |
418 | m68k) AC_DEFINE(M68KCOFF) ;; | |
419 | m88k) AC_DEFINE(M88KCOFF) ;; | |
420 | esac | |
421 | ;; | |
422 | esac | |
423 | ||
424 | # Getting this done right is going to be a bitch. Each configuration specified | |
425 | # with --enable-targets=... should be checked for environment, format, cpu, and | |
426 | # bfd_gas setting. | |
427 | # | |
428 | # For each configuration, the necessary object file support code must be linked | |
429 | # in. This might be only one, it might be up to four. The necessary emulation | |
430 | # code needs to be provided, too. | |
431 | # | |
432 | # And then there's "--enable-targets=all".... | |
433 | # | |
434 | # For now, just always do it for MIPS ELF or ECOFF configurations. Sigh. | |
435 | ||
436 | formats="${obj_format}" | |
437 | emfiles="" | |
438 | EMULATIONS="" | |
439 | GAS_UNIQ(emulations) | |
440 | for em in . $emulations ; do | |
441 | case $em in | |
442 | .) continue ;; | |
443 | mipsbelf | mipslelf) | |
444 | fmt=elf file=mipself ;; | |
445 | mipsbecoff | mipslecoff) | |
446 | fmt=ecoff file=mipsecoff ;; | |
447 | esac | |
448 | formats="$formats $fmt" | |
449 | emfiles="$emfiles e-$file.o" | |
450 | EMULATIONS="$EMULATIONS &$em," | |
451 | done | |
452 | GAS_UNIQ(formats) | |
453 | GAS_UNIQ(emfiles) | |
454 | if test `set . $formats ; shift ; echo $#` -gt 1 ; then | |
455 | for fmt in $formats ; do | |
456 | case $fmt in | |
457 | aout) AC_DEFINE(OBJ_MAYBE_AOUT) ;; | |
458 | bout) AC_DEFINE(OBJ_MAYBE_BOUT) ;; | |
459 | coff) AC_DEFINE(OBJ_MAYBE_COFF) ;; | |
460 | ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF) ;; | |
461 | elf) AC_DEFINE(OBJ_MAYBE_ELF) ;; | |
462 | generic) AC_DEFINE(OBJ_MAYBE_GENERIC) ;; | |
463 | hp300) AC_DEFINE(OBJ_MAYBE_HP300) ;; | |
464 | ieee) AC_DEFINE(OBJ_MAYBE_IEEE) ;; | |
465 | som) AC_DEFINE(OBJ_MAYBE_SOM) ;; | |
466 | vms) AC_DEFINE(OBJ_MAYBE_VMS) ;; | |
467 | esac | |
468 | extra_objects="$extra_objects obj-$fmt.o" | |
469 | done | |
470 | obj_format=multi | |
471 | fi | |
472 | if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then | |
473 | te_file=multi | |
474 | extra_objects="$extra_objects $emfiles" | |
475 | DEFAULT_EMULATION=`set . $emulations ; echo $2` | |
476 | AC_DEFINE(USE_EMULATIONS) | |
477 | fi | |
478 | AC_SUBST(extra_objects) | |
479 | AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS) | |
480 | AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION") | |
481 | ||
bf4bd1fc | 482 | files="config/tc-${target_cpu_type}.c config/tc-${target_cpu_type}.h \ |
e7757ad0 KR |
483 | config/obj-${obj_format}.h config/obj-${obj_format}.c \ |
484 | config/te-${te_file}.h config/atof-${atof}.c \ | |
485 | $extra_files" | |
486 | links="targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c \ | |
487 | $extra_links" | |
488 | ||
bf4bd1fc | 489 | case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in |
318b02b6 KR |
490 | yes-*-coff) need_bfd=yes ;; |
491 | no-*-coff) need_bfd=yes | |
492 | AC_DEFINE(MANY_SEGMENTS) ;; | |
493 | esac | |
494 | ||
69ecc03f | 495 | reject_dev_configs=yes |
8cac6ca6 KR |
496 | |
497 | case ${reject_dev_configs}-${dev} in | |
498 | yes-yes) # Oops. | |
b11fb939 | 499 | AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.) |
8cac6ca6 KR |
500 | ;; |
501 | esac | |
502 | ||
bf4bd1fc | 503 | AC_SUBST(target_cpu_type) |
833c46e1 KR |
504 | AC_SUBST(obj_format) |
505 | AC_SUBST(atof) | |
e7757ad0 | 506 | dnl AC_SUBST(emulation) |
833c46e1 | 507 | |
e7757ad0 | 508 | AC_LINK_FILES($files, $links) |
8b228fe9 | 509 | |
e7757ad0 | 510 | case "${primary_bfd_gas}" in |
b11fb939 KR |
511 | yes) AC_DEFINE(BFD_ASSEMBLER) |
512 | need_bfd=yes ;; | |
4f6f4aa8 KR |
513 | esac |
514 | ||
ae09d880 ILT |
515 | # do we need the opcodes library? |
516 | case "${need_opcodes}" in | |
517 | yes) | |
518 | OPCODES_DEP=../opcodes/libopcodes.a | |
519 | OPCODES_LIB='-L../opcodes -lopcodes' | |
520 | ||
521 | # We need to handle some special cases if opcodes was built shared. | |
522 | if test "${shared}" = "true"; then | |
523 | case "${host}" in | |
524 | *-*-sunos*) | |
525 | # On SunOS, we must link against the name we are going to install, | |
526 | # not -lbfd, since SunOS does not support SONAME. | |
527 | OPCODES_LIB='-L../opcodes -l`echo opcodes | sed '"'"'$(program_transform_name)'"'"'`' | |
528 | ;; | |
529 | esac | |
530 | fi | |
531 | ;; | |
532 | esac | |
533 | AC_SUBST(OPCODES_DEP) | |
534 | AC_SUBST(OPCODES_LIB) | |
535 | ||
b11fb939 | 536 | case "${need_bfd}" in |
ae09d880 ILT |
537 | yes) |
538 | BFDDEP=../bfd/libbfd.a | |
539 | BFDLIB='-L../bfd -lbfd' | |
540 | ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h" | |
541 | ||
542 | # We need to handle some special cases if BFD was built shared. | |
543 | if test "${shared}" = "true"; then | |
544 | case "${host}" in | |
545 | *-*-sunos*) | |
546 | # On SunOS, we must link against the name we are going to install, | |
547 | # not -lbfd, since SunOS does not support SONAME. | |
548 | BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`' | |
c92d9ee9 | 549 | ;; |
ae09d880 ILT |
550 | esac |
551 | fi | |
552 | ;; | |
4f6f4aa8 | 553 | esac |
1c9dbb83 | 554 | AC_SUBST(BFDDEP) |
b11fb939 KR |
555 | AC_SUBST(BFDLIB) |
556 | AC_SUBST(ALL_OBJ_DEPS) | |
4f6f4aa8 | 557 | |
b11fb939 KR |
558 | AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}") |
559 | AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}") | |
560 | AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}") | |
561 | AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}") | |
562 | AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}") | |
563 | ||
b11fb939 KR |
564 | AC_PROG_CC |
565 | AC_PROG_INSTALL | |
566 | ||
b11fb939 KR |
567 | AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h) |
568 | ||
bf111c9f KR |
569 | # Put this here so that autoconf's "cross-compiling" message doesn't confuse |
570 | # people who are not cross-compiling but are compiling cross-assemblers. | |
571 | AC_MSG_CHECKING(whether compiling a cross-assembler) | |
572 | if test "${host}" = "${target}"; then | |
f2889110 KR |
573 | cross_gas=no |
574 | else | |
bf111c9f KR |
575 | cross_gas=yes |
576 | AC_DEFINE(CROSS_COMPILE) | |
bf111c9f KR |
577 | fi |
578 | AC_MSG_RESULT($cross_gas) | |
579 | ||
b11fb939 KR |
580 | dnl ansidecl.h will deal with const |
581 | dnl AC_CONST | |
582 | AC_FUNC_ALLOCA | |
583 | AC_C_INLINE | |
584 | ||
f2889110 KR |
585 | # VMS doesn't have unlink. |
586 | AC_CHECK_FUNCS(unlink remove, break) | |
28d3e4a3 | 587 | |
e63c594d FF |
588 | # Some systems don't have sbrk(). |
589 | AC_CHECK_FUNCS(sbrk) | |
590 | ||
b11fb939 KR |
591 | # Some non-ANSI preprocessors botch requoting inside strings. That's bad |
592 | # enough, but on some of those systems, the assert macro relies on requoting | |
593 | # working properly! | |
bf111c9f | 594 | GAS_WORKING_ASSERT |
b11fb939 KR |
595 | |
596 | # On some systems, the system header files may not declare malloc, realloc, | |
597 | # and free. There are places where gas needs these functions to have been | |
598 | # declared -- such as when taking their addresses. | |
bf111c9f | 599 | gas_test_headers=" |
b11fb939 KR |
600 | #ifdef HAVE_MEMORY_H |
601 | #include <memory.h> | |
602 | #endif | |
603 | #ifdef HAVE_STRING_H | |
604 | #include <string.h> | |
605 | #endif | |
606 | #ifdef HAVE_STDLIB_H | |
607 | #include <stdlib.h> | |
608 | #endif | |
609 | #ifdef HAVE_UNISTD_H | |
610 | #include <unistd.h> | |
611 | #endif | |
bf111c9f KR |
612 | " |
613 | GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers) | |
5f757edc | 614 | GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers) |
b11fb939 KR |
615 | |
616 | # Does errno.h declare errno, or do we have to add a separate declaration | |
617 | # for it? | |
bf111c9f | 618 | GAS_CHECK_DECL_NEEDED(errno, f, int f, [ |
b11fb939 KR |
619 | #ifdef HAVE_ERRNO_H |
620 | #include <errno.h> | |
621 | #endif | |
bf111c9f | 622 | ]) |
b11fb939 | 623 | |
1c9dbb83 | 624 | HLDFLAGS= |
1a2f3c3f | 625 | RPATH_ENVVAR=LD_LIBRARY_PATH |
1c9dbb83 ILT |
626 | # If we have shared libraries, try to set rpath reasonably. |
627 | if test "${shared}" = "true"; then | |
628 | case "${host}" in | |
56f9773f ILT |
629 | *-*-hpux*) |
630 | HLDFLAGS='-Wl,+s,+b,$(libdir)' | |
1a2f3c3f | 631 | RPATH_ENVVAR=SHLIB_PATH |
56f9773f | 632 | ;; |
1c9dbb83 ILT |
633 | *-*-irix5*) |
634 | HLDFLAGS='-Wl,-rpath,$(libdir)' | |
635 | ;; | |
636 | *-*-linux*aout*) | |
637 | ;; | |
638 | *-*-linux*) | |
639 | HLDFLAGS='-Wl,-rpath,$(libdir)' | |
640 | ;; | |
641 | *-*-sysv4* | *-*-solaris*) | |
642 | HLDFLAGS='-R $(libdir)' | |
643 | ;; | |
644 | esac | |
645 | fi | |
646 | ||
647 | # On SunOS, if the linker supports the -rpath option, use it to | |
648 | # prevent ../bfd and ../opcodes from being included in the run time | |
649 | # search path. | |
650 | case "${host}" in | |
651 | *-*-sunos*) | |
652 | echo 'main () { }' > conftest.c | |
653 | ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t | |
654 | if grep 'unrecognized' conftest.t >/dev/null 2>&1; then | |
655 | : | |
656 | elif grep 'No such file' conftest.t >/dev/null 2>&1; then | |
657 | : | |
7925f4d4 ILT |
658 | elif grep 'do not mix' conftest.t >/dev/null 2>&1; then |
659 | : | |
1c9dbb83 ILT |
660 | elif test "${shared}" = "true"; then |
661 | HLDFLAGS='-Wl,-rpath=$(libdir)' | |
662 | else | |
663 | HLDFLAGS='-Wl,-rpath=' | |
664 | fi | |
665 | rm -f conftest.t conftest.c conftest | |
666 | ;; | |
667 | esac | |
668 | AC_SUBST(HLDFLAGS) | |
1a2f3c3f | 669 | AC_SUBST(RPATH_ENVVAR) |
1c9dbb83 | 670 | |
b11fb939 | 671 | dnl This must come last. |
28d3e4a3 | 672 | AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in) |