x
[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
e2b4bd2a
ILT
7dnl v2.5 needed for --bindir et al
8AC_PREREQ(2.5)
9AC_INIT(as.h)
10
11AC_CANONICAL_SYSTEM
12
13AM_INIT_AUTOMAKE(gas, 2.8.2)
14
15AM_PROG_LIBTOOL
16
318b02b6 17user_bfd_gas=
b11fb939 18AC_ARG_ENABLE(bfd-assembler,
d7b2038f 19[ --enable-bfd-assembler use BFD back end for writing object files],
b11fb939 20[case "${enableval}" in
318b02b6
KR
21 yes) need_bfd=yes user_bfd_gas=yes ;;
22 no) user_bfd_gas=no ;;
b11fb939
KR
23 *) AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;;
24esac])dnl
e7757ad0
KR
25AC_ARG_ENABLE(targets,
26[ targets alternative target configurations besides the primary],
27[case "${enableval}" in
28 yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
29 ;;
30 no) enable_targets= ;;
31 *) enable_targets=$enableval ;;
32esac])dnl
2e013bb7
ILT
33AC_ARG_ENABLE(commonbfdlib,
34[ --enable-commonbfdlib build shared BFD/opcodes/libiberty library],
35[case "${enableval}" in
36 yes) commonbfdlib=true ;;
37 no) commonbfdlib=false ;;
38 *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
39esac])dnl
b11fb939 40
e2b4bd2a
ILT
41# Generate a header file
42AM_CONFIG_HEADER(config.h:config.in)
7cf4d7ff 43
e7757ad0 44te_file=generic
b678740d 45
e7757ad0
KR
46canon_targets=""
47if test -n "$enable_targets" ; then
48 for t in `echo $enable_targets | sed 's/,/ /g'`; do
ec2f730d 49 result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $t 2>/dev/null`
e7757ad0
KR
50 if test -n "$result" ; then
51 canon_targets="$canon_targets $result"
52# else
53# # Permit "all", etc. We don't support it yet though.
54# canon_targets="$canon_targets $t"
55 fi
56 done
57 GAS_UNIQ(canon_targets)
58fi
59
60emulations=""
61
62for this_target in $target $canon_targets ; do
63
64556643
FF
64changequote(,)dnl
65 eval `echo $this_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'`
66changequote([,])dnl
8cac6ca6 67
e7757ad0 68 # check for architecture variants
2b09622a 69 arch=
6ff87ead 70 endian=
e7757ad0 71 case ${cpu} in
0170f1c3 72 alpha*) cpu_type=alpha ;;
ae09d880
ILT
73 armeb) cpu_type=arm endian=big ;;
74 arm*) cpu_type=arm endian=little ;;
76fb6d2f 75 thumb*) cpu_type=arm endian=little ;;
e7757ad0
KR
76 hppa*) cpu_type=hppa ;;
77changequote(,)dnl
7c2fadd1 78 i[456]86) cpu_type=i386 ;;
e7757ad0
KR
79 m680[012346]0) cpu_type=m68k ;;
80 m68008) cpu_type=m68k ;;
81 m683??) cpu_type=m68k ;;
82changequote([,])dnl
83 m8*) cpu_type=m88k ;;
e16b9537 84 mips*el) cpu_type=mips endian=little ;;
01c655cc 85# start-sanitize-r5900
9587640a 86 mips*5900*) cpu_type=mips endian=little ;;
01c655cc 87# end-sanitize-r5900
e7757ad0
KR
88 mips*) cpu_type=mips endian=big ;;
89 powerpcle*) cpu_type=ppc endian=little ;;
90 powerpc*) cpu_type=ppc endian=big ;;
91 rs6000*) cpu_type=ppc ;;
2b09622a
DE
92 sparclite*) cpu_type=sparc arch=sparclite ;;
93 sparclet*) cpu_type=sparc arch=sparclet ;;
70ee7782 94 sparc64*) cpu_type=sparc arch=v9-64 ;;
2b09622a 95 sparc*) cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
756adc97 96 v850*) cpu_type=v850 ;;
a1c7c0f3 97 *) cpu_type=${cpu} ;;
e7757ad0
KR
98 esac
99
100 if test ${this_target} = $target ; then
101 target_cpu_type=${cpu_type}
6ff87ead
NC
102 if test x${endian} = xbig; then
103 AC_DEFINE(TARGET_BYTES_BIG_ENDIAN, 1)
104 elif test x${endian} = xlittle; then
105 AC_DEFINE(TARGET_BYTES_BIG_ENDIAN, 0)
106 fi
e7757ad0
KR
107 elif test ${target_cpu_type} != ${cpu_type} ; then
108 continue
109 fi
110
e7757ad0
KR
111 generic_target=${cpu_type}-$vendor-$os
112 dev=no
113 bfd_gas=no
114 em=generic
7cf4d7ff 115
e7757ad0
KR
116 # assign object format
117 case ${generic_target} in
6ff87ead
NC
118 a29k-*-coff) fmt=coff ;;
119 a29k-amd-udi) fmt=coff ;;
120 a29k-amd-ebmon) fmt=coff ;;
121 a29k-nyu-sym1) fmt=coff ;;
e7757ad0
KR
122 a29k-*-vxworks*) fmt=coff ;;
123
0170f1c3
RH
124 alpha*-*-*vms*) fmt=evax ;;
125 alpha*-*-netware*) fmt=ecoff ;;
126 alpha*-*-openbsd*) fmt=ecoff ;;
127 alpha*-*-osf*) fmt=ecoff ;;
128 alpha*-*-linuxecoff*) fmt=ecoff ;;
22d3fbd6
NC
129 alpha*-*-linux-gnu*) fmt=elf em=linux ;;
130 alpha*-*-netbsd*) fmt=elf em=nbsd ;;
816153a3 131
e7757ad0 132 arc-*-elf*) fmt=elf bfd_gas=yes ;;
4181c985 133
6ff87ead
NC
134 arm-*-riscix*) fmt=aout em=riscix ;;
135 arm-*-aout) fmt=aout ;;
76fb6d2f 136 arm-*-coff | thumb-*-coff) fmt=coff ;;
e7757ad0 137 arm-*-riscix*) fmt=aout ;;
22d3fbd6 138 arm-*-pe | thumb-*-pe) fmt=coff 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 ;;
332d5c49 148 hppa-*-rtems*) fmt=elf em=hppa ;;
e7757ad0
KR
149 hppa-*-hpux*) fmt=som em=hppa ;;
150 hppa-*-bsd*) fmt=som em=hppa ;;
151 hppa-*-hiux*) fmt=som em=hppa ;;
152
153 h8300-*-coff) fmt=coff ;;
154
6ff87ead 155 i386-ibm-aix*) fmt=coff 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;;
76fb6d2f 160 i386-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes;;
a1c7c0f3 161 i386-*-linux*aout* | i386-*-linuxoldld) fmt=aout em=linux ;;
6ff87ead 162 i386-*-linux*coff*) fmt=coff em=linux ;;
22d3fbd6 163 i386-*-linux-gnu*) fmt=elf em=linux ;;
6ff87ead 164 i386-*-lynxos*) fmt=coff em=lynx ;;
15ddb4c9 165 i386-*-sysv4* | i386-*-solaris* | i386-*-elf)
e7757ad0 166 fmt=elf ;;
15ddb4c9
AC
167 i386-*-freebsdelf*) fmt=elf ;;
168 i386-*-freebsd*) fmt=aout em=386bsd ;;
6cc7a938
ILT
169 i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*)
170 fmt=coff ;;
171 i386-*-sco3.2v5*) fmt=elf
6ff87ead
NC
172 if test ${this_target} = $target; then
173 AC_DEFINE(SCO_ELF)
174 fi
175 ;;
6cc7a938 176 i386-*-sco3.2*) fmt=coff ;;
e7757ad0 177 i386-*-vsta) fmt=aout ;;
60dc9fb2 178 i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*)
6ff87ead
NC
179 fmt=coff em=go32;;
180 i386-*-rtems*) fmt=coff ;;
6c186c48
SC
181 i386-*-gnu*) fmt=elf ;;
182 i386-*-mach*)
e7757ad0
KR
183 fmt=aout em=mach bfd_gas=yes ;;
184 i386-*-msdos*) fmt=aout ;;
6c186c48 185 i386-*-moss*) fmt=elf ;;
6ff87ead 186 i386-*-pe) fmt=coff em=pe ;;
0040c1e9
ILT
187 i386-*-cygwin32*) fmt=coff em=pe bfd_gas=yes ;;
188 i386-*-mingw32*) fmt=coff em=pe bfd_gas=yes ;;
189 i386-*-*nt*) fmt=coff em=pe ;;
e7757ad0 190 i960-*-bout) fmt=bout ;;
6ff87ead
NC
191 i960-*-coff) fmt=coff em=ic960 ;;
192 i960-*-rtems*) fmt=coff em=ic960 ;;
e7757ad0
KR
193 i960-*-nindy*) fmt=bout ;;
194 i960-*-vxworks4*) fmt=bout ;;
195 i960-*-vxworks5.0) fmt=bout ;;
6ff87ead 196 i960-*-vxworks5.*) fmt=coff em=ic960 ;;
e7757ad0
KR
197 i960-*-vxworks*) fmt=bout ;;
198
374bdac7
DE
199 m32r-*-*) fmt=elf bfd_gas=yes ;;
200
e7757ad0
KR
201 m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
202 fmt=aout em=sun3 ;;
6ff87ead
NC
203 m68k-motorola-sysv*) fmt=coff em=delta ;;
204 m68k-bull-sysv3*) fmt=coff em=dpx2 ;;
205 m68k-apollo-*) fmt=coff em=apollo ;;
fee3e248
ILT
206 m68k-*-sysv4*) # must be before -sysv*
207 fmt=elf em=svr4 ;;
208 m68k-*-elf*) fmt=elf ;;
1c94de4d 209 m68k-*-coff | m68k-*-sysv* | m68k-*-rtems*)
6ff87ead 210 fmt=coff ;;
e7757ad0 211 m68k-*-hpux*) fmt=hp300 em=hp300 ;;
535cfd0f 212 m68k-*-linux*aout*) fmt=aout em=linux ;;
22d3fbd6 213 m68k-*-linux-gnu*) fmt=elf em=linux ;;
6ff87ead 214 m68k-*-lynxos*) fmt=coff em=lynx ;;
e7757ad0 215 m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
76fb6d2f 216 m68k-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
6ff87ead 217 m68k-apple-aux*) fmt=coff em=aux ;;
8a6f53e9 218 m68k-*-psos*) fmt=elf em=psos;;
e7757ad0 219
6ff87ead
NC
220 m88k-motorola-sysv3*) fmt=coff em=delt88 ;;
221 m88k-*-coff*) fmt=coff ;;
e7757ad0
KR
222
223 # don't change em like *-*-bsd does
6ff87ead
NC
224 mips-dec-netbsd*) fmt=elf endian=little ;;
225 mips-dec-openbsd*) fmt=elf endian=little ;;
226 mips-dec-bsd*) fmt=aout ;;
227 mips-sony-bsd*) fmt=ecoff ;;
e7757ad0 228 mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
6ff87ead
NC
229 mips-*-ultrix*) fmt=ecoff endian=little ;;
230 mips-*-osf*) fmt=ecoff endian=little ;;
231 mips-*-ecoff*) fmt=ecoff ;;
232 mips-*-ecoff*) fmt=ecoff ;;
233 mips-*-irix6*) fmt=elf ;;
234 mips-*-irix5*) fmt=elf ;;
235 mips-*-irix*) fmt=ecoff ;;
236 mips-*-lnews*) fmt=ecoff em=lnews ;;
237 mips-*-riscos*) fmt=ecoff ;;
238 mips-*-sysv*) fmt=ecoff ;;
22d3fbd6 239 mips-*-elf* | mips-*-rtems* | mips-*-linux-gnu* | mips-*-gnu* | mips-*-openbsd*)
6ff87ead 240 fmt=elf ;;
ae1b99e4
JL
241 mn10200-*-*) fmt=elf bfd_gas=yes ;;
242 mn10300-*-*) fmt=elf bfd_gas=yes ;;
0ff513d9 243 ppc-*-pe | ppc-*-cygwin32 | ppc-*-winnt*)
6ff87ead 244 fmt=coff em=pe ;;
e7757ad0 245 ppc-*-aix*) fmt=coff ;;
515c7142 246 ppc-*-beos*) fmt=coff ;;
76fb6d2f 247 ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
6ff87ead 248 fmt=elf ;;
22d3fbd6 249 ppc-*-linux-gnu*) fmt=elf
159e6ef8 250 case "$endian" in
6ff87ead 251 big) ;;
22d3fbd6 252 *) AC_MSG_ERROR(GNU/Linux must be configured big endian) ;;
159e6ef8
MM
253 esac
254 ;;
255 ppc-*-solaris*) fmt=elf
6ff87ead
NC
256 if test ${this_target} = $target; then
257 AC_DEFINE(TARGET_SOLARIS_COMMENT)
258 fi
259 if test x${endian} = xbig; then
260 AC_MSG_ERROR(Solaris must be configured little endian)
261 fi
1c94de4d 262 ;;
6ff87ead 263 ppc-*-rtems*) fmt=elf ;;
880b7429
KR
264 ppc-*-macos* | ppc-*-mpw*)
265 fmt=coff em=macos ;;
e7757ad0
KR
266 ppc-*-netware*) fmt=elf em=ppcnw ;;
267
fed13a5e
ILT
268 sh-*-elf*) fmt=elf ;;
269 sh-*-coff*) fmt=coff ;;
5e4e4739 270 sh-*-rtems*) fmt=elf ;;
816153a3 271
5f757edc
ILT
272 ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;;
273 ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;;
76fb6d2f 274 ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;
e7757ad0 275
1c94de4d 276 sparc-*-rtems*) fmt=aout ;;
e7757ad0 277 sparc-*-sunos4*) fmt=aout em=sun3 ;;
df586de2 278 sparc-*-aout | sparc*-*-vxworks*)
fed13a5e 279 fmt=aout em=sparcaout ;;
e7757ad0 280 sparc-*-coff) fmt=coff ;;
2e013bb7 281 sparc-*-linux*aout*) fmt=aout em=linux ;;
22d3fbd6 282 sparc-*-linux-gnu*) fmt=elf em=linux ;;
e7757ad0
KR
283 sparc-*-lynxos*) fmt=coff em=lynx ;;
284 sparc-fujitsu-none) fmt=aout ;;
0b27ea39 285 sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*)
e7757ad0
KR
286 fmt=elf ;;
287 sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
76fb6d2f 288 sparc-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
c6aa56bc 289
0e034c77
ILT
290 tic30-*-*aout*) fmt=aout bfd_gas=yes ;;
291 tic30-*-*coff*) fmt=coff bfd_gas=yes ;;
64556643 292# start-sanitize-tic80
6ff87ead 293 tic80-*-*) fmt=coff ;;
64556643 294# end-sanitize-tic80
103dd764
DE
295
296# start-sanitize-sky
98b155a2 297 dvp-*-*) fmt=elf bfd_gas=yes ;;
103dd764
DE
298# end-sanitize-sky
299
c6aa56bc 300 v850-*-*) fmt=elf bfd_gas=yes ;;
e7757ad0 301
6ff87ead
NC
302# start-sanitize-v850e
303 v850e-*-*) fmt=elf bfd_gas=yes ;;
60dc9fb2 304 v850ea-*-*) fmt=elf bfd_gas=yes ;;
5e4e4739 305# end-sanitize-v850e
e7757ad0
KR
306 vax-*-bsd* | vax-*-ultrix*)
307 fmt=aout ;;
308 vax-*-vms) fmt=vms ;;
309
310 z8k-*-coff | z8k-*-sim)
311 fmt=coff ;;
312
313 w65-*-*) fmt=coff ;;
314
315 *-*-aout | *-*-scout)
316 fmt=aout ;;
317 *-*-nindy*)
318 fmt=bout ;;
319 *-*-bsd*)
320 fmt=aout em=sun3 ;;
321 *-*-generic) fmt=generic ;;
322 *-*-xray | *-*-hms) fmt=coff ;;
323 *-*-sim) fmt=coff ;;
324 *-*-elf | *-*-sysv4* | *-*-solaris*)
6df07e7f 325 AC_MSG_WARN(GAS support for ${generic_target} is incomplete.)
e7757ad0
KR
326 fmt=elf dev=yes ;;
327 *-*-vxworks) fmt=aout ;;
328 *-*-netware) fmt=elf ;;
329 esac
330
331 case ${cpu_type}-${fmt} in
0170f1c3 332 alpha*-*) bfd_gas=yes ;;
e7757ad0
KR
333 arm-*) bfd_gas=yes ;;
334 # not yet
335 # i386-aout) bfd_gas=preferred ;;
336 mips-*) bfd_gas=yes ;;
337 ns32k-*) bfd_gas=yes ;;
338 ppc-*) bfd_gas=yes ;;
339 sparc-*) bfd_gas=yes ;;
340 *-elf) bfd_gas=yes ;;
341 *-ecoff) bfd_gas=yes ;;
342 *-som) bfd_gas=yes ;;
343 *) ;;
344 esac
345
5f757edc
ILT
346# Other random stuff.
347
ae09d880
ILT
348 # do we need the opcodes library?
349 case ${cpu_type} in
0e034c77 350 vax | i386 | tic30)
7c2fadd1
ILT
351 ;;
352 *)
353 need_opcodes=yes
f2e272e0
ILT
354
355 case "${enable_shared}" in
356 yes) shared_opcodes=true ;;
357 *opcodes*) shared_opcodes=true ;;
358 *) shared_opcodes=false ;;
359 esac
159e6ef8 360 if test "${shared_opcodes}" = "true"; then
7c2fadd1
ILT
361 # A shared libopcodes must be linked against libbfd.
362 need_bfd=yes
363 fi
364 ;;
ae09d880
ILT
365 esac
366
5f757edc 367 case ${cpu_type} in
374bdac7
DE
368 m32r)
369 case ${extra_objects} in
370 *cgen.o*) ;;
371 *) extra_objects="$extra_objects cgen.o"
374bdac7
DE
372 AC_DEFINE(USING_CGEN)
373 ;;
374 esac
375 ;;
376
1c9dbb83
ILT
377 m68k)
378 case ${extra_objects} in
379 *m68k-parse.o*) ;;
380 *) extra_objects="$extra_objects m68k-parse.o" ;;
381 esac
382 ;;
efec4a28
DP
383
384 mips)
515c7142 385 echo ${extra_objects} | grep -s "itbl-parse.o"
efec4a28 386 if test $? -ne 0 ; then
515c7142 387 extra_objects="$extra_objects itbl-parse.o"
efec4a28
DP
388 fi
389
515c7142 390 echo ${extra_objects} | grep -s "itbl-lex.o"
efec4a28 391 if test $? -ne 0 ; then
515c7142 392 extra_objects="$extra_objects itbl-lex.o"
efec4a28
DP
393 fi
394
515c7142 395 echo ${extra_objects} | grep -s "itbl-ops.o"
efec4a28 396 if test $? -ne 0 ; then
515c7142 397 extra_objects="$extra_objects itbl-ops.o"
efec4a28
DP
398 fi
399 ;;
400
2b09622a 401 sparc)
e01e18a8
DE
402 if test $this_target = $target ; then
403 AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}")
404 fi
2b09622a
DE
405 ;;
406
efec4a28
DP
407 *)
408 ;;
5f757edc
ILT
409 esac
410
e7757ad0
KR
411# See if we really can support this configuration with the emulation code.
412
413 if test $this_target = $target ; then
414 primary_bfd_gas=$bfd_gas
415 obj_format=$fmt
e7757ad0
KR
416 te_file=$em
417
418 if test $bfd_gas = no ; then
419 # Can't support other configurations this way.
420 break
421 fi
422 elif test $bfd_gas = no ; then
423 # Can't support this configuration.
424 break
425 fi
426
427# From target name and format, produce a list of supported emulations.
428
429 case ${generic_target}-${fmt} in
1cb0d00d 430 mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
22d3fbd6 431 mips-*-linux-gnu*-*) case "$endian" in
515c7142
ILT
432 big) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
433 *) emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;;
434 esac ;;
435 mips-*-lnews*-ecoff) ;;
e7757ad0 436 mips-*-*-ecoff) case "$endian" in
1cb0d00d
KR
437 big) emulation="mipsbecoff mipslecoff mipsecoff" ;;
438 *) emulation="mipslecoff mipsbecoff mipsecoff" ;;
e7757ad0
KR
439 esac ;;
440 mips-*-*-elf) case "$endian" in
1cb0d00d
KR
441 big) emulation="mipsbelf mipslelf mipself" ;;
442 *) emulation="mipslelf mipsbelf mipself" ;;
515c7142
ILT
443 # Uncommenting the next line will turn on support for i386 COFF
444 # in any i386 ELF configuration. This probably doesn't work
445 # correctly.
446 # i386-*-*-elf) emulation="i386coff i386elf" ;;
e7757ad0
KR
447 esac ;;
448 esac
449
450 emulations="$emulations $emulation"
451
e7757ad0 452done
fecd2382 453
8cac6ca6
KR
454# Assign floating point type. Most processors with FP support
455# IEEE FP. On those that don't support FP at all, usually IEEE
456# is emulated.
b678740d 457case ${target_cpu} in
904b6037 458 vax | tahoe ) atof=${target_cpu} ;;
e7757ad0 459 *) atof=ieee ;;
fecd2382
RP
460esac
461
8cac6ca6 462case "${obj_format}" in
b11fb939 463 "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
8cac6ca6 464esac
7cf4d7ff 465
b11fb939
KR
466dnl
467dnl Make sure the desired support files exist.
468dnl
469
bf4bd1fc
ILT
470if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
471 AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
b11fb939
KR
472fi
473
fb589130 474if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
b11fb939 475 AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
7cf4d7ff
KR
476fi
477
e7757ad0 478case ${user_bfd_gas}-${primary_bfd_gas} in
a8285504 479 yes-yes | no-no)
7cf4d7ff
KR
480 # We didn't override user's choice.
481 ;;
a8285504 482 no-yes)
b11fb939 483 AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
7cf4d7ff 484 ;;
a8285504 485 no-preferred)
e7757ad0 486 primary_bfd_gas=no
a8285504
DZ
487 ;;
488 *-preferred)
e7757ad0 489 primary_bfd_gas=yes
a8285504 490 ;;
f2889110 491 yes-*)
e7757ad0 492 primary_bfd_gas=yes
f2889110 493 ;;
a8285504
DZ
494 -*)
495 # User specified nothing.
496 ;;
7cf4d7ff
KR
497esac
498
e7757ad0
KR
499# Some COFF configurations want these random other flags set.
500case ${obj_format} in
501 coff)
502 case ${target_cpu_type} in
503 i386) AC_DEFINE(I386COFF) ;;
504 m68k) AC_DEFINE(M68KCOFF) ;;
505 m88k) AC_DEFINE(M88KCOFF) ;;
506 esac
507 ;;
508esac
509
510# Getting this done right is going to be a bitch. Each configuration specified
511# with --enable-targets=... should be checked for environment, format, cpu, and
512# bfd_gas setting.
513#
514# For each configuration, the necessary object file support code must be linked
515# in. This might be only one, it might be up to four. The necessary emulation
516# code needs to be provided, too.
517#
518# And then there's "--enable-targets=all"....
519#
520# For now, just always do it for MIPS ELF or ECOFF configurations. Sigh.
521
522formats="${obj_format}"
523emfiles=""
524EMULATIONS=""
525GAS_UNIQ(emulations)
526for em in . $emulations ; do
527 case $em in
528 .) continue ;;
529 mipsbelf | mipslelf)
530 fmt=elf file=mipself ;;
531 mipsbecoff | mipslecoff)
532 fmt=ecoff file=mipsecoff ;;
515c7142
ILT
533 i386coff)
534 fmt=coff file=i386coff ;;
535 i386elf)
536 fmt=elf file=i386elf ;;
e7757ad0
KR
537 esac
538 formats="$formats $fmt"
539 emfiles="$emfiles e-$file.o"
540 EMULATIONS="$EMULATIONS &$em,"
541done
542GAS_UNIQ(formats)
543GAS_UNIQ(emfiles)
544if test `set . $formats ; shift ; echo $#` -gt 1 ; then
545 for fmt in $formats ; do
546 case $fmt in
547 aout) AC_DEFINE(OBJ_MAYBE_AOUT) ;;
548 bout) AC_DEFINE(OBJ_MAYBE_BOUT) ;;
549 coff) AC_DEFINE(OBJ_MAYBE_COFF) ;;
550 ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF) ;;
551 elf) AC_DEFINE(OBJ_MAYBE_ELF) ;;
552 generic) AC_DEFINE(OBJ_MAYBE_GENERIC) ;;
553 hp300) AC_DEFINE(OBJ_MAYBE_HP300) ;;
554 ieee) AC_DEFINE(OBJ_MAYBE_IEEE) ;;
555 som) AC_DEFINE(OBJ_MAYBE_SOM) ;;
556 vms) AC_DEFINE(OBJ_MAYBE_VMS) ;;
557 esac
558 extra_objects="$extra_objects obj-$fmt.o"
559 done
560 obj_format=multi
561fi
562if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
563 te_file=multi
564 extra_objects="$extra_objects $emfiles"
565 DEFAULT_EMULATION=`set . $emulations ; echo $2`
566 AC_DEFINE(USE_EMULATIONS)
567fi
568AC_SUBST(extra_objects)
569AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS)
570AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION")
571
bf4bd1fc 572case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
318b02b6
KR
573 yes-*-coff) need_bfd=yes ;;
574 no-*-coff) need_bfd=yes
575 AC_DEFINE(MANY_SEGMENTS) ;;
576esac
577
69ecc03f 578reject_dev_configs=yes
8cac6ca6
KR
579
580case ${reject_dev_configs}-${dev} in
581 yes-yes) # Oops.
b11fb939 582 AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
8cac6ca6
KR
583 ;;
584esac
585
bf4bd1fc 586AC_SUBST(target_cpu_type)
833c46e1 587AC_SUBST(obj_format)
515c7142 588AC_SUBST(te_file)
833c46e1 589AC_SUBST(atof)
e7757ad0 590dnl AC_SUBST(emulation)
833c46e1 591
e7757ad0 592case "${primary_bfd_gas}" in
b11fb939
KR
593 yes) AC_DEFINE(BFD_ASSEMBLER)
594 need_bfd=yes ;;
4f6f4aa8
KR
595esac
596
ae09d880
ILT
597# do we need the opcodes library?
598case "${need_opcodes}" in
1c94de4d 599yes)
e2b4bd2a 600 OPCODES_LIB=../opcodes/libopcodes.la
1c94de4d 601 ;;
ae09d880 602esac
ae09d880 603
b11fb939 604case "${need_bfd}" in
1c94de4d 605yes)
e2b4bd2a 606 BFDLIB=../bfd/libbfd.la
1c94de4d 607 ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
1c94de4d 608 ;;
4f6f4aa8 609esac
2e013bb7 610
b11fb939 611AC_SUBST(BFDLIB)
2e013bb7
ILT
612AC_SUBST(OPCODES_LIB)
613
b11fb939 614AC_SUBST(ALL_OBJ_DEPS)
4f6f4aa8 615
b11fb939
KR
616AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}")
617AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}")
618AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}")
619AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}")
620AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}")
621
b11fb939 622AC_PROG_CC
b11fb939 623
e2b4bd2a
ILT
624AC_PROG_YACC
625AC_PROG_LEX
626AC_DECL_YYTEXT
627
628AM_MAINTAINER_MODE
629AM_CYGWIN32
630AM_EXEEXT
631
b11fb939
KR
632AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
633
bf111c9f
KR
634# Put this here so that autoconf's "cross-compiling" message doesn't confuse
635# people who are not cross-compiling but are compiling cross-assemblers.
636AC_MSG_CHECKING(whether compiling a cross-assembler)
637if test "${host}" = "${target}"; then
f2889110
KR
638 cross_gas=no
639else
bf111c9f
KR
640 cross_gas=yes
641 AC_DEFINE(CROSS_COMPILE)
bf111c9f
KR
642fi
643AC_MSG_RESULT($cross_gas)
644
b11fb939
KR
645dnl ansidecl.h will deal with const
646dnl AC_CONST
647AC_FUNC_ALLOCA
648AC_C_INLINE
649
f2889110
KR
650# VMS doesn't have unlink.
651AC_CHECK_FUNCS(unlink remove, break)
28d3e4a3 652
e63c594d
FF
653# Some systems don't have sbrk().
654AC_CHECK_FUNCS(sbrk)
655
b11fb939
KR
656# Some non-ANSI preprocessors botch requoting inside strings. That's bad
657# enough, but on some of those systems, the assert macro relies on requoting
658# working properly!
bf111c9f 659GAS_WORKING_ASSERT
b11fb939
KR
660
661# On some systems, the system header files may not declare malloc, realloc,
662# and free. There are places where gas needs these functions to have been
663# declared -- such as when taking their addresses.
bf111c9f 664gas_test_headers="
b11fb939
KR
665#ifdef HAVE_MEMORY_H
666#include <memory.h>
667#endif
668#ifdef HAVE_STRING_H
669#include <string.h>
5cece526
ILT
670#else
671#ifdef HAVE_STRINGS_H
672#include <strings.h>
673#endif
b11fb939
KR
674#endif
675#ifdef HAVE_STDLIB_H
676#include <stdlib.h>
677#endif
678#ifdef HAVE_UNISTD_H
679#include <unistd.h>
680#endif
bf111c9f 681"
5cece526 682GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
bf111c9f 683GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
5f757edc 684GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
5cece526 685GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
b11fb939
KR
686
687# Does errno.h declare errno, or do we have to add a separate declaration
688# for it?
bf111c9f 689GAS_CHECK_DECL_NEEDED(errno, f, int f, [
b11fb939
KR
690#ifdef HAVE_ERRNO_H
691#include <errno.h>
692#endif
bf111c9f 693])
b11fb939 694
b11fb939 695dnl This must come last.
515c7142
ILT
696
697dnl We used to make symlinks to files in the source directory, but now
698dnl we just use the right name for .c files, and create .h files in
699dnl the build directory which include the right .h file. Make sure
700dnl the old symlinks don't exist, so that a reconfigure in an existing
701dnl directory behaves reasonably.
702
703AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in,
704[rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
705 echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
706 echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
707 echo '#include "te-'"${te_file}"'.h"' > targ-env.h
39ffbb4d
DE
708 echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
709 case ${target_cpu_type} in
710 m32r) echo '#include "opcodes/'"${target_cpu_type}"'-opc.h"' > cgen-opc.h ;;
711 esac],
515c7142
ILT
712[target_cpu_type=${target_cpu_type}
713 obj_format=${obj_format}
714 te_file=${te_file}])
This page took 0.266048 seconds and 4 git commands to generate.