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