1 dnl Process this file with autoconf to produce a configure script.
3 dnl And be careful when changing it! If you must add tests with square
4 dnl brackets, be sure changequote invocations surround it.
7 AC_PREREQ(2.3)dnl We only need 2.0, but pre-2.3 loses on some AIX version.
11 AC_ARG_ENABLE(bfd-assembler,
12 [ --enable-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) ;;
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')
23 no) enable_targets= ;;
24 *) enable_targets=$enableval ;;
27 # Generate a header file -- gets more post-processing by Makefile later.
28 AC_CONFIG_HEADER(conf)
30 dnl For recursion to work right, this must be an absolute pathname.
31 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
39 # check for architecture variants
41 armeb) cpu_type=arm endian=big ;;
42 arm*) cpu_type=arm endian=little ;;
43 hppa*) cpu_type=hppa ;;
45 i[45]86) cpu_type=i386 ;;
46 m680[012346]0) cpu_type=m68k ;;
47 m68008) cpu_type=m68k ;;
48 m683??) cpu_type=m68k ;;
51 mips*el) cpu_type=mips endian=little;;
52 mips*) cpu_type=mips endian=big ;;
53 powerpcle*) cpu_type=ppc endian=little ;;
54 powerpc*) cpu_type=ppc endian=big ;;
55 rs6000*) cpu_type=ppc ;;
56 sparc64) cpu_type=sparc obj_format=elf
58 sparclite*) cpu_type=sparc ;;
59 *) cpu_type=${target_cpu} ;;
62 # do we need the opcodes library?
67 OPCODES_LIB="../opcodes/libopcodes.a"
72 gas_target=${cpu_type}
73 this_target=${generic_target}
76 if test -n "$enable_targets" ; then
77 for t in `echo $enable_targets | sed 's/,/ /g'`; do
78 result=`$ac_config_sub $t 2>/dev/null`
79 if test -n "$result" ; then
80 canon_targets="$canon_targets $result"
82 # # Permit "all", etc. We don't support it yet though.
83 # canon_targets="$canon_targets $t"
86 GAS_UNIQ(canon_targets)
91 for this_target in $target $canon_targets ; do
93 eval `echo $this_target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'`
95 # check for architecture variants
97 hppa*) cpu_type=hppa ;;
99 i[45]86) cpu_type=i386 ;;
100 m680[012346]0) cpu_type=m68k ;;
101 m68008) cpu_type=m68k ;;
102 m683??) cpu_type=m68k ;;
104 m8*) cpu_type=m88k ;;
105 mips*el) cpu_type=mips endian=little;;
106 mips*) cpu_type=mips endian=big ;;
107 powerpcle*) cpu_type=ppc endian=little ;;
108 powerpc*) cpu_type=ppc endian=big ;;
109 rs6000*) cpu_type=ppc ;;
110 sparc64) cpu_type=sparc obj_format=elf want_sparcv9=true ;;
111 sparclite*) cpu_type=sparc ;;
112 *) cpu_type=${cpu} ;;
115 if test ${this_target} = $target ; then
116 target_cpu_type=${cpu_type}
117 elif test ${target_cpu_type} != ${cpu_type} ; then
122 generic_target=${cpu_type}-$vendor-$os
127 # assign object format
128 case ${generic_target} in
129 a29k-amd-udi) fmt=coff targ=ebmon29k ;;
130 a29k-amd-ebmon) fmt=coff targ=ebmon29k ;;
131 a29k-nyu-sym1) fmt=coff targ=ebmon29k ;;
132 a29k-*-vxworks*) fmt=coff ;;
134 alpha-*-netware*) fmt=ecoff ;;
135 alpha-*-osf*) fmt=ecoff ;;
136 alpha-*-linux*) fmt=ecoff ;;
139 arc-*-elf*) fmt=elf bfd_gas=yes ;;
142 arm-*-riscix*) fmt=aout targ=arm-lit ;;
149 arm-*-coff) fmt=coff ;;
150 arm-*-riscix*) fmt=aout ;;
151 arm-*-pe) fmt=coff targ=armcoff em=pe ;;
153 hppa-*-*elf*) fmt=elf em=hppa ;;
154 hppa-*-lites*) fmt=elf em=hppa ;;
155 hppa-*-osf*) fmt=som em=hppa ;;
156 hppa-*-hpux*) fmt=som em=hppa ;;
157 hppa-*-bsd*) fmt=som em=hppa ;;
158 hppa-*-hiux*) fmt=som em=hppa ;;
160 h8300-*-coff) fmt=coff ;;
162 i386-ibm-aix*) fmt=coff targ=i386coff
164 i386-*-bsd*) fmt=aout em=386bsd ;;
165 i386-*-netbsd0.8) fmt=aout em=386bsd ;;
166 i386-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes;;
167 i386-*-linux*aout* | i386-*-linuxoldld) fmt=aout em=linux ;;
168 i386-*-linux*coff*) fmt=coff em=linux
170 i386-*-linux*) fmt=elf em=linux ;;
171 i386-*-lynxos*) fmt=coff targ=i386coff
173 i386-*-sysv4* | i386-*-solaris* | i386-*-elf)
175 i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*)
176 fmt=coff targ=i386coff ;;
177 i386-*-vsta) fmt=aout ;;
178 i386-*-go32) fmt=coff targ=i386coff ;;
179 i386-*-gnu*) fmt=elf ;;
181 fmt=aout em=mach bfd_gas=yes ;;
182 i386-*-msdos*) fmt=aout ;;
183 i386-*-moss*) fmt=elf ;;
184 i386-*-pe) fmt=coff targ=i386coff em=pe ;;
185 i386-*-win32) fmt=coff targ=i386coff em=pe ;;
186 i386-*-*nt) fmt=coff targ=i386coff em=pe ;;
187 i960-*-bout) fmt=bout ;;
188 i960-*-coff) fmt=coff em=ic960 targ=ic960coff ;;
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 ;;
195 m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
197 m68k-motorola-sysv*) fmt=coff targ=m68kcoff em=delta ;;
198 m68k-bull-sysv3*) fmt=coff targ=m68kcoff em=dpx2 ;;
199 m68k-apollo-*) fmt=coff targ=apollo em=apollo ;;
200 m68k-*-coff | m68k-*-sysv*)
201 fmt=coff targ=m68kcoff ;;
202 m68k-*-elf) fmt=elf ;;
203 m68k-*-hpux*) fmt=hp300 em=hp300 ;;
204 m68k-*-lynxos*) fmt=coff targ=m68kcoff
206 m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
208 m88k-motorola-sysv3*) fmt=coff targ=m88kcoff em=delt88 ;;
209 m88k-*-coff*) fmt=coff targ=m88kcoff ;;
211 # don't change em like *-*-bsd does
212 mips-dec-netbsd*) fmt=elf targ=mips-lit endian=little ;;
213 mips-dec-bsd*) fmt=aout targ=mips-lit ;;
214 mips-sony-bsd*) fmt=ecoff targ=mips-big ;;
215 mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
216 mips-*-ultrix*) fmt=ecoff targ=mips-lit endian=little ;;
217 mips-*-ecoff*) fmt=ecoff
219 big) targ=mips-big ;;
223 mips-*-ecoff*) fmt=ecoff targ=mips-big ;;
224 mips-*-gnu*) fmt=aout
226 big) targ=mips-big ;;
230 mips-*-irix5*) fmt=elf targ=mips-big ;;
231 mips-*-irix*) fmt=ecoff targ=mips-big ;;
232 mips-*-riscos*) fmt=ecoff targ=mips-big ;;
233 mips-*-sysv*) fmt=ecoff targ=mips-big ;;
236 big) targ=mips-big ;;
240 ppc-*-pe) fmt=coff em=pe
246 ppc-*-winnt*) fmt=coff em=pe
252 ppc-*-aix*) fmt=coff ;;
253 ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
260 ppc-*-macos* | ppc-*-mpw*)
262 ppc-*-netware*) fmt=elf em=ppcnw ;;
264 sh-*-coff) fmt=coff ;;
267 rce-*-aout) fmt=aout ;;
270 ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;;
271 ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;;
273 sparc-*-sunos4*) fmt=aout em=sun3 ;;
274 sparc-*-aout | sparc*-*-vxworks)
276 sparc-*-coff) fmt=coff ;;
277 sparc-*-lynxos*) fmt=coff em=lynx ;;
278 sparc-fujitsu-none) fmt=aout ;;
279 sparc-*-elf | sparc*-*-solaris*)
281 sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
283 vax-*-bsd* | vax-*-ultrix*)
285 vax-*-vms) fmt=vms ;;
287 z8k-*-coff | z8k-*-sim)
292 *-*-aout | *-*-scout)
298 *-*-generic) fmt=generic ;;
299 *-*-xray | *-*-hms) fmt=coff ;;
301 *-*-elf | *-*-sysv4* | *-*-solaris*)
302 AC_MSG_WARN(GAS support for ELF format is incomplete.)
304 *-*-vxworks) fmt=aout ;;
305 *-*-netware) fmt=elf ;;
308 case ${cpu_type}-${fmt} in
309 arm-*) bfd_gas=yes ;;
311 # i386-aout) bfd_gas=preferred ;;
312 mips-*) bfd_gas=yes ;;
313 ns32k-*) bfd_gas=yes ;;
314 ppc-*) bfd_gas=yes ;;
315 sparc-*) bfd_gas=yes ;;
316 *-elf) bfd_gas=yes ;;
317 *-ecoff) bfd_gas=yes ;;
318 *-som) bfd_gas=yes ;;
322 # Other random stuff.
324 test -n "$want_sparcv9" && AC_DEFINE(sparcv9)
327 m68k) extra_objects="$extra_objects m68k-parse.o" ;;
330 # See if we really can support this configuration with the emulation code.
332 if test $this_target = $target ; then
333 primary_bfd_gas=$bfd_gas
338 if test $bfd_gas = no ; then
339 # Can't support other configurations this way.
342 elif test $bfd_gas = no ; then
343 # Can't support this configuration.
347 # From target name and format, produce a list of supported emulations.
349 case ${generic_target}-${fmt} in
350 mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
351 mips-*-*-ecoff) case "$endian" in
352 big) emulation="mipsbecoff mipslecoff mipsecoff" ;;
353 *) emulation="mipslecoff mipsbecoff mipsecoff" ;;
355 mips-*-*-elf) case "$endian" in
356 big) emulation="mipsbelf mipslelf mipself" ;;
357 *) emulation="mipslelf mipsbelf mipself" ;;
361 emulations="$emulations $emulation"
365 # Assign floating point type. Most processors with FP support
366 # IEEE FP. On those that don't support FP at all, usually IEEE
368 case ${target_cpu} in
369 vax | tahoe ) atof=${target_cpu} ;;
373 case "${obj_format}" in
374 "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
378 dnl Make sure the desired support files exist.
381 if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
382 AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
385 if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
386 AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
389 # and target makefile frag
391 target_frag=${srcdir}/config/${gas_target}.mt
392 if test ! -r ${target_frag}; then
393 target_frag=/dev/null # ick! but subst_file can't be conditionalized
395 AC_SUBST_FILE(target_frag)
397 case ${user_bfd_gas}-${primary_bfd_gas} in
399 # We didn't override user's choice.
402 AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
414 # User specified nothing.
418 # Some COFF configurations want these random other flags set.
419 case ${obj_format} in
421 case ${target_cpu_type} in
422 i386) AC_DEFINE(I386COFF) ;;
423 m68k) AC_DEFINE(M68KCOFF) ;;
424 m88k) AC_DEFINE(M88KCOFF) ;;
429 # Getting this done right is going to be a bitch. Each configuration specified
430 # with --enable-targets=... should be checked for environment, format, cpu, and
433 # For each configuration, the necessary object file support code must be linked
434 # in. This might be only one, it might be up to four. The necessary emulation
435 # code needs to be provided, too.
437 # And then there's "--enable-targets=all"....
439 # For now, just always do it for MIPS ELF or ECOFF configurations. Sigh.
441 formats="${obj_format}"
445 for em in . $emulations ; do
449 fmt=elf file=mipself ;;
450 mipsbecoff | mipslecoff)
451 fmt=ecoff file=mipsecoff ;;
453 formats="$formats $fmt"
454 emfiles="$emfiles e-$file.o"
455 EMULATIONS="$EMULATIONS &$em,"
459 if test `set . $formats ; shift ; echo $#` -gt 1 ; then
460 for fmt in $formats ; do
462 aout) AC_DEFINE(OBJ_MAYBE_AOUT) ;;
463 bout) AC_DEFINE(OBJ_MAYBE_BOUT) ;;
464 coff) AC_DEFINE(OBJ_MAYBE_COFF) ;;
465 ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF) ;;
466 elf) AC_DEFINE(OBJ_MAYBE_ELF) ;;
467 generic) AC_DEFINE(OBJ_MAYBE_GENERIC) ;;
468 hp300) AC_DEFINE(OBJ_MAYBE_HP300) ;;
469 ieee) AC_DEFINE(OBJ_MAYBE_IEEE) ;;
470 som) AC_DEFINE(OBJ_MAYBE_SOM) ;;
471 vms) AC_DEFINE(OBJ_MAYBE_VMS) ;;
473 extra_objects="$extra_objects obj-$fmt.o"
477 if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
479 extra_objects="$extra_objects $emfiles"
480 DEFAULT_EMULATION=`set . $emulations ; echo $2`
481 AC_DEFINE(USE_EMULATIONS)
483 AC_SUBST(extra_objects)
484 AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS)
485 AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION")
487 files="config/tc-${target_cpu_type}.c config/tc-${target_cpu_type}.h \
488 config/obj-${obj_format}.h config/obj-${obj_format}.c \
489 config/te-${te_file}.h config/atof-${atof}.c \
491 links="targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c \
494 case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
495 yes-*-coff) need_bfd=yes ;;
496 no-*-coff) need_bfd=yes
497 AC_DEFINE(MANY_SEGMENTS) ;;
500 reject_dev_configs=yes
502 case ${reject_dev_configs}-${dev} in
504 AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
508 AC_SUBST(target_cpu_type)
511 dnl AC_SUBST(emulation)
513 AC_LINK_FILES($files, $links)
515 case "${primary_bfd_gas}" in
516 yes) AC_DEFINE(BFD_ASSEMBLER)
520 case "${need_bfd}" in
521 yes) BFDLIB=../bfd/libbfd.a
522 ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
526 AC_SUBST(ALL_OBJ_DEPS)
528 AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}")
529 AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}")
530 AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}")
531 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}")
532 AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}")
537 AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
539 # Put this here so that autoconf's "cross-compiling" message doesn't confuse
540 # people who are not cross-compiling but are compiling cross-assemblers.
541 AC_MSG_CHECKING(whether compiling a cross-assembler)
542 if test "${host}" = "${target}"; then
546 AC_DEFINE(CROSS_COMPILE)
548 AC_MSG_RESULT($cross_gas)
550 dnl ansidecl.h will deal with const
555 # VMS doesn't have unlink.
556 AC_CHECK_FUNCS(unlink remove, break)
558 # Some systems don't have sbrk().
561 # Some non-ANSI preprocessors botch requoting inside strings. That's bad
562 # enough, but on some of those systems, the assert macro relies on requoting
566 # On some systems, the system header files may not declare malloc, realloc,
567 # and free. There are places where gas needs these functions to have been
568 # declared -- such as when taking their addresses.
583 GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
584 GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
586 # Does errno.h declare errno, or do we have to add a separate declaration
588 GAS_CHECK_DECL_NEEDED(errno, f, int f, [
594 dnl This must come last.
595 AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in)