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