First cut at handling multiple emulation modes for some MIPS targets.
[deliverable/binutils-gdb.git] / gas / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 dnl And be careful when changing it! If you must add tests with square
4 dnl brackets, be sure changequote invocations surround it.
5 dnl
6 dnl
7 AC_PREREQ(2.3)dnl We only need 2.0, but pre-2.3 loses on some AIX version.
8 AC_INIT(as.h)dnl
9 dnl
10 user_bfd_gas=
11 AC_ARG_ENABLE(bfd-assembler,
12 [ bfd-assembler use BFD back end for writing object files],
13 [case "${enableval}" in
14 yes) need_bfd=yes user_bfd_gas=yes ;;
15 no) user_bfd_gas=no ;;
16 *) AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;;
17 esac])dnl
18 AC_ARG_ENABLE(targets,
19 [ targets alternative target configurations besides the primary],
20 [case "${enableval}" in
21 yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
22 ;;
23 no) enable_targets= ;;
24 *) enable_targets=$enableval ;;
25 esac])dnl
26
27 # Generate a header file -- gets more post-processing by Makefile later.
28 AC_CONFIG_HEADER(conf)
29
30 dnl For recursion to work right, this must be an absolute pathname.
31 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
32 AC_CANONICAL_SYSTEM
33 AC_ARG_PROGRAM
34
35 te_file=generic
36
37 # assign cpu type
38
39 # check for architecture variants
40 case ${target_cpu} in
41 hppa*) cpu_type=hppa ;;
42 changequote(,)dnl
43 i[45]86) cpu_type=i386 ;;
44 m680[012346]0) cpu_type=m68k ;;
45 m68008) cpu_type=m68k ;;
46 m683??) cpu_type=m68k ;;
47 changequote([,])dnl
48 m8*) cpu_type=m88k ;;
49 mips*el) cpu_type=mips endian=little;;
50 mips*) cpu_type=mips endian=big ;;
51 powerpcle*) cpu_type=ppc endian=little ;;
52 powerpc*) cpu_type=ppc endian=big ;;
53 rs6000*) cpu_type=ppc ;;
54 sparc64) cpu_type=sparc obj_format=elf
55 AC_DEFINE(sparcv9) ;;
56 sparclite*) cpu_type=sparc ;;
57 *) cpu_type=${target_cpu} ;;
58 esac
59
60 # do we need the opcodes library?
61 case ${cpu_type} in
62 alpha | vax)
63 ;;
64 *)
65 OPCODES_LIB="../opcodes/libopcodes.a"
66 ;;
67 esac
68 AC_SUBST(OPCODES_LIB)
69
70 gas_target=${cpu_type}
71 this_target=${generic_target}
72
73 canon_targets=""
74 if test -n "$enable_targets" ; then
75 for t in `echo $enable_targets | sed 's/,/ /g'`; do
76 result=`$ac_config_sub $t 2>/dev/null`
77 if test -n "$result" ; then
78 canon_targets="$canon_targets $result"
79 # else
80 # # Permit "all", etc. We don't support it yet though.
81 # canon_targets="$canon_targets $t"
82 fi
83 done
84 GAS_UNIQ(canon_targets)
85 fi
86
87 emulations=""
88
89 for this_target in $target $canon_targets ; do
90
91 eval `echo $this_target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'`
92
93 # check for architecture variants
94 case ${cpu} in
95 hppa*) cpu_type=hppa ;;
96 changequote(,)dnl
97 i[45]86) cpu_type=i386 ;;
98 m680[012346]0) cpu_type=m68k ;;
99 m68008) cpu_type=m68k ;;
100 m683??) cpu_type=m68k ;;
101 changequote([,])dnl
102 m8*) cpu_type=m88k ;;
103 mips*el) cpu_type=mips endian=little;;
104 mips*) cpu_type=mips endian=big ;;
105 powerpcle*) cpu_type=ppc endian=little ;;
106 powerpc*) cpu_type=ppc endian=big ;;
107 rs6000*) cpu_type=ppc ;;
108 sparc64) cpu_type=sparc obj_format=elf want_sparcv9=true ;;
109 sparclite*) cpu_type=sparc ;;
110 *) cpu_type=${target_cpu} ;;
111 esac
112
113 if test ${this_target} = $target ; then
114 target_cpu_type=${cpu_type}
115 elif test ${target_cpu_type} != ${cpu_type} ; then
116 continue
117 fi
118
119 targ=${cpu_type}
120 generic_target=${cpu_type}-$vendor-$os
121 dev=no
122 bfd_gas=no
123 em=generic
124
125 # assign object format
126 case ${generic_target} in
127 a29k-amd-udi) fmt=coff targ=ebmon29k ;;
128 a29k-amd-ebmon) fmt=coff targ=ebmon29k ;;
129 a29k-*-vxworks*) fmt=coff ;;
130
131 alpha-*-netware*) fmt=ecoff ;;
132 alpha-*-osf*) fmt=ecoff ;;
133
134 # start-sanitize-arc
135 arc-*-elf*) fmt=elf bfd_gas=yes ;;
136 # end-sanitize-arc
137
138 arm-*-riscix*) fmt=aout ;;
139
140 hppa-*-*elf*) fmt=elf em=hppa ;;
141 hppa-*-lites*) fmt=elf em=hppa ;;
142 hppa-*-osf*) fmt=som em=hppa ;;
143 hppa-*-hpux*) fmt=som em=hppa ;;
144 hppa-*-bsd*) fmt=som em=hppa ;;
145 hppa-*-hiux*) fmt=som em=hppa ;;
146
147 h8300-*-coff) fmt=coff ;;
148
149 i386-ibm-aix*) fmt=coff targ=i386coff
150 em=i386aix ;;
151 i386-*-bsd*) fmt=aout em=386bsd ;;
152 i386-*-netbsd0.8) fmt=aout em=386bsd ;;
153 i386-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes;;
154 i386-*-linux*aout*) fmt=aout em=linux ;;
155 i386-*-linux*coff*) fmt=coff em=linux
156 targ=i386coff ;;
157 i386-*-linux*) fmt=elf em=linux ;;
158 i386-*-lynxos*) fmt=coff targ=i386coff
159 em=lynx ;;
160 i386-*-sysv4* | i386-*-solaris* | i386-*-elf)
161 fmt=elf ;;
162 i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*)
163 fmt=coff targ=i386coff ;;
164 i386-*-vsta) fmt=aout ;;
165 i386-*-go32) fmt=coff targ=i386coff ;;
166 i386-*-gnu*elf*) fmt=elf ;;
167 i386-*-mach* | i386-*-gnu*)
168 fmt=aout em=mach bfd_gas=yes ;;
169 i386-*-msdos*) fmt=aout ;;
170
171 i960-*-bout) fmt=bout ;;
172 i960-*-coff) fmt=coff em=ic960 targ=ic960coff ;;
173 i960-*-nindy*) fmt=bout ;;
174 i960-*-vxworks4*) fmt=bout ;;
175 i960-*-vxworks5.0) fmt=bout ;;
176 i960-*-vxworks5.*) fmt=coff em=ic960 targ=ic960coff ;;
177 i960-*-vxworks*) fmt=bout ;;
178
179 m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
180 fmt=aout em=sun3 ;;
181 m68k-motorola-sysv) fmt=coff targ=m68kcoff em=delta ;;
182 m68k-bull-sysv3*) fmt=coff targ=m68kcoff em=dpx2 ;;
183 m68k-apollo-*) fmt=coff targ=apollo em=apollo ;;
184 m68k-*-coff | m68k-*-sysv*)
185 fmt=coff targ=m68kcoff ;;
186 m68k-*-elf) fmt=elf ;;
187 m68k-*-hpux*) fmt=hp300 em=hp300 ;;
188 m68k-*-lynxos*) fmt=coff targ=m68kcoff
189 em=lynx ;;
190 m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
191
192 m88k-*-coff*) fmt=coff targ=m88kcoff ;;
193
194 # don't change em like *-*-bsd does
195 mips-dec-bsd*) fmt=aout targ=mips-lit ;;
196 mips-sony-bsd*) fmt=ecoff targ=mips-big ;;
197 mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
198 mips-*-ultrix*) fmt=ecoff targ=mips-lit ;;
199 mips-*-ecoff*) fmt=ecoff
200 case "$endian" in
201 big) targ=mips-big ;;
202 *) targ=mips-lit ;;
203 esac
204 ;;
205 mips-*-ecoff*) fmt=ecoff targ=mips-big ;;
206 mips-*-gnu*) fmt=aout
207 case "$endian" in
208 big) targ=mips-big ;;
209 *) targ=mips-lit ;;
210 esac
211 ;;
212 mips-*-irix5*) fmt=elf targ=mips-big ;;
213 mips-*-irix*) fmt=ecoff targ=mips-big ;;
214 mips-*-riscos*) fmt=ecoff targ=mips-big ;;
215 mips-*-sysv*) fmt=ecoff targ=mips-big ;;
216 mips-*-elf*) fmt=elf
217 case "$endian" in
218 big) targ=mips-big ;;
219 *) targ=mips-lit ;;
220 esac
221 ;;
222 ppc-*-aix*) fmt=coff ;;
223 ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
224 fmt=elf
225 case "$endian" in
226 big) targ=ppc-big ;;
227 *) targ=ppc-lit ;;
228 esac
229 ;;
230 ppc-*-netware*) fmt=elf em=ppcnw ;;
231
232 sh-*-coff) fmt=coff ;;
233
234 # start-sanitize-rce
235 rce-*-aout) fmt=aout ;;
236 # end-sanitize-rce
237
238 ns32k-pc532-mach*) fmt=aout em=pc532mach ;;
239 ns32k-pc532-netbsd*) fmt=aout em=nbsd532 ;;
240
241 sparc-*-sunos4*) fmt=aout em=sun3 ;;
242 sparc-*-aout | sparc*-*-vxworks)
243 fmt=aout ;;
244 sparc-*-coff) fmt=coff ;;
245 sparc-*-lynxos*) fmt=coff em=lynx ;;
246 sparc-fujitsu-none) fmt=aout ;;
247 sparc-*-elf | sparc*-*-solaris*)
248 fmt=elf ;;
249 sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
250
251 vax-*-bsd* | vax-*-ultrix*)
252 fmt=aout ;;
253 vax-*-vms) fmt=vms ;;
254
255 z8k-*-coff | z8k-*-sim)
256 fmt=coff ;;
257
258 w65-*-*) fmt=coff ;;
259
260 *-*-aout | *-*-scout)
261 fmt=aout ;;
262 *-*-nindy*)
263 fmt=bout ;;
264 *-*-bsd*)
265 fmt=aout em=sun3 ;;
266 *-*-generic) fmt=generic ;;
267 *-*-xray | *-*-hms) fmt=coff ;;
268 *-*-sim) fmt=coff ;;
269 *-*-elf | *-*-sysv4* | *-*-solaris*)
270 AC_MSG_WARN(GAS support for ELF format is incomplete.)
271 fmt=elf dev=yes ;;
272 *-*-vxworks) fmt=aout ;;
273 *-*-netware) fmt=elf ;;
274 esac
275
276 case ${cpu_type}-${fmt} in
277 arm-*) bfd_gas=yes ;;
278 # not yet
279 # i386-aout) bfd_gas=preferred ;;
280 mips-*) bfd_gas=yes ;;
281 ns32k-*) bfd_gas=yes ;;
282 ppc-*) bfd_gas=yes ;;
283 sparc-*) bfd_gas=yes ;;
284 *-elf) bfd_gas=yes ;;
285 *-ecoff) bfd_gas=yes ;;
286 *-som) bfd_gas=yes ;;
287 *) ;;
288 esac
289
290 # See if we really can support this configuration with the emulation code.
291
292 if test $this_target = $target ; then
293 primary_bfd_gas=$bfd_gas
294 obj_format=$fmt
295 gas_target=$targ
296 te_file=$em
297
298 if test $bfd_gas = no ; then
299 # Can't support other configurations this way.
300 break
301 fi
302 elif test $bfd_gas = no ; then
303 # Can't support this configuration.
304 break
305 fi
306
307 # From target name and format, produce a list of supported emulations.
308
309 case ${generic_target}-${fmt} in
310 mips-*-irix5*-*) emulation="mipsbelf mipslelf mipsbecoff mipslecoff" ;;
311 mips-*-*-ecoff) case "$endian" in
312 big) emulation="mipsbecoff mipslecoff" ;;
313 *) emulation="mipslecoff mipsbecoff" ;;
314 esac ;;
315 mips-*-*-elf) case "$endian" in
316 big) emulation="mipsbelf mipslelf" ;;
317 *) emulation="mipslelf mipsbelf" ;;
318 esac ;;
319 esac
320
321 emulations="$emulations $emulation"
322
323 # Other random stuff.
324
325 test -n "$want_sparcv9" && AC_DEFINE(sparcv9)
326
327 done
328
329 # Assign floating point type. Most processors with FP support
330 # IEEE FP. On those that don't support FP at all, usually IEEE
331 # is emulated.
332 case ${target_cpu} in
333 vax | tahoe ) atof=${target_cpu} ;;
334 *) atof=ieee ;;
335 esac
336
337 case "${obj_format}" in
338 "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
339 esac
340
341 dnl
342 dnl Make sure the desired support files exist.
343 dnl
344
345 if test ! -r ${srcdir}/config/tc-${cpu_type}.c; then
346 AC_MSG_ERROR(GAS does not support target CPU ${cpu_type})
347 fi
348
349 if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
350 AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
351 fi
352
353 # and target makefile frag
354
355 target_frag=${srcdir}/config/${gas_target}.mt
356 if test ! -r ${target_frag}; then
357 target_frag=/dev/null # ick! but subst_file can't be conditionalized
358 fi
359 AC_SUBST_FILE(target_frag)
360
361 case ${user_bfd_gas}-${primary_bfd_gas} in
362 yes-yes | no-no)
363 # We didn't override user's choice.
364 ;;
365 no-yes)
366 AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
367 ;;
368 no-preferred)
369 primary_bfd_gas=no
370 ;;
371 *-preferred)
372 primary_bfd_gas=yes
373 ;;
374 yes-*)
375 primary_bfd_gas=yes
376 ;;
377 -*)
378 # User specified nothing.
379 ;;
380 esac
381
382 # Some COFF configurations want these random other flags set.
383 case ${obj_format} in
384 coff)
385 case ${target_cpu_type} in
386 i386) AC_DEFINE(I386COFF) ;;
387 m68k) AC_DEFINE(M68KCOFF) ;;
388 m88k) AC_DEFINE(M88KCOFF) ;;
389 esac
390 ;;
391 esac
392
393 # Getting this done right is going to be a bitch. Each configuration specified
394 # with --enable-targets=... should be checked for environment, format, cpu, and
395 # bfd_gas setting.
396 #
397 # For each configuration, the necessary object file support code must be linked
398 # in. This might be only one, it might be up to four. The necessary emulation
399 # code needs to be provided, too.
400 #
401 # And then there's "--enable-targets=all"....
402 #
403 # For now, just always do it for MIPS ELF or ECOFF configurations. Sigh.
404
405 formats="${obj_format}"
406 emfiles=""
407 EMULATIONS=""
408 GAS_UNIQ(emulations)
409 for em in . $emulations ; do
410 case $em in
411 .) continue ;;
412 mipsbelf | mipslelf)
413 fmt=elf file=mipself ;;
414 mipsbecoff | mipslecoff)
415 fmt=ecoff file=mipsecoff ;;
416 esac
417 formats="$formats $fmt"
418 emfiles="$emfiles e-$file.o"
419 EMULATIONS="$EMULATIONS &$em,"
420 done
421 GAS_UNIQ(formats)
422 GAS_UNIQ(emfiles)
423 if test `set . $formats ; shift ; echo $#` -gt 1 ; then
424 for fmt in $formats ; do
425 case $fmt in
426 aout) AC_DEFINE(OBJ_MAYBE_AOUT) ;;
427 bout) AC_DEFINE(OBJ_MAYBE_BOUT) ;;
428 coff) AC_DEFINE(OBJ_MAYBE_COFF) ;;
429 ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF) ;;
430 elf) AC_DEFINE(OBJ_MAYBE_ELF) ;;
431 generic) AC_DEFINE(OBJ_MAYBE_GENERIC) ;;
432 hp300) AC_DEFINE(OBJ_MAYBE_HP300) ;;
433 ieee) AC_DEFINE(OBJ_MAYBE_IEEE) ;;
434 som) AC_DEFINE(OBJ_MAYBE_SOM) ;;
435 vms) AC_DEFINE(OBJ_MAYBE_VMS) ;;
436 esac
437 extra_objects="$extra_objects obj-$fmt.o"
438 done
439 obj_format=multi
440 fi
441 if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
442 te_file=multi
443 extra_objects="$extra_objects $emfiles"
444 DEFAULT_EMULATION=`set . $emulations ; echo $2`
445 AC_DEFINE(USE_EMULATIONS)
446 fi
447 AC_SUBST(extra_objects)
448 AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS)
449 AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION")
450
451 files="config/tc-${cpu_type}.c config/tc-${cpu_type}.h \
452 config/obj-${obj_format}.h config/obj-${obj_format}.c \
453 config/te-${te_file}.h config/atof-${atof}.c \
454 $extra_files"
455 links="targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c \
456 $extra_links"
457
458 case ${primary_bfd_gas}-${cpu_type}-${obj_format} in
459 yes-*-coff) need_bfd=yes ;;
460 no-*-coff) need_bfd=yes
461 AC_DEFINE(MANY_SEGMENTS) ;;
462 esac
463
464 reject_dev_configs=yes
465
466 case ${reject_dev_configs}-${dev} in
467 yes-yes) # Oops.
468 AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
469 ;;
470 esac
471
472 AC_SUBST(cpu_type)
473 AC_SUBST(obj_format)
474 AC_SUBST(atof)
475 dnl AC_SUBST(emulation)
476
477 AC_LINK_FILES($files, $links)
478
479 case "${primary_bfd_gas}" in
480 yes) AC_DEFINE(BFD_ASSEMBLER)
481 need_bfd=yes ;;
482 esac
483
484 case "${need_bfd}" in
485 yes) BFDLIB=../bfd/libbfd.a
486 ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
487 ;;
488 esac
489 AC_SUBST(BFDLIB)
490 AC_SUBST(ALL_OBJ_DEPS)
491
492 AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}")
493 AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}")
494 AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}")
495 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}")
496 AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}")
497
498 AC_PROG_CC
499 AC_PROG_INSTALL
500
501 AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
502
503 # Put this here so that autoconf's "cross-compiling" message doesn't confuse
504 # people who are not cross-compiling but are compiling cross-assemblers.
505 AC_MSG_CHECKING(whether compiling a cross-assembler)
506 if test "${host}" = "${target}"; then
507 cross_gas=no
508 else
509 cross_gas=yes
510 AC_DEFINE(CROSS_COMPILE)
511 fi
512 AC_MSG_RESULT($cross_gas)
513
514 dnl ansidecl.h will deal with const
515 dnl AC_CONST
516 AC_FUNC_ALLOCA
517 AC_C_INLINE
518
519 # VMS doesn't have unlink.
520 AC_CHECK_FUNCS(unlink remove, break)
521
522 # Some non-ANSI preprocessors botch requoting inside strings. That's bad
523 # enough, but on some of those systems, the assert macro relies on requoting
524 # working properly!
525 GAS_WORKING_ASSERT
526
527 # On some systems, the system header files may not declare malloc, realloc,
528 # and free. There are places where gas needs these functions to have been
529 # declared -- such as when taking their addresses.
530 gas_test_headers="
531 #ifdef HAVE_MEMORY_H
532 #include <memory.h>
533 #endif
534 #ifdef HAVE_STRING_H
535 #include <string.h>
536 #endif
537 #ifdef HAVE_STDLIB_H
538 #include <stdlib.h>
539 #endif
540 #ifdef HAVE_UNISTD_H
541 #include <unistd.h>
542 #endif
543 "
544 GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
545 GAS_CHECK_DECL_NEEDED(free, f, int f, $gas_test_headers)
546
547 # Does errno.h declare errno, or do we have to add a separate declaration
548 # for it?
549 GAS_CHECK_DECL_NEEDED(errno, f, int f, [
550 #ifdef HAVE_ERRNO_H
551 #include <errno.h>
552 #endif
553 ])
554
555 AC_CONFIG_SUBDIRS(testsuite)
556
557 dnl This must come last.
558 AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in)
This page took 0.041257 seconds and 5 git commands to generate.