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