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
70 armeb) cpu_type=arm endian=big ;;
71 arm*) cpu_type=arm endian=little ;;
72 thumb*) cpu_type=arm endian=little ;;
73 hppa*) cpu_type=hppa ;;
75 i[456]86) cpu_type=i386 ;;
76 m680[012346]0) cpu_type=m68k ;;
77 m68008) cpu_type=m68k ;;
78 m683??) cpu_type=m68k ;;
81 mips*el) cpu_type=mips endian=little ;;
82 mips*5900*) cpu_type=mips endian=little ;;
83 mips*) cpu_type=mips endian=big ;;
84 powerpcle*) cpu_type=ppc endian=little ;;
85 powerpc*) cpu_type=ppc endian=big ;;
86 rs6000*) cpu_type=ppc ;;
87 sparc64) cpu_type=sparc want_sparc_v9=true ;;
88 sparc*) cpu_type=sparc ;;
92 if test ${this_target} = $target ; then
93 target_cpu_type=${cpu_type}
94 elif test ${target_cpu_type} != ${cpu_type} ; then
99 generic_target=${cpu_type}-$vendor-$os
104 # assign object format
105 case ${generic_target} in
106 a29k-*-coff) fmt=coff targ=ebmon29k ;;
107 a29k-amd-udi) fmt=coff targ=ebmon29k ;;
108 a29k-amd-ebmon) fmt=coff targ=ebmon29k ;;
109 a29k-nyu-sym1) fmt=coff targ=ebmon29k ;;
110 a29k-*-vxworks*) fmt=coff ;;
112 alpha-*-*vms*) fmt=evax ;;
113 alpha-*-netware*) fmt=ecoff ;;
114 alpha-*-openbsd*) fmt=ecoff ;;
115 alpha-*-osf*) fmt=ecoff ;;
116 alpha-*-linuxecoff*) fmt=ecoff ;;
117 alpha-*-linux*) fmt=elf em=linux ;;
120 arc-*-elf*) fmt=elf bfd_gas=yes ;;
123 arm-*-riscix*) fmt=aout targ=arm-lit em=riscix ;;
130 arm-*-coff | thumb-*-coff) fmt=coff ;;
131 arm-*-riscix*) fmt=aout ;;
132 arm-*-pe) fmt=coff targ=armcoff 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 targ=i386coff
151 i386-sequent-bsd*) fmt=aout em=dynix bfd_gas=yes ;;
152 i386-*-bsd*) fmt=aout em=386bsd ;;
153 i386-*-netbsd0.8) fmt=aout em=386bsd ;;
154 i386-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes;;
155 i386-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes;;
156 i386-*-linux*aout* | i386-*-linuxoldld) fmt=aout em=linux ;;
157 i386-*-linux*coff*) fmt=coff em=linux
159 i386-*-linux*) fmt=elf em=linux ;;
160 i386-*-lynxos*) fmt=coff targ=i386coff
162 i386-*-sysv4* | i386-*-solaris* | i386-*-elf | i386-*-freebsdelf*)
164 i386-*-sco*elf*) fmt=elf targ=sco5 ;;
165 i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*)
166 fmt=coff targ=i386coff ;;
167 i386-*-vsta) fmt=aout ;;
168 i386-*-msdosdjgpp* | i386-*-go32*)
169 fmt=coff targ=coffgo32 em=go32;;
170 i386-*-rtems*) fmt=coff targ=i386coff ;;
171 i386-*-gnu*) fmt=elf ;;
173 fmt=aout em=mach bfd_gas=yes ;;
174 i386-*-msdos*) fmt=aout ;;
175 i386-*-moss*) fmt=elf ;;
176 i386-*-pe) fmt=coff targ=i386coff em=pe ;;
177 i386-*-cygwin32) fmt=coff targ=i386coff em=pe bfd_gas=yes ;;
178 i386-*-*nt) fmt=coff targ=i386coff em=pe ;;
179 i960-*-bout) fmt=bout ;;
180 i960-*-coff) fmt=coff em=ic960 targ=ic960coff ;;
181 i960-*-rtems*) fmt=coff em=ic960 targ=ic960coff ;;
182 i960-*-nindy*) fmt=bout ;;
183 i960-*-vxworks4*) fmt=bout ;;
184 i960-*-vxworks5.0) fmt=bout ;;
185 i960-*-vxworks5.*) fmt=coff em=ic960 targ=ic960coff ;;
186 i960-*-vxworks*) fmt=bout ;;
188 m32r-*-*) fmt=elf bfd_gas=yes ;;
190 m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
192 m68k-motorola-sysv*) fmt=coff targ=m68kcoff em=delta ;;
193 m68k-bull-sysv3*) fmt=coff targ=m68kcoff em=dpx2 ;;
194 m68k-apollo-*) fmt=coff targ=apollo em=apollo ;;
195 m68k-*-sysv4*) # must be before -sysv*
197 m68k-*-elf*) fmt=elf ;;
198 m68k-*-coff | m68k-*-sysv* | m68k-*-rtems*)
199 fmt=coff targ=m68kcoff ;;
200 m68k-*-hpux*) fmt=hp300 em=hp300 ;;
201 m68k-*-linux*aout*) fmt=aout em=linux ;;
202 m68k-*-linux*) fmt=elf em=linux ;;
203 m68k-*-lynxos*) fmt=coff targ=m68kcoff
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 targ=m68kcoff em=aux ;;
208 m68k-*-psos*) fmt=elf em=psos;;
210 m88k-motorola-sysv3*) fmt=coff targ=m88kcoff em=delt88 ;;
211 m88k-*-coff*) fmt=coff targ=m88kcoff ;;
213 # don't change em like *-*-bsd does
214 mips-dec-netbsd*) fmt=elf targ=mips-lit endian=little ;;
215 mips-dec-openbsd*) fmt=elf targ=mips-lit endian=little ;;
216 mips-dec-bsd*) fmt=aout targ=mips-lit ;;
217 mips-sony-bsd*) fmt=ecoff targ=mips-big ;;
218 mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
219 mips-*-ultrix*) fmt=ecoff targ=mips-lit endian=little ;;
220 mips-*-osf*) fmt=ecoff targ=mips-lit endian=little ;;
221 mips-*-ecoff*) fmt=ecoff
223 big) targ=mips-big ;;
227 mips-*-ecoff*) fmt=ecoff targ=mips-big ;;
228 mips-*-irix6*) fmt=elf targ=mips-big ;;
229 mips-*-irix5*) fmt=elf targ=mips-big ;;
230 mips-*-irix*) fmt=ecoff targ=mips-big ;;
231 mips-*-lnews*) fmt=ecoff targ=mips-lit em=lnews ;;
232 mips-*-riscos*) fmt=ecoff targ=mips-big ;;
233 mips-*-sysv*) fmt=ecoff targ=mips-big ;;
234 mips-*-elf* | mips-*-rtems* | mips-*-linux* | mips-*-gnu* | mips-*-openbsd*)
237 big) targ=mips-big ;;
241 mn10200-*-*) fmt=elf bfd_gas=yes ;;
242 mn10300-*-*) fmt=elf bfd_gas=yes ;;
243 ppc-*-pe | ppc-*-cygwin32 | ppc-*-winnt*)
250 ppc-*-aix*) fmt=coff ;;
251 ppc-*-beos*) fmt=coff ;;
252 ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
259 ppc-*-linux*) fmt=elf
262 *) AC_MSG_ERROR(Linux must be configured big endian) ;;
265 ppc-*-solaris*) fmt=elf
267 big) AC_MSG_ERROR(Solaris must be configured little endian) ;;
278 ppc-*-macos* | ppc-*-mpw*)
280 ppc-*-netware*) fmt=elf em=ppcnw ;;
282 sh-*-elf*) fmt=elf ;;
283 sh-*-coff*) fmt=coff ;;
285 ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;;
286 ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;;
287 ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;
289 sparc-*-rtems*) fmt=aout ;;
290 sparc-*-sunos4*) fmt=aout em=sun3 ;;
291 sparc-*-aout | sparc*-*-vxworks*)
292 fmt=aout em=sparcaout ;;
293 sparc-*-coff) fmt=coff ;;
294 sparc-*-linux*aout*) fmt=aout em=linux ;;
295 sparc-*-linux*) fmt=elf em=linux ;;
296 sparc-*-lynxos*) fmt=coff em=lynx ;;
297 sparc-fujitsu-none) fmt=aout ;;
298 sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*)
300 sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
301 sparc-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
303 # start-sanitize-tic80
304 tic80-*-*) fmt=coff targ=tic80coff;;
306 # start-sanitize-v850
307 v850-*-*) fmt=elf bfd_gas=yes ;;
310 vax-*-bsd* | vax-*-ultrix*)
312 vax-*-vms) fmt=vms ;;
314 z8k-*-coff | z8k-*-sim)
319 *-*-aout | *-*-scout)
325 *-*-generic) fmt=generic ;;
326 *-*-xray | *-*-hms) fmt=coff ;;
328 *-*-elf | *-*-sysv4* | *-*-solaris*)
329 AC_MSG_WARN(GAS support for ${generic_target} is incomplete.)
331 *-*-vxworks) fmt=aout ;;
332 *-*-netware) fmt=elf ;;
335 case ${cpu_type}-${fmt} in
336 alpha-*) bfd_gas=yes ;;
337 arm-*) bfd_gas=yes ;;
339 # i386-aout) bfd_gas=preferred ;;
340 mips-*) bfd_gas=yes ;;
341 ns32k-*) bfd_gas=yes ;;
342 ppc-*) bfd_gas=yes ;;
343 sparc-*) bfd_gas=yes ;;
344 *-elf) bfd_gas=yes ;;
345 *-ecoff) bfd_gas=yes ;;
346 *-som) bfd_gas=yes ;;
350 # Other random stuff.
352 # do we need the opcodes library?
358 if test "${shared_opcodes}" = "true"; then
359 # A shared libopcodes must be linked against libbfd.
365 test -n "$want_sparc_v9" && AC_DEFINE(SPARC_V9)
367 case ${cpu}-${vendor}-${os} in
368 sparc64-*-elf*) AC_DEFINE(SPARC_ARCH64) ;;
373 case ${extra_objects} in
375 *) extra_objects="$extra_objects cgen.o"
376 AC_DEFINE(USING_CGEN)
382 case ${extra_objects} in
384 *) extra_objects="$extra_objects m68k-parse.o" ;;
389 echo ${extra_objects} | grep -s "itbl-parse.o"
390 if test $? -ne 0 ; then
391 extra_objects="$extra_objects itbl-parse.o"
394 echo ${extra_objects} | grep -s "itbl-lex.o"
395 if test $? -ne 0 ; then
396 extra_objects="$extra_objects itbl-lex.o"
399 echo ${extra_objects} | grep -s "itbl-ops.o"
400 if test $? -ne 0 ; then
401 extra_objects="$extra_objects itbl-ops.o"
409 # See if we really can support this configuration with the emulation code.
411 if test $this_target = $target ; then
412 primary_bfd_gas=$bfd_gas
417 if test $bfd_gas = no ; then
418 # Can't support other configurations this way.
421 elif test $bfd_gas = no ; then
422 # Can't support this configuration.
426 # From target name and format, produce a list of supported emulations.
428 case ${generic_target}-${fmt} in
429 mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
430 mips-*-linux*-*) case "$endian" in
431 big) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
432 *) emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;;
434 mips-*-lnews*-ecoff) ;;
435 mips-*-*-ecoff) case "$endian" in
436 big) emulation="mipsbecoff mipslecoff mipsecoff" ;;
437 *) emulation="mipslecoff mipsbecoff mipsecoff" ;;
439 mips-*-*-elf) case "$endian" in
440 big) emulation="mipsbelf mipslelf mipself" ;;
441 *) emulation="mipslelf mipsbelf mipself" ;;
442 # Uncommenting the next line will turn on support for i386 COFF
443 # in any i386 ELF configuration. This probably doesn't work
445 # i386-*-*-elf) emulation="i386coff i386elf" ;;
449 emulations="$emulations $emulation"
453 # Assign floating point type. Most processors with FP support
454 # IEEE FP. On those that don't support FP at all, usually IEEE
456 case ${target_cpu} in
457 vax | tahoe ) atof=${target_cpu} ;;
461 case "${obj_format}" in
462 "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
466 dnl Make sure the desired support files exist.
469 if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
470 AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
473 if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
474 AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
477 # and target makefile frag
479 target_frag=${srcdir}/config/${gas_target}.mt
480 if test ! -r ${target_frag}; then
481 target_frag=/dev/null # ick! but subst_file can't be conditionalized
483 AC_SUBST_FILE(target_frag)
485 case ${user_bfd_gas}-${primary_bfd_gas} in
487 # We didn't override user's choice.
490 AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
502 # User specified nothing.
506 # Some COFF configurations want these random other flags set.
507 case ${obj_format} in
509 case ${target_cpu_type} in
510 i386) AC_DEFINE(I386COFF) ;;
511 m68k) AC_DEFINE(M68KCOFF) ;;
512 m88k) AC_DEFINE(M88KCOFF) ;;
517 # Getting this done right is going to be a bitch. Each configuration specified
518 # with --enable-targets=... should be checked for environment, format, cpu, and
521 # For each configuration, the necessary object file support code must be linked
522 # in. This might be only one, it might be up to four. The necessary emulation
523 # code needs to be provided, too.
525 # And then there's "--enable-targets=all"....
527 # For now, just always do it for MIPS ELF or ECOFF configurations. Sigh.
529 formats="${obj_format}"
533 for em in . $emulations ; do
537 fmt=elf file=mipself ;;
538 mipsbecoff | mipslecoff)
539 fmt=ecoff file=mipsecoff ;;
541 fmt=coff file=i386coff ;;
543 fmt=elf file=i386elf ;;
545 formats="$formats $fmt"
546 emfiles="$emfiles e-$file.o"
547 EMULATIONS="$EMULATIONS &$em,"
551 if test `set . $formats ; shift ; echo $#` -gt 1 ; then
552 for fmt in $formats ; do
554 aout) AC_DEFINE(OBJ_MAYBE_AOUT) ;;
555 bout) AC_DEFINE(OBJ_MAYBE_BOUT) ;;
556 coff) AC_DEFINE(OBJ_MAYBE_COFF) ;;
557 ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF) ;;
558 elf) AC_DEFINE(OBJ_MAYBE_ELF) ;;
559 generic) AC_DEFINE(OBJ_MAYBE_GENERIC) ;;
560 hp300) AC_DEFINE(OBJ_MAYBE_HP300) ;;
561 ieee) AC_DEFINE(OBJ_MAYBE_IEEE) ;;
562 som) AC_DEFINE(OBJ_MAYBE_SOM) ;;
563 vms) AC_DEFINE(OBJ_MAYBE_VMS) ;;
565 extra_objects="$extra_objects obj-$fmt.o"
569 if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
571 extra_objects="$extra_objects $emfiles"
572 DEFAULT_EMULATION=`set . $emulations ; echo $2`
573 AC_DEFINE(USE_EMULATIONS)
575 AC_SUBST(extra_objects)
576 AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS)
577 AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION")
579 case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
580 yes-*-coff) need_bfd=yes ;;
581 no-*-coff) need_bfd=yes
582 AC_DEFINE(MANY_SEGMENTS) ;;
585 reject_dev_configs=yes
587 case ${reject_dev_configs}-${dev} in
589 AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
593 AC_SUBST(target_cpu_type)
597 dnl AC_SUBST(emulation)
599 case "${primary_bfd_gas}" in
600 yes) AC_DEFINE(BFD_ASSEMBLER)
604 # do we need the opcodes library?
605 case "${need_opcodes}" in
607 OPCODES_LIB=../opcodes/libopcodes.la
611 case "${need_bfd}" in
613 BFDLIB=../bfd/libbfd.la
614 ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
619 AC_SUBST(OPCODES_LIB)
621 AC_SUBST(ALL_OBJ_DEPS)
623 AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}")
624 AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}")
625 AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}")
626 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}")
627 AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}")
640 AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
642 # Put this here so that autoconf's "cross-compiling" message doesn't confuse
643 # people who are not cross-compiling but are compiling cross-assemblers.
644 AC_MSG_CHECKING(whether compiling a cross-assembler)
645 if test "${host}" = "${target}"; then
649 AC_DEFINE(CROSS_COMPILE)
651 AC_MSG_RESULT($cross_gas)
653 dnl ansidecl.h will deal with const
658 # VMS doesn't have unlink.
659 AC_CHECK_FUNCS(unlink remove, break)
661 # Some systems don't have sbrk().
664 # Some non-ANSI preprocessors botch requoting inside strings. That's bad
665 # enough, but on some of those systems, the assert macro relies on requoting
669 # On some systems, the system header files may not declare malloc, realloc,
670 # and free. There are places where gas needs these functions to have been
671 # declared -- such as when taking their addresses.
679 #ifdef HAVE_STRINGS_H
690 GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
691 GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
692 GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
693 GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
695 # Does errno.h declare errno, or do we have to add a separate declaration
697 GAS_CHECK_DECL_NEEDED(errno, f, int f, [
703 dnl This must come last.
705 dnl We used to make symlinks to files in the source directory, but now
706 dnl we just use the right name for .c files, and create .h files in
707 dnl the build directory which include the right .h file. Make sure
708 dnl the old symlinks don't exist, so that a reconfigure in an existing
709 dnl directory behaves reasonably.
711 AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in,
712 [rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
713 echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
714 echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
715 echo '#include "te-'"${te_file}"'.h"' > targ-env.h
716 echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
717 case ${target_cpu_type} in
718 m32r) echo '#include "opcodes/'"${target_cpu_type}"'-opc.h"' > cgen-opc.h ;;
720 [target_cpu_type=${target_cpu_type}
721 obj_format=${obj_format}