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.
12 AC_ARG_ENABLE(bfd-assembler,
13 [ bfd-assembler use BFD back end for writing object files],
14 [case "${enableval}" in
15 yes) need_bfd=yes user_bfd_gas=yes ;;
16 no) user_bfd_gas=no ;;
17 *) AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;;
20 # Generate a header file -- gets more post-processing by Makefile later.
21 AC_CONFIG_HEADER(conf)
23 dnl For recursion to work right, this must be an absolute pathname.
24 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
32 # check for architecture variants
34 hppa*) cpu_type=hppa ;;
36 i[45]86) cpu_type=i386 ;;
37 m680[012346]0) cpu_type=m68k ;;
38 m68008) cpu_type=m68k ;;
39 m683??) cpu_type=m68k ;;
42 mips*el) cpu_type=mips endian=little;;
43 mips*) cpu_type=mips endian=big ;;
44 powerpc*) cpu_type=ppc ;;
45 rs6000*) cpu_type=ppc ;;
46 sparc64) cpu_type=sparc obj_format=elf
48 sparclite*) cpu_type=sparc ;;
49 *) cpu_type=${target_cpu} ;;
52 # do we need the opcodes library?
57 OPCODES_LIB="../opcodes/libopcodes.a"
62 gas_target=${cpu_type}
63 generic_target=${cpu_type}-${target_vendor}-${target_os}
66 # assign object format
67 case ${generic_target} in
68 a29k-amd-udi) obj_format=coff gas_target=ebmon29k ;;
69 a29k-amd-ebmon) obj_format=coff gas_target=ebmon29k ;;
70 a29k-*-vxworks*) obj_format=coff ;;
72 alpha-*-netware*) obj_format=ecoff ;;
73 alpha-*-osf*) obj_format=ecoff ;;
76 arc-*-elf*) obj_format=elf bfd_gas=yes ;;
79 arm-*-riscix*) obj_format=aout ;;
81 hppa-*-*elf*) obj_format=elf emulation=hppa ;;
82 hppa-*-osf*) obj_format=som emulation=hppa ;;
83 hppa-*-hpux*) obj_format=som emulation=hppa ;;
84 hppa-*-bsd*) obj_format=som emulation=hppa ;;
85 hppa-*-hiux*) obj_format=som emulation=hppa ;;
87 h8300-*-coff) obj_format=coff ;;
89 i386-ibm-aix*) obj_format=coff gas_target=i386coff
91 i386-*-bsd*) obj_format=aout emulation=386bsd ;;
92 i386-*-netbsd0.8) obj_format=aout emulation=386bsd ;;
93 i386-*-netbsd*) obj_format=aout emulation=nbsd bfd_gas=yes;;
94 i386-*-linux*aout*) obj_format=aout emulation=linux ;;
95 i386-*-linux*coff*) obj_format=coff emulation=linux
96 gas_target=i386coff ;;
97 i386-*-linux*) obj_format=elf emulation=linux ;;
98 i386-*-lynxos*) obj_format=coff gas_target=i386coff
100 i386-*-sysv4* | i386-*-solaris* | i386-*-elf)
102 i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*)
103 obj_format=coff gas_target=i386coff ;;
104 i386-*-vsta) obj_format=aout ;;
105 i386-*-go32) obj_format=coff gas_target=i386coff ;;
106 i386-*-gnu*elf*) obj_format=elf ;;
107 i386-*-mach* | i386-*-gnu*)
108 obj_format=aout emulation=mach bfd_gas=yes ;;
109 i386-*-msdos*) obj_format=aout ;;
111 i960-*-bout) obj_format=bout ;;
112 i960-*-coff) obj_format=coff emulation=ic960 gas_target=ic960coff ;;
113 i960-*-nindy*) obj_format=bout ;;
114 i960-*-vxworks4*) obj_format=bout ;;
115 i960-*-vxworks5.0) obj_format=bout ;;
116 i960-*-vxworks5.*) obj_format=coff emulation=ic960 gas_target=ic960coff ;;
117 i960-*-vxworks*) obj_format=bout ;;
119 m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
120 obj_format=aout emulation=sun3 ;;
121 m68k-motorola-sysv) obj_format=coff gas_target=m68kcoff emulation=delta ;;
122 m68k-bull-sysv3*) obj_format=coff gas_target=m68kcoff emulation=dpx2 ;;
123 m68k-apollo-*) obj_format=coff gas_target=apollo emulation=apollo ;;
124 m68k-*-coff | m68k-*-sysv*)
125 obj_format=coff gas_target=m68kcoff ;;
126 m68k-*-elf) obj_format=elf ;;
127 m68k-*-hpux*) obj_format=hp300 emulation=hp300 ;;
128 m68k-*-lynxos*) obj_format=coff gas_target=m68kcoff
130 m68k-*-netbsd*) obj_format=aout emulation=nbsd bfd_gas=yes ;;
132 m88k-*-coff*) obj_format=coff gas_target=m88kcoff ;;
134 # don't change emulation like *-*-bsd does
135 mips-dec-bsd*) obj_format=aout gas_target=mips-lit ;;
136 mips-sony-bsd*) obj_format=ecoff gas_target=mips-big ;;
137 mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
138 mips-*-ultrix*) obj_format=ecoff gas_target=mips-lit ;;
139 mips-*-ecoff*) obj_format=ecoff
141 big) gas_target=mips-big ;;
142 *) gas_target=mips-lit ;;
145 mips-*-ecoff*) obj_format=ecoff gas_target=mips-big ;;
146 mips-*-gnu*) obj_format=aout
148 big) gas_target=mips-big ;;
149 *) gas_target=mips-lit ;;
152 mips-*-irix5*) obj_format=elf gas_target=mips-big ;;
153 mips-*-irix*) obj_format=ecoff gas_target=mips-big ;;
154 mips-*-riscos*) obj_format=ecoff gas_target=mips-big ;;
155 mips-*-sysv*) obj_format=ecoff gas_target=mips-big ;;
156 mips-*-elf*) obj_format=elf
158 big) gas_target=mips-big ;;
159 *) gas_target=mips-lit ;;
162 ppc-*-aix*) obj_format=coff ;;
163 ppc-*-elf*) obj_format=elf ;;
164 ppc-*-eabi*) obj_format=elf ;;
165 ppc-*-netware*) obj_format=elf emulation=ppcnw ;;
166 ppc-*-sysv4*) obj_format=elf ;;
168 sh-*-coff) obj_format=coff ;;
171 rce-*-aout) obj_format=aout ;;
174 ns32k-pc532-mach*) obj_format=aout emulation=pc532mach ;;
175 ns32k-pc532-netbsd*) obj_format=aout emulation=nbsd532 ;;
177 sparc-*-sunos4*) obj_format=aout emulation=sun3 ;;
178 sparc-*-aout | sparc*-*-vxworks)
180 sparc-*-coff) obj_format=coff ;;
181 sparc-*-lynxos*) obj_format=coff emulation=lynx ;;
182 sparc-fujitsu-none) obj_format=aout ;;
183 sparc-*-elf | sparc*-*-solaris*)
185 sparc-*-netbsd*) obj_format=aout emulation=nbsd bfd_gas=yes ;;
187 vax-*-bsd* | vax-*-ultrix*)
189 vax-*-vms) obj_format=vms ;;
191 z8k-*-coff | z8k-*-sim)
194 w65-*-*) obj_format=coff ;;
196 *-*-aout | *-*-scout)
201 obj_format=aout emulation=sun3 ;;
202 *-*-generic) obj_format=generic ;;
203 *-*-xray | *-*-hms) obj_format=coff ;;
204 *-*-sim) obj_format=coff ;;
205 *-*-elf | *-*-sysv4* | *-*-solaris*)
206 AC_MSG_WARN(GAS support for ELF format is incomplete)
207 obj_format=elf dev=yes ;;
208 *-*-vxworks) obj_format=aout ;;
209 *-*-netware) obj_format=elf ;;
212 # Assign floating point type. Most processors with FP support
213 # IEEE FP. On those that don't support FP at all, usually IEEE
215 case ${target_cpu} in
216 vax | tahoe ) atof=${target_cpu} ;;
220 case "${obj_format}" in
221 "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
225 dnl Make sure the desired support files exist.
228 if test ! -r ${srcdir}/config/tc-${cpu_type}.c; then
229 AC_MSG_ERROR(GAS does not support target CPU ${cpu_type})
232 if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
233 AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
236 # and target makefile frag
238 target_frag=${srcdir}/config/${gas_target}.mt
239 if test ! -r ${target_frag}; then
240 target_frag=/dev/null # ick! but subst_file can't be conditionalized
242 AC_SUBST_FILE(target_frag)
244 case ${cpu_type}-${obj_format} in
245 arm-*) bfd_gas=yes ;;
247 # i386-aout) bfd_gas=preferred ;;
248 mips-*) bfd_gas=yes ;;
249 ns32k-*) bfd_gas=yes ;;
250 ppc-*) bfd_gas=yes ;;
251 sparc-*) bfd_gas=yes ;;
252 *-elf) bfd_gas=yes ;;
253 *-ecoff) bfd_gas=yes ;;
254 *-som) bfd_gas=yes ;;
258 case ${user_bfd_gas}-${bfd_gas} in
260 # We didn't override user's choice.
263 AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
275 # User specified nothing.
279 case ${bfd_gas}-${cpu_type}-${obj_format} in
280 yes-*-coff) need_bfd=yes ;;
281 no-*-coff) need_bfd=yes
282 AC_DEFINE(MANY_SEGMENTS) ;;
285 reject_dev_configs=yes
287 case ${reject_dev_configs}-${dev} in
289 AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
298 AC_LINK_FILES(config/tc-${cpu_type}.c config/tc-${cpu_type}.h \
299 config/obj-${obj_format}.h config/obj-${obj_format}.c \
300 config/te-${emulation}.h config/atof-${atof}.c,
301 targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c)
304 yes) AC_DEFINE(BFD_ASSEMBLER)
308 case "${need_bfd}" in
309 yes) BFDLIB=../bfd/libbfd.a
310 ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
314 AC_SUBST(ALL_OBJ_DEPS)
316 AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}")
317 AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}")
318 AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}")
319 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}")
320 AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}")
325 AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
327 # Put this here so that autoconf's "cross-compiling" message doesn't confuse
328 # people who are not cross-compiling but are compiling cross-assemblers.
329 AC_MSG_CHECKING(whether compiling a cross-assembler)
330 if test "${host}" = "${target}"; then
334 AC_DEFINE(CROSS_COMPILE)
336 AC_MSG_RESULT($cross_gas)
338 dnl ansidecl.h will deal with const
343 # VMS doesn't have unlink.
344 AC_CHECK_FUNCS(unlink remove, break)
346 # Some non-ANSI preprocessors botch requoting inside strings. That's bad
347 # enough, but on some of those systems, the assert macro relies on requoting
351 # On some systems, the system header files may not declare malloc, realloc,
352 # and free. There are places where gas needs these functions to have been
353 # declared -- such as when taking their addresses.
368 GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
369 GAS_CHECK_DECL_NEEDED(free, f, int f, $gas_test_headers)
371 # Does errno.h declare errno, or do we have to add a separate declaration
373 GAS_CHECK_DECL_NEEDED(errno, f, int f, [
379 AC_CONFIG_SUBDIRS(testsuite)
381 dnl This must come last.
382 AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in)