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
71 armeb) cpu_type=arm endian=big ;;
72 arm*) cpu_type=arm endian=little ;;
73 thumb*) cpu_type=arm endian=little ;;
74 hppa*) cpu_type=hppa ;;
76 i[456]86) cpu_type=i386 ;;
77 m680[012346]0) cpu_type=m68k ;;
78 m68008) cpu_type=m68k ;;
79 m683??) cpu_type=m68k ;;
82 mips*el) cpu_type=mips endian=little ;;
83 mips*5900*) cpu_type=mips endian=little ;;
84 mips*) cpu_type=mips endian=big ;;
85 powerpcle*) cpu_type=ppc endian=little ;;
86 powerpc*) cpu_type=ppc endian=big ;;
87 rs6000*) cpu_type=ppc ;;
88 sparc64) cpu_type=sparc want_sparc_v9=true ;;
89 sparc*) cpu_type=sparc ;;
93 if test ${this_target} = $target ; then
94 target_cpu_type=${cpu_type}
95 if test x${endian} = xbig; then
96 AC_DEFINE(TARGET_BYTES_BIG_ENDIAN, 1)
97 elif test x${endian} = xlittle; then
98 AC_DEFINE(TARGET_BYTES_BIG_ENDIAN, 0)
100 elif test ${target_cpu_type} != ${cpu_type} ; then
104 generic_target=${cpu_type}-$vendor-$os
109 # assign object format
110 case ${generic_target} in
111 a29k-*-coff) fmt=coff ;;
112 a29k-amd-udi) fmt=coff ;;
113 a29k-amd-ebmon) fmt=coff ;;
114 a29k-nyu-sym1) fmt=coff ;;
115 a29k-*-vxworks*) fmt=coff ;;
117 alpha-*-*vms*) fmt=evax ;;
118 alpha-*-netware*) fmt=ecoff ;;
119 alpha-*-openbsd*) fmt=ecoff ;;
120 alpha-*-osf*) fmt=ecoff ;;
121 alpha-*-linuxecoff*) fmt=ecoff ;;
122 alpha-*-linux*) fmt=elf em=linux ;;
125 arc-*-elf*) fmt=elf bfd_gas=yes ;;
128 arm-*-riscix*) fmt=aout em=riscix ;;
129 arm-*-aout) fmt=aout ;;
130 arm-*-coff | thumb-*-coff) fmt=coff ;;
131 arm-*-riscix*) fmt=aout ;;
132 arm-*-pe) fmt=coff em=pe ;;
134 d10v-*-*) fmt=elf bfd_gas=yes ;;
135 # start-sanitize-d30v
136 d30v-*-*) fmt=elf bfd_gas=yes ;;
139 hppa-*-*elf*) fmt=elf em=hppa ;;
140 hppa-*-lites*) fmt=elf em=hppa ;;
141 hppa-*-osf*) fmt=som em=hppa ;;
142 hppa-*-rtems*) fmt=elf em=hppa ;;
143 hppa-*-hpux*) fmt=som em=hppa ;;
144 hppa-*-bsd*) fmt=som em=hppa ;;
145 hppa-*-hiux*) fmt=som em=hppa ;;
147 h8300-*-coff) fmt=coff ;;
149 i386-ibm-aix*) fmt=coff em=i386aix ;;
150 i386-sequent-bsd*) fmt=aout em=dynix bfd_gas=yes ;;
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-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes;;
155 i386-*-linux*aout* | i386-*-linuxoldld) fmt=aout em=linux ;;
156 i386-*-linux*coff*) fmt=coff em=linux ;;
157 i386-*-linux*) fmt=elf em=linux ;;
158 i386-*-lynxos*) fmt=coff em=lynx ;;
159 i386-*-sysv4* | i386-*-solaris* | i386-*-elf | i386-*-freebsdelf*)
161 i386-*-sco*elf*) fmt=elf
162 if test ${this_target} = $target; then
166 i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*)
168 i386-*-vsta) fmt=aout ;;
169 i386-*-msdosdjgpp* | i386-*-go32*)
171 i386-*-rtems*) fmt=coff ;;
172 i386-*-gnu*) fmt=elf ;;
174 fmt=aout em=mach bfd_gas=yes ;;
175 i386-*-msdos*) fmt=aout ;;
176 i386-*-moss*) fmt=elf ;;
177 i386-*-pe) fmt=coff em=pe ;;
178 i386-*-cygwin32) fmt=coff em=pe bfd_gas=yes ;;
179 i386-*-*nt) fmt=coff em=pe ;;
180 i960-*-bout) fmt=bout ;;
181 i960-*-coff) fmt=coff em=ic960 ;;
182 i960-*-rtems*) fmt=coff em=ic960 ;;
183 i960-*-nindy*) fmt=bout ;;
184 i960-*-vxworks4*) fmt=bout ;;
185 i960-*-vxworks5.0) fmt=bout ;;
186 i960-*-vxworks5.*) fmt=coff em=ic960 ;;
187 i960-*-vxworks*) fmt=bout ;;
189 m32r-*-*) fmt=elf bfd_gas=yes ;;
191 m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
193 m68k-motorola-sysv*) fmt=coff em=delta ;;
194 m68k-bull-sysv3*) fmt=coff em=dpx2 ;;
195 m68k-apollo-*) fmt=coff em=apollo ;;
196 m68k-*-sysv4*) # must be before -sysv*
198 m68k-*-elf*) fmt=elf ;;
199 m68k-*-coff | m68k-*-sysv* | m68k-*-rtems*)
201 m68k-*-hpux*) fmt=hp300 em=hp300 ;;
202 m68k-*-linux*aout*) fmt=aout em=linux ;;
203 m68k-*-linux*) fmt=elf em=linux ;;
204 m68k-*-lynxos*) fmt=coff em=lynx ;;
205 m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
206 m68k-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
207 m68k-apple-aux*) fmt=coff em=aux ;;
208 m68k-*-psos*) fmt=elf em=psos;;
210 m88k-motorola-sysv3*) fmt=coff em=delt88 ;;
211 m88k-*-coff*) fmt=coff ;;
213 # don't change em like *-*-bsd does
214 mips-dec-netbsd*) fmt=elf endian=little ;;
215 mips-dec-openbsd*) fmt=elf endian=little ;;
216 mips-dec-bsd*) fmt=aout ;;
217 mips-sony-bsd*) fmt=ecoff ;;
218 mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
219 mips-*-ultrix*) fmt=ecoff endian=little ;;
220 mips-*-osf*) fmt=ecoff endian=little ;;
221 mips-*-ecoff*) fmt=ecoff ;;
222 mips-*-ecoff*) fmt=ecoff ;;
223 mips-*-irix6*) fmt=elf ;;
224 mips-*-irix5*) fmt=elf ;;
225 mips-*-irix*) fmt=ecoff ;;
226 mips-*-lnews*) fmt=ecoff em=lnews ;;
227 mips-*-riscos*) fmt=ecoff ;;
228 mips-*-sysv*) fmt=ecoff ;;
229 mips-*-elf* | mips-*-rtems* | mips-*-linux* | mips-*-gnu* | mips-*-openbsd*)
231 mn10200-*-*) fmt=elf bfd_gas=yes ;;
232 mn10300-*-*) fmt=elf bfd_gas=yes ;;
233 ppc-*-pe | ppc-*-cygwin32 | ppc-*-winnt*)
235 ppc-*-aix*) fmt=coff ;;
236 ppc-*-beos*) fmt=coff ;;
237 ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
239 ppc-*-linux*) fmt=elf
242 *) AC_MSG_ERROR(Linux must be configured big endian) ;;
245 ppc-*-solaris*) fmt=elf
246 if test ${this_target} = $target; then
247 AC_DEFINE(TARGET_SOLARIS_COMMENT)
249 if test x${endian} = xbig; then
250 AC_MSG_ERROR(Solaris must be configured little endian)
253 ppc-*-rtems*) fmt=elf ;;
254 ppc-*-macos* | ppc-*-mpw*)
256 ppc-*-netware*) fmt=elf em=ppcnw ;;
258 sh-*-elf*) fmt=elf ;;
259 sh-*-coff*) fmt=coff ;;
261 ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;;
262 ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;;
263 ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;
265 sparc-*-rtems*) fmt=aout ;;
266 sparc-*-sunos4*) fmt=aout em=sun3 ;;
267 sparc-*-aout | sparc*-*-vxworks*)
268 fmt=aout em=sparcaout ;;
269 sparc-*-coff) fmt=coff ;;
270 sparc-*-linux*aout*) fmt=aout em=linux ;;
271 sparc-*-linux*) fmt=elf em=linux ;;
272 sparc-*-lynxos*) fmt=coff em=lynx ;;
273 sparc-fujitsu-none) fmt=aout ;;
274 sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*)
276 sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
277 sparc-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
279 # start-sanitize-tic80
280 tic80-*-*) fmt=coff ;;
282 v850-*-*) fmt=elf bfd_gas=yes ;;
284 # start-sanitize-v850e
285 v850e-*-*) fmt=elf bfd_gas=yes ;;
287 # start-sanitize-v850eq
288 v850eq-*-*) fmt=elf bfd_gas=yes ;;
289 # end-sanitize-v850eq
290 vax-*-bsd* | vax-*-ultrix*)
292 vax-*-vms) fmt=vms ;;
294 z8k-*-coff | z8k-*-sim)
299 *-*-aout | *-*-scout)
305 *-*-generic) fmt=generic ;;
306 *-*-xray | *-*-hms) fmt=coff ;;
308 *-*-elf | *-*-sysv4* | *-*-solaris*)
309 AC_MSG_WARN(GAS support for ${generic_target} is incomplete.)
311 *-*-vxworks) fmt=aout ;;
312 *-*-netware) fmt=elf ;;
315 case ${cpu_type}-${fmt} in
316 alpha-*) bfd_gas=yes ;;
317 arm-*) bfd_gas=yes ;;
319 # i386-aout) bfd_gas=preferred ;;
320 mips-*) bfd_gas=yes ;;
321 ns32k-*) bfd_gas=yes ;;
322 ppc-*) bfd_gas=yes ;;
323 sparc-*) bfd_gas=yes ;;
324 *-elf) bfd_gas=yes ;;
325 *-ecoff) bfd_gas=yes ;;
326 *-som) bfd_gas=yes ;;
330 # Other random stuff.
332 # do we need the opcodes library?
338 if test "${shared_opcodes}" = "true"; then
339 # A shared libopcodes must be linked against libbfd.
345 test -n "$want_sparc_v9" && AC_DEFINE(SPARC_V9)
347 case ${cpu}-${vendor}-${os} in
348 sparc64-*-elf*) AC_DEFINE(SPARC_ARCH64) ;;
353 case ${extra_objects} in
355 *) extra_objects="$extra_objects cgen.o"
356 AC_DEFINE(USING_CGEN)
362 case ${extra_objects} in
364 *) extra_objects="$extra_objects m68k-parse.o" ;;
369 echo ${extra_objects} | grep -s "itbl-parse.o"
370 if test $? -ne 0 ; then
371 extra_objects="$extra_objects itbl-parse.o"
374 echo ${extra_objects} | grep -s "itbl-lex.o"
375 if test $? -ne 0 ; then
376 extra_objects="$extra_objects itbl-lex.o"
379 echo ${extra_objects} | grep -s "itbl-ops.o"
380 if test $? -ne 0 ; then
381 extra_objects="$extra_objects itbl-ops.o"
389 # See if we really can support this configuration with the emulation code.
391 if test $this_target = $target ; then
392 primary_bfd_gas=$bfd_gas
396 if test $bfd_gas = no ; then
397 # Can't support other configurations this way.
400 elif test $bfd_gas = no ; then
401 # Can't support this configuration.
405 # From target name and format, produce a list of supported emulations.
407 case ${generic_target}-${fmt} in
408 mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
409 mips-*-linux*-*) case "$endian" in
410 big) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
411 *) emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;;
413 mips-*-lnews*-ecoff) ;;
414 mips-*-*-ecoff) case "$endian" in
415 big) emulation="mipsbecoff mipslecoff mipsecoff" ;;
416 *) emulation="mipslecoff mipsbecoff mipsecoff" ;;
418 mips-*-*-elf) case "$endian" in
419 big) emulation="mipsbelf mipslelf mipself" ;;
420 *) emulation="mipslelf mipsbelf mipself" ;;
421 # Uncommenting the next line will turn on support for i386 COFF
422 # in any i386 ELF configuration. This probably doesn't work
424 # i386-*-*-elf) emulation="i386coff i386elf" ;;
428 emulations="$emulations $emulation"
432 # Assign floating point type. Most processors with FP support
433 # IEEE FP. On those that don't support FP at all, usually IEEE
435 case ${target_cpu} in
436 vax | tahoe ) atof=${target_cpu} ;;
440 case "${obj_format}" in
441 "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
445 dnl Make sure the desired support files exist.
448 if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
449 AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
452 if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
453 AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
456 case ${user_bfd_gas}-${primary_bfd_gas} in
458 # We didn't override user's choice.
461 AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
473 # User specified nothing.
477 # Some COFF configurations want these random other flags set.
478 case ${obj_format} in
480 case ${target_cpu_type} in
481 i386) AC_DEFINE(I386COFF) ;;
482 m68k) AC_DEFINE(M68KCOFF) ;;
483 m88k) AC_DEFINE(M88KCOFF) ;;
488 # Getting this done right is going to be a bitch. Each configuration specified
489 # with --enable-targets=... should be checked for environment, format, cpu, and
492 # For each configuration, the necessary object file support code must be linked
493 # in. This might be only one, it might be up to four. The necessary emulation
494 # code needs to be provided, too.
496 # And then there's "--enable-targets=all"....
498 # For now, just always do it for MIPS ELF or ECOFF configurations. Sigh.
500 formats="${obj_format}"
504 for em in . $emulations ; do
508 fmt=elf file=mipself ;;
509 mipsbecoff | mipslecoff)
510 fmt=ecoff file=mipsecoff ;;
512 fmt=coff file=i386coff ;;
514 fmt=elf file=i386elf ;;
516 formats="$formats $fmt"
517 emfiles="$emfiles e-$file.o"
518 EMULATIONS="$EMULATIONS &$em,"
522 if test `set . $formats ; shift ; echo $#` -gt 1 ; then
523 for fmt in $formats ; do
525 aout) AC_DEFINE(OBJ_MAYBE_AOUT) ;;
526 bout) AC_DEFINE(OBJ_MAYBE_BOUT) ;;
527 coff) AC_DEFINE(OBJ_MAYBE_COFF) ;;
528 ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF) ;;
529 elf) AC_DEFINE(OBJ_MAYBE_ELF) ;;
530 generic) AC_DEFINE(OBJ_MAYBE_GENERIC) ;;
531 hp300) AC_DEFINE(OBJ_MAYBE_HP300) ;;
532 ieee) AC_DEFINE(OBJ_MAYBE_IEEE) ;;
533 som) AC_DEFINE(OBJ_MAYBE_SOM) ;;
534 vms) AC_DEFINE(OBJ_MAYBE_VMS) ;;
536 extra_objects="$extra_objects obj-$fmt.o"
540 if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
542 extra_objects="$extra_objects $emfiles"
543 DEFAULT_EMULATION=`set . $emulations ; echo $2`
544 AC_DEFINE(USE_EMULATIONS)
546 AC_SUBST(extra_objects)
547 AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS)
548 AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION")
550 case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
551 yes-*-coff) need_bfd=yes ;;
552 no-*-coff) need_bfd=yes
553 AC_DEFINE(MANY_SEGMENTS) ;;
556 reject_dev_configs=yes
558 case ${reject_dev_configs}-${dev} in
560 AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
564 AC_SUBST(target_cpu_type)
568 dnl AC_SUBST(emulation)
570 case "${primary_bfd_gas}" in
571 yes) AC_DEFINE(BFD_ASSEMBLER)
575 # do we need the opcodes library?
576 case "${need_opcodes}" in
578 OPCODES_LIB=../opcodes/libopcodes.la
582 case "${need_bfd}" in
584 BFDLIB=../bfd/libbfd.la
585 ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
590 AC_SUBST(OPCODES_LIB)
592 AC_SUBST(ALL_OBJ_DEPS)
594 AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}")
595 AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}")
596 AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}")
597 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}")
598 AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}")
611 AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
613 # Put this here so that autoconf's "cross-compiling" message doesn't confuse
614 # people who are not cross-compiling but are compiling cross-assemblers.
615 AC_MSG_CHECKING(whether compiling a cross-assembler)
616 if test "${host}" = "${target}"; then
620 AC_DEFINE(CROSS_COMPILE)
622 AC_MSG_RESULT($cross_gas)
624 dnl ansidecl.h will deal with const
629 # VMS doesn't have unlink.
630 AC_CHECK_FUNCS(unlink remove, break)
632 # Some systems don't have sbrk().
635 # Some non-ANSI preprocessors botch requoting inside strings. That's bad
636 # enough, but on some of those systems, the assert macro relies on requoting
640 # On some systems, the system header files may not declare malloc, realloc,
641 # and free. There are places where gas needs these functions to have been
642 # declared -- such as when taking their addresses.
650 #ifdef HAVE_STRINGS_H
661 GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
662 GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
663 GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
664 GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
666 # Does errno.h declare errno, or do we have to add a separate declaration
668 GAS_CHECK_DECL_NEEDED(errno, f, int f, [
674 dnl This must come last.
676 dnl We used to make symlinks to files in the source directory, but now
677 dnl we just use the right name for .c files, and create .h files in
678 dnl the build directory which include the right .h file. Make sure
679 dnl the old symlinks don't exist, so that a reconfigure in an existing
680 dnl directory behaves reasonably.
682 AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in,
683 [rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
684 echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
685 echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
686 echo '#include "te-'"${te_file}"'.h"' > targ-env.h
687 echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
688 case ${target_cpu_type} in
689 m32r) echo '#include "opcodes/'"${target_cpu_type}"'-opc.h"' > cgen-opc.h ;;
691 [target_cpu_type=${target_cpu_type}
692 obj_format=${obj_format}