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 dnl v2.5 needed for --bindir et al
13 AM_INIT_AUTOMAKE(gas, 2.8.2)
18 AC_ARG_ENABLE(bfd-assembler,
19 [ --enable-bfd-assembler use BFD back end for writing object files],
20 [case "${enableval}" in
21 yes) need_bfd=yes user_bfd_gas=yes ;;
22 no) user_bfd_gas=no ;;
23 *) AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;;
25 AC_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')
30 no) enable_targets= ;;
31 *) enable_targets=$enableval ;;
33 AC_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]) ;;
41 # Generate a header file
42 AM_CONFIG_HEADER(config.h:config.in)
47 if test -n "$enable_targets" ; then
48 for t in `echo $enable_targets | sed 's/,/ /g'`; do
49 result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $t 2>/dev/null`
50 if test -n "$result" ; then
51 canon_targets="$canon_targets $result"
53 # # Permit "all", etc. We don't support it yet though.
54 # canon_targets="$canon_targets $t"
57 GAS_UNIQ(canon_targets)
62 for this_target in $target $canon_targets ; do
65 eval `echo $this_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'`
68 # check for architecture variants
72 alpha*) cpu_type=alpha ;;
73 armeb) cpu_type=arm endian=big ;;
74 arm*) cpu_type=arm endian=little ;;
75 thumb*) cpu_type=arm endian=little ;;
76 hppa*) cpu_type=hppa ;;
78 i[456]86) cpu_type=i386 ;;
79 m680[012346]0) cpu_type=m68k ;;
80 m68008) cpu_type=m68k ;;
81 m683??) cpu_type=m68k ;;
84 mips*el) cpu_type=mips endian=little ;;
85 # start-sanitize-r5900
86 mips*5900*) cpu_type=mips endian=little ;;
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 ;;
92 sparclite*) cpu_type=sparc arch=sparclite ;;
93 sparclet*) cpu_type=sparc arch=sparclet ;;
94 sparc64*) cpu_type=sparc arch=v9-64 ;;
95 sparc*) cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
96 v850*) cpu_type=v850 ;;
100 if test ${this_target} = $target ; then
101 target_cpu_type=${cpu_type}
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)
107 elif test ${target_cpu_type} != ${cpu_type} ; then
111 generic_target=${cpu_type}-$vendor-$os
116 # assign object format
117 case ${generic_target} in
118 a29k-*-coff) fmt=coff ;;
119 a29k-amd-udi) fmt=coff ;;
120 a29k-amd-ebmon) fmt=coff ;;
121 a29k-nyu-sym1) fmt=coff ;;
122 a29k-*-vxworks*) fmt=coff ;;
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 ;;
129 alpha*-*-linux*) fmt=elf em=linux ;;
131 arc-*-elf*) fmt=elf bfd_gas=yes ;;
133 arm-*-riscix*) fmt=aout em=riscix ;;
134 arm-*-aout) fmt=aout ;;
135 arm-*-coff | thumb-*-coff) fmt=coff ;;
136 arm-*-riscix*) fmt=aout ;;
137 arm-*-pe) fmt=coff em=pe ;;
139 d10v-*-*) fmt=elf bfd_gas=yes ;;
140 # start-sanitize-d30v
141 d30v-*-*) fmt=elf bfd_gas=yes ;;
144 hppa-*-*elf*) fmt=elf em=hppa ;;
145 hppa-*-lites*) fmt=elf em=hppa ;;
146 hppa-*-osf*) fmt=som em=hppa ;;
147 hppa-*-rtems*) fmt=elf em=hppa ;;
148 hppa-*-hpux*) fmt=som em=hppa ;;
149 hppa-*-bsd*) fmt=som em=hppa ;;
150 hppa-*-hiux*) fmt=som em=hppa ;;
152 h8300-*-coff) fmt=coff ;;
154 i386-ibm-aix*) fmt=coff em=i386aix ;;
155 i386-sequent-bsd*) fmt=aout em=dynix bfd_gas=yes ;;
156 i386-*-bsd*) fmt=aout em=386bsd ;;
157 i386-*-netbsd0.8) fmt=aout em=386bsd ;;
158 i386-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes;;
159 i386-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes;;
160 i386-*-linux*aout* | i386-*-linuxoldld) fmt=aout em=linux ;;
161 i386-*-linux*coff*) fmt=coff em=linux ;;
162 i386-*-linux*) fmt=elf em=linux ;;
163 i386-*-lynxos*) fmt=coff em=lynx ;;
164 i386-*-sysv4* | i386-*-solaris* | i386-*-elf | i386-*-freebsdelf*)
166 i386-*-sco*elf*) fmt=elf
167 if test ${this_target} = $target; then
171 i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*)
173 i386-*-vsta) fmt=aout ;;
174 i386-*-msdosdjgpp* | i386-*-go32*)
176 i386-*-rtems*) fmt=coff ;;
177 i386-*-gnu*) fmt=elf ;;
179 fmt=aout em=mach bfd_gas=yes ;;
180 i386-*-msdos*) fmt=aout ;;
181 i386-*-moss*) fmt=elf ;;
182 i386-*-pe) fmt=coff em=pe ;;
183 i386-*-cygwin32) fmt=coff em=pe bfd_gas=yes ;;
184 i386-*-*nt) fmt=coff em=pe ;;
185 i960-*-bout) fmt=bout ;;
186 i960-*-coff) fmt=coff em=ic960 ;;
187 i960-*-rtems*) fmt=coff em=ic960 ;;
188 i960-*-nindy*) fmt=bout ;;
189 i960-*-vxworks4*) fmt=bout ;;
190 i960-*-vxworks5.0) fmt=bout ;;
191 i960-*-vxworks5.*) fmt=coff em=ic960 ;;
192 i960-*-vxworks*) fmt=bout ;;
194 m32r-*-*) fmt=elf bfd_gas=yes ;;
196 m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
198 m68k-motorola-sysv*) fmt=coff em=delta ;;
199 m68k-bull-sysv3*) fmt=coff em=dpx2 ;;
200 m68k-apollo-*) fmt=coff em=apollo ;;
201 m68k-*-sysv4*) # must be before -sysv*
203 m68k-*-elf*) fmt=elf ;;
204 m68k-*-coff | m68k-*-sysv* | m68k-*-rtems*)
206 m68k-*-hpux*) fmt=hp300 em=hp300 ;;
207 m68k-*-linux*aout*) fmt=aout em=linux ;;
208 m68k-*-linux*) fmt=elf em=linux ;;
209 m68k-*-lynxos*) fmt=coff em=lynx ;;
210 m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
211 m68k-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
212 m68k-apple-aux*) fmt=coff em=aux ;;
213 m68k-*-psos*) fmt=elf em=psos;;
215 m88k-motorola-sysv3*) fmt=coff em=delt88 ;;
216 m88k-*-coff*) fmt=coff ;;
218 # don't change em like *-*-bsd does
219 mips-dec-netbsd*) fmt=elf endian=little ;;
220 mips-dec-openbsd*) fmt=elf endian=little ;;
221 mips-dec-bsd*) fmt=aout ;;
222 mips-sony-bsd*) fmt=ecoff ;;
223 mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
224 mips-*-ultrix*) fmt=ecoff endian=little ;;
225 mips-*-osf*) fmt=ecoff endian=little ;;
226 mips-*-ecoff*) fmt=ecoff ;;
227 mips-*-ecoff*) fmt=ecoff ;;
228 mips-*-irix6*) fmt=elf ;;
229 mips-*-irix5*) fmt=elf ;;
230 mips-*-irix*) fmt=ecoff ;;
231 mips-*-lnews*) fmt=ecoff em=lnews ;;
232 mips-*-riscos*) fmt=ecoff ;;
233 mips-*-sysv*) fmt=ecoff ;;
234 mips-*-elf* | mips-*-rtems* | mips-*-linux* | mips-*-gnu* | mips-*-openbsd*)
236 mn10200-*-*) fmt=elf bfd_gas=yes ;;
237 mn10300-*-*) fmt=elf bfd_gas=yes ;;
238 ppc-*-pe | ppc-*-cygwin32 | ppc-*-winnt*)
240 ppc-*-aix*) fmt=coff ;;
241 ppc-*-beos*) fmt=coff ;;
242 ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
244 ppc-*-linux*) fmt=elf
247 *) AC_MSG_ERROR(Linux must be configured big endian) ;;
250 ppc-*-solaris*) fmt=elf
251 if test ${this_target} = $target; then
252 AC_DEFINE(TARGET_SOLARIS_COMMENT)
254 if test x${endian} = xbig; then
255 AC_MSG_ERROR(Solaris must be configured little endian)
258 ppc-*-rtems*) fmt=elf ;;
259 ppc-*-macos* | ppc-*-mpw*)
261 ppc-*-netware*) fmt=elf em=ppcnw ;;
263 sh-*-elf*) fmt=elf ;;
264 sh-*-coff*) fmt=coff ;;
265 sh-*-rtems*) fmt=elf ;;
267 ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;;
268 ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;;
269 ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;
271 sparc-*-rtems*) fmt=aout ;;
272 sparc-*-sunos4*) fmt=aout em=sun3 ;;
273 sparc-*-aout | sparc*-*-vxworks*)
274 fmt=aout em=sparcaout ;;
275 sparc-*-coff) fmt=coff ;;
276 sparc-*-linux*aout*) fmt=aout em=linux ;;
277 sparc-*-linux*) fmt=elf em=linux ;;
278 sparc-*-lynxos*) fmt=coff em=lynx ;;
279 sparc-fujitsu-none) fmt=aout ;;
280 sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*)
282 sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
283 sparc-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
285 # start-sanitize-tic80
286 tic80-*-*) fmt=coff ;;
288 v850-*-*) fmt=elf bfd_gas=yes ;;
290 # start-sanitize-v850e
291 v850e-*-*) fmt=elf bfd_gas=yes ;;
292 v850eq-*-*) fmt=elf bfd_gas=yes ;;
294 vax-*-bsd* | vax-*-ultrix*)
296 vax-*-vms) fmt=vms ;;
298 z8k-*-coff | z8k-*-sim)
303 *-*-aout | *-*-scout)
309 *-*-generic) fmt=generic ;;
310 *-*-xray | *-*-hms) fmt=coff ;;
312 *-*-elf | *-*-sysv4* | *-*-solaris*)
313 AC_MSG_WARN(GAS support for ${generic_target} is incomplete.)
315 *-*-vxworks) fmt=aout ;;
316 *-*-netware) fmt=elf ;;
319 case ${cpu_type}-${fmt} in
320 alpha*-*) bfd_gas=yes ;;
321 arm-*) bfd_gas=yes ;;
323 # i386-aout) bfd_gas=preferred ;;
324 mips-*) bfd_gas=yes ;;
325 ns32k-*) bfd_gas=yes ;;
326 ppc-*) bfd_gas=yes ;;
327 sparc-*) bfd_gas=yes ;;
328 *-elf) bfd_gas=yes ;;
329 *-ecoff) bfd_gas=yes ;;
330 *-som) bfd_gas=yes ;;
334 # Other random stuff.
336 # do we need the opcodes library?
342 if test "${shared_opcodes}" = "true"; then
343 # A shared libopcodes must be linked against libbfd.
351 case ${extra_objects} in
353 *) extra_objects="$extra_objects cgen.o"
354 AC_DEFINE(USING_CGEN)
360 case ${extra_objects} in
362 *) extra_objects="$extra_objects m68k-parse.o" ;;
367 echo ${extra_objects} | grep -s "itbl-parse.o"
368 if test $? -ne 0 ; then
369 extra_objects="$extra_objects itbl-parse.o"
372 echo ${extra_objects} | grep -s "itbl-lex.o"
373 if test $? -ne 0 ; then
374 extra_objects="$extra_objects itbl-lex.o"
377 echo ${extra_objects} | grep -s "itbl-ops.o"
378 if test $? -ne 0 ; then
379 extra_objects="$extra_objects itbl-ops.o"
384 if test $this_target = $target ; then
385 AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}")
393 # See if we really can support this configuration with the emulation code.
395 if test $this_target = $target ; then
396 primary_bfd_gas=$bfd_gas
400 if test $bfd_gas = no ; then
401 # Can't support other configurations this way.
404 elif test $bfd_gas = no ; then
405 # Can't support this configuration.
409 # From target name and format, produce a list of supported emulations.
411 case ${generic_target}-${fmt} in
412 mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
413 mips-*-linux*-*) case "$endian" in
414 big) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
415 *) emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;;
417 mips-*-lnews*-ecoff) ;;
418 mips-*-*-ecoff) case "$endian" in
419 big) emulation="mipsbecoff mipslecoff mipsecoff" ;;
420 *) emulation="mipslecoff mipsbecoff mipsecoff" ;;
422 mips-*-*-elf) case "$endian" in
423 big) emulation="mipsbelf mipslelf mipself" ;;
424 *) emulation="mipslelf mipsbelf mipself" ;;
425 # Uncommenting the next line will turn on support for i386 COFF
426 # in any i386 ELF configuration. This probably doesn't work
428 # i386-*-*-elf) emulation="i386coff i386elf" ;;
432 emulations="$emulations $emulation"
436 # Assign floating point type. Most processors with FP support
437 # IEEE FP. On those that don't support FP at all, usually IEEE
439 case ${target_cpu} in
440 vax | tahoe ) atof=${target_cpu} ;;
444 case "${obj_format}" in
445 "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
449 dnl Make sure the desired support files exist.
452 if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
453 AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
456 if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
457 AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
460 case ${user_bfd_gas}-${primary_bfd_gas} in
462 # We didn't override user's choice.
465 AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
477 # User specified nothing.
481 # Some COFF configurations want these random other flags set.
482 case ${obj_format} in
484 case ${target_cpu_type} in
485 i386) AC_DEFINE(I386COFF) ;;
486 m68k) AC_DEFINE(M68KCOFF) ;;
487 m88k) AC_DEFINE(M88KCOFF) ;;
492 # Getting this done right is going to be a bitch. Each configuration specified
493 # with --enable-targets=... should be checked for environment, format, cpu, and
496 # For each configuration, the necessary object file support code must be linked
497 # in. This might be only one, it might be up to four. The necessary emulation
498 # code needs to be provided, too.
500 # And then there's "--enable-targets=all"....
502 # For now, just always do it for MIPS ELF or ECOFF configurations. Sigh.
504 formats="${obj_format}"
508 for em in . $emulations ; do
512 fmt=elf file=mipself ;;
513 mipsbecoff | mipslecoff)
514 fmt=ecoff file=mipsecoff ;;
516 fmt=coff file=i386coff ;;
518 fmt=elf file=i386elf ;;
520 formats="$formats $fmt"
521 emfiles="$emfiles e-$file.o"
522 EMULATIONS="$EMULATIONS &$em,"
526 if test `set . $formats ; shift ; echo $#` -gt 1 ; then
527 for fmt in $formats ; do
529 aout) AC_DEFINE(OBJ_MAYBE_AOUT) ;;
530 bout) AC_DEFINE(OBJ_MAYBE_BOUT) ;;
531 coff) AC_DEFINE(OBJ_MAYBE_COFF) ;;
532 ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF) ;;
533 elf) AC_DEFINE(OBJ_MAYBE_ELF) ;;
534 generic) AC_DEFINE(OBJ_MAYBE_GENERIC) ;;
535 hp300) AC_DEFINE(OBJ_MAYBE_HP300) ;;
536 ieee) AC_DEFINE(OBJ_MAYBE_IEEE) ;;
537 som) AC_DEFINE(OBJ_MAYBE_SOM) ;;
538 vms) AC_DEFINE(OBJ_MAYBE_VMS) ;;
540 extra_objects="$extra_objects obj-$fmt.o"
544 if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
546 extra_objects="$extra_objects $emfiles"
547 DEFAULT_EMULATION=`set . $emulations ; echo $2`
548 AC_DEFINE(USE_EMULATIONS)
550 AC_SUBST(extra_objects)
551 AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS)
552 AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION")
554 case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
555 yes-*-coff) need_bfd=yes ;;
556 no-*-coff) need_bfd=yes
557 AC_DEFINE(MANY_SEGMENTS) ;;
560 reject_dev_configs=yes
562 case ${reject_dev_configs}-${dev} in
564 AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
568 AC_SUBST(target_cpu_type)
572 dnl AC_SUBST(emulation)
574 case "${primary_bfd_gas}" in
575 yes) AC_DEFINE(BFD_ASSEMBLER)
579 # do we need the opcodes library?
580 case "${need_opcodes}" in
582 OPCODES_LIB=../opcodes/libopcodes.la
586 case "${need_bfd}" in
588 BFDLIB=../bfd/libbfd.la
589 ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
594 AC_SUBST(OPCODES_LIB)
596 AC_SUBST(ALL_OBJ_DEPS)
598 AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}")
599 AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}")
600 AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}")
601 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}")
602 AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}")
614 AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
616 # Put this here so that autoconf's "cross-compiling" message doesn't confuse
617 # people who are not cross-compiling but are compiling cross-assemblers.
618 AC_MSG_CHECKING(whether compiling a cross-assembler)
619 if test "${host}" = "${target}"; then
623 AC_DEFINE(CROSS_COMPILE)
625 AC_MSG_RESULT($cross_gas)
627 dnl ansidecl.h will deal with const
632 # VMS doesn't have unlink.
633 AC_CHECK_FUNCS(unlink remove, break)
635 # Some systems don't have sbrk().
638 # Some non-ANSI preprocessors botch requoting inside strings. That's bad
639 # enough, but on some of those systems, the assert macro relies on requoting
643 # On some systems, the system header files may not declare malloc, realloc,
644 # and free. There are places where gas needs these functions to have been
645 # declared -- such as when taking their addresses.
653 #ifdef HAVE_STRINGS_H
664 GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
665 GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
666 GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
667 GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
669 # Does errno.h declare errno, or do we have to add a separate declaration
671 GAS_CHECK_DECL_NEEDED(errno, f, int f, [
677 dnl This must come last.
679 dnl We used to make symlinks to files in the source directory, but now
680 dnl we just use the right name for .c files, and create .h files in
681 dnl the build directory which include the right .h file. Make sure
682 dnl the old symlinks don't exist, so that a reconfigure in an existing
683 dnl directory behaves reasonably.
685 AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in,
686 [rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
687 echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
688 echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
689 echo '#include "te-'"${te_file}"'.h"' > targ-env.h
690 echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
691 case ${target_cpu_type} in
692 m32r) echo '#include "opcodes/'"${target_cpu_type}"'-opc.h"' > cgen-opc.h ;;
694 [target_cpu_type=${target_cpu_type}
695 obj_format=${obj_format}