Move cpu-specific dependencies into Makefile.in, instead of having sometimes
[deliverable/binutils-gdb.git] / gas / configure.in
CommitLineData
b11fb939
KR
1dnl Process this file with autoconf to produce a configure script.
2dnl
3dnl And be careful when changing it! If you must add tests with square
4dnl brackets, be sure changequote invocations surround it.
5dnl
b11fb939 6dnl
833c46e1 7AC_PREREQ(2.3)dnl We only need 2.0, but pre-2.3 loses on some AIX version.
28d3e4a3 8AC_INIT(as.h)dnl
b11fb939 9dnl
bdee23af 10bfd_gas=no
318b02b6 11user_bfd_gas=
b11fb939
KR
12AC_ARG_ENABLE(bfd-assembler,
13[ bfd-assembler use BFD back end for writing object files],
14[case "${enableval}" in
318b02b6
KR
15 yes) need_bfd=yes user_bfd_gas=yes ;;
16 no) user_bfd_gas=no ;;
b11fb939
KR
17 *) AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;;
18esac])dnl
19
20# Generate a header file -- gets more post-processing by Makefile later.
21AC_CONFIG_HEADER(conf)
22
23dnl For recursion to work right, this must be an absolute pathname.
24AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
25AC_CANONICAL_SYSTEM
bf111c9f 26AC_ARG_PROGRAM
7cf4d7ff 27
b678740d
RP
28emulation=generic
29
b11fb939 30# assign cpu type
5f8a3788 31
b53ccaac
ILT
32# check for architecture variants
33case ${target_cpu} in
8cac6ca6 34 hppa*) cpu_type=hppa ;;
b11fb939 35changequote(,)dnl
904b6037 36 i[45]86) cpu_type=i386 ;;
82489ea0 37 m680[012346]0) cpu_type=m68k ;;
8cac6ca6
KR
38 m68008) cpu_type=m68k ;;
39 m683??) cpu_type=m68k ;;
b11fb939 40changequote([,])dnl
8cac6ca6 41 m8*) cpu_type=m88k ;;
5f8a3788 42 mips*el) cpu_type=mips endian=little;;
b11fb939 43 mips*) cpu_type=mips endian=big ;;
5e65fbc8 44 powerpc*) cpu_type=ppc ;;
1c11ab0e 45 rs6000*) cpu_type=ppc ;;
f2889110
KR
46 sparc64) cpu_type=sparc obj_format=elf
47 AC_DEFINE(sparcv9) ;;
8cac6ca6 48 sparclite*) cpu_type=sparc ;;
7cf4d7ff 49 *) cpu_type=${target_cpu} ;;
b53ccaac
ILT
50esac
51
634233a3
KR
52# do we need the opcodes library?
53case ${cpu_type} in
54 alpha | vax)
634233a3
KR
55 ;;
56 *)
b11fb939 57 OPCODES_LIB="../opcodes/libopcodes.a"
634233a3
KR
58 ;;
59esac
b11fb939 60AC_SUBST(OPCODES_LIB)
634233a3 61
b53ccaac 62gas_target=${cpu_type}
f70a4714 63generic_target=${cpu_type}-${target_vendor}-${target_os}
8cac6ca6
KR
64dev=no
65
74cc5508 66# assign object format
f70a4714 67case ${generic_target} in
b418bc52
KR
68 a29k-amd-udi) obj_format=coff gas_target=ebmon29k ;;
69 a29k-amd-ebmon) obj_format=coff gas_target=ebmon29k ;;
833c46e1 70 a29k-*-vxworks*) obj_format=coff ;;
7cf4d7ff 71
c25be7f4 72 alpha-*-netware*) obj_format=ecoff ;;
34de45f9 73 alpha-*-osf*) obj_format=ecoff ;;
816153a3 74
4181c985
KR
75# start-sanitize-arc
76 arc-*-elf*) obj_format=elf bfd_gas=yes ;;
77# end-sanitize-arc
78
f2889110 79 arm-*-riscix*) obj_format=aout ;;
318b02b6 80
c25be7f4
KR
81 hppa-*-*elf*) obj_format=elf emulation=hppa ;;
82 hppa-*-osf*) obj_format=som emulation=hppa ;;
7cf4d7ff 83 hppa-*-hpux*) obj_format=som emulation=hppa ;;
5f8a3788 84 hppa-*-bsd*) obj_format=som emulation=hppa ;;
f8693e71 85 hppa-*-hiux*) obj_format=som emulation=hppa ;;
7cf4d7ff 86
b418bc52 87 h8300-*-coff) obj_format=coff ;;
8f4b9142 88
b418bc52 89 i386-ibm-aix*) obj_format=coff gas_target=i386coff
7cf4d7ff
KR
90 emulation=i386aix ;;
91 i386-*-bsd*) obj_format=aout emulation=386bsd ;;
b418bc52 92 i386-*-netbsd0.8) obj_format=aout emulation=386bsd ;;
0cb42d6f 93 i386-*-netbsd*) obj_format=aout emulation=nbsd bfd_gas=yes;;
833c46e1 94 i386-*-linux*aout*) obj_format=aout emulation=linux ;;
b418bc52 95 i386-*-linux*coff*) obj_format=coff emulation=linux
8cac6ca6 96 gas_target=i386coff ;;
833c46e1 97 i386-*-linux*) obj_format=elf emulation=linux ;;
b418bc52 98 i386-*-lynxos*) obj_format=coff gas_target=i386coff
8cac6ca6
KR
99 emulation=lynx ;;
100 i386-*-sysv4* | i386-*-solaris* | i386-*-elf)
101 obj_format=elf ;;
102 i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*)
b418bc52 103 obj_format=coff gas_target=i386coff ;;
420065a5 104 i386-*-vsta) obj_format=aout ;;
b418bc52 105 i386-*-go32) obj_format=coff gas_target=i386coff ;;
c54c7aac 106 i386-*-gnu*elf*) obj_format=elf ;;
de66fe1f
KR
107 i386-*-mach* | i386-*-gnu*)
108 obj_format=aout emulation=mach bfd_gas=yes ;;
c54c7aac 109 i386-*-msdos*) obj_format=aout ;;
7cf4d7ff 110
c25be7f4 111 i960-*-bout) obj_format=bout ;;
b418bc52 112 i960-*-coff) obj_format=coff emulation=ic960 gas_target=ic960coff ;;
c25be7f4
KR
113 i960-*-nindy*) obj_format=bout ;;
114 i960-*-vxworks4*) obj_format=bout ;;
115 i960-*-vxworks5.0) obj_format=bout ;;
b418bc52 116 i960-*-vxworks5.*) obj_format=coff emulation=ic960 gas_target=ic960coff ;;
c25be7f4 117 i960-*-vxworks*) obj_format=bout ;;
7cf4d7ff 118
833c46e1 119 m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
7cf4d7ff 120 obj_format=aout emulation=sun3 ;;
b418bc52
KR
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 ;;
8cac6ca6 124 m68k-*-coff | m68k-*-sysv*)
b418bc52 125 obj_format=coff gas_target=m68kcoff ;;
833c46e1 126 m68k-*-elf) obj_format=elf ;;
f2889110 127 m68k-*-hpux*) obj_format=hp300 emulation=hp300 ;;
b418bc52 128 m68k-*-lynxos*) obj_format=coff gas_target=m68kcoff
8cac6ca6 129 emulation=lynx ;;
0cb42d6f 130 m68k-*-netbsd*) obj_format=aout emulation=nbsd bfd_gas=yes ;;
7cf4d7ff 131
b418bc52 132 m88k-*-coff*) obj_format=coff gas_target=m88kcoff ;;
c978e704 133
7cf4d7ff 134 # don't change emulation like *-*-bsd does
5cda0c7a
KR
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.) ;;
7cf4d7ff 138 mips-*-ultrix*) obj_format=ecoff gas_target=mips-lit ;;
5f8a3788 139 mips-*-ecoff*) obj_format=ecoff
b11fb939
KR
140 case "$endian" in
141 big) gas_target=mips-big ;;
142 *) gas_target=mips-lit ;;
143 esac
5f8a3788 144 ;;
47fcc4f5 145 mips-*-ecoff*) obj_format=ecoff gas_target=mips-big ;;
5cda0c7a
KR
146 mips-*-gnu*) obj_format=aout
147 case "$endian" in
148 big) gas_target=mips-big ;;
149 *) gas_target=mips-lit ;;
150 esac
151 ;;
00f4e659 152 mips-*-irix5*) obj_format=elf gas_target=mips-big ;;
20ae2fb8 153 mips-*-irix*) obj_format=ecoff gas_target=mips-big ;;
8cac6ca6
KR
154 mips-*-riscos*) obj_format=ecoff gas_target=mips-big ;;
155 mips-*-sysv*) obj_format=ecoff gas_target=mips-big ;;
5f8a3788 156 mips-*-elf*) obj_format=elf
b11fb939
KR
157 case "$endian" in
158 big) gas_target=mips-big ;;
159 *) gas_target=mips-lit ;;
160 esac
5f8a3788 161 ;;
f2889110
KR
162 ppc-*-aix*) obj_format=coff ;;
163 ppc-*-elf*) obj_format=elf ;;
833c46e1 164 ppc-*-eabi*) obj_format=elf ;;
904b6037 165 ppc-*-netware*) obj_format=elf emulation=ppcnw ;;
f2889110 166 ppc-*-sysv4*) obj_format=elf ;;
1c11ab0e 167
b418bc52 168 sh-*-coff) obj_format=coff ;;
816153a3 169
03c4ce2f
MT
170# start-sanitize-rce
171 rce-*-aout) obj_format=aout ;;
172# end-sanitize-rce
d94aca1a 173
4181c985 174 ns32k-pc532-mach*) obj_format=aout emulation=pc532mach ;;
f2889110 175 ns32k-pc532-netbsd*) obj_format=aout emulation=nbsd532 ;;
904b6037 176
d94aca1a
MT
177 sparc-*-sunos4*) obj_format=aout emulation=sun3 ;;
178 sparc-*-aout | sparc*-*-vxworks)
f2889110 179 obj_format=aout ;;
d94aca1a
MT
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*)
8cac6ca6 184 obj_format=elf ;;
d94aca1a 185 sparc-*-netbsd*) obj_format=aout emulation=nbsd bfd_gas=yes ;;
7cf4d7ff 186
5677c028
KR
187 vax-*-bsd* | vax-*-ultrix*)
188 obj_format=aout ;;
8cac6ca6 189 vax-*-vms) obj_format=vms ;;
a8285504 190
8cac6ca6 191 z8k-*-coff | z8k-*-sim)
b418bc52 192 obj_format=coff ;;
07ef2075 193
c54c7aac
KR
194 w65-*-*) obj_format=coff ;;
195
8cac6ca6 196 *-*-aout | *-*-scout)
7cf4d7ff 197 obj_format=aout ;;
8cac6ca6 198 *-*-nindy*)
7cf4d7ff 199 obj_format=bout ;;
8cac6ca6 200 *-*-bsd*)
7cf4d7ff
KR
201 obj_format=aout emulation=sun3 ;;
202 *-*-generic) obj_format=generic ;;
b418bc52
KR
203 *-*-xray | *-*-hms) obj_format=coff ;;
204 *-*-sim) obj_format=coff ;;
8cac6ca6 205 *-*-elf | *-*-sysv4* | *-*-solaris*)
b11fb939 206 AC_MSG_WARN(GAS support for ELF format is incomplete)
8cac6ca6 207 obj_format=elf dev=yes ;;
7cf4d7ff 208 *-*-vxworks) obj_format=aout ;;
5f8a3788 209 *-*-netware) obj_format=elf ;;
fecd2382
RP
210esac
211
8cac6ca6
KR
212# Assign floating point type. Most processors with FP support
213# IEEE FP. On those that don't support FP at all, usually IEEE
214# is emulated.
b678740d 215case ${target_cpu} in
904b6037 216 vax | tahoe ) atof=${target_cpu} ;;
7cf4d7ff 217 *) atof=ieee ;;
fecd2382
RP
218esac
219
8cac6ca6 220case "${obj_format}" in
b11fb939 221 "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
8cac6ca6 222esac
7cf4d7ff 223
b11fb939
KR
224dnl
225dnl Make sure the desired support files exist.
226dnl
227
fb589130 228if test ! -r ${srcdir}/config/tc-${cpu_type}.c; then
b11fb939
KR
229 AC_MSG_ERROR(GAS does not support target CPU ${cpu_type})
230fi
231
fb589130 232if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
b11fb939 233 AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
7cf4d7ff
KR
234fi
235
8a24a37c
SC
236# and target makefile frag
237
b11fb939 238target_frag=${srcdir}/config/${gas_target}.mt
f2889110
KR
239if test ! -r ${target_frag}; then
240 target_frag=/dev/null # ick! but subst_file can't be conditionalized
241fi
b11fb939 242AC_SUBST_FILE(target_frag)
8a24a37c 243
318b02b6 244case ${cpu_type}-${obj_format} in
f2889110 245 arm-*) bfd_gas=yes ;;
318b02b6
KR
246# not yet
247# i386-aout) bfd_gas=preferred ;;
f2889110
KR
248 mips-*) bfd_gas=yes ;;
249 ns32k-*) bfd_gas=yes ;;
250 ppc-*) bfd_gas=yes ;;
d94aca1a 251 sparc-*) bfd_gas=yes ;;
7cf4d7ff
KR
252 *-elf) bfd_gas=yes ;;
253 *-ecoff) bfd_gas=yes ;;
5f8a3788 254 *-som) bfd_gas=yes ;;
7cf4d7ff
KR
255 *) ;;
256esac
257
318b02b6 258case ${user_bfd_gas}-${bfd_gas} in
a8285504 259 yes-yes | no-no)
7cf4d7ff
KR
260 # We didn't override user's choice.
261 ;;
a8285504 262 no-yes)
b11fb939 263 AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
7cf4d7ff 264 ;;
a8285504
DZ
265 no-preferred)
266 bfd_gas=no
267 ;;
268 *-preferred)
269 bfd_gas=yes
270 ;;
f2889110
KR
271 yes-*)
272 bfd_gas=yes
273 ;;
a8285504
DZ
274 -*)
275 # User specified nothing.
276 ;;
7cf4d7ff
KR
277esac
278
318b02b6
KR
279case ${bfd_gas}-${cpu_type}-${obj_format} in
280 yes-*-coff) need_bfd=yes ;;
281 no-*-coff) need_bfd=yes
282 AC_DEFINE(MANY_SEGMENTS) ;;
283esac
284
69ecc03f 285reject_dev_configs=yes
8cac6ca6
KR
286
287case ${reject_dev_configs}-${dev} in
288 yes-yes) # Oops.
b11fb939 289 AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
8cac6ca6
KR
290 ;;
291esac
292
833c46e1
KR
293AC_SUBST(cpu_type)
294AC_SUBST(obj_format)
295AC_SUBST(atof)
296AC_SUBST(emulation)
297
28d3e4a3 298AC_LINK_FILES(config/tc-${cpu_type}.c config/tc-${cpu_type}.h \
74cc5508 299 config/obj-${obj_format}.h config/obj-${obj_format}.c \
28d3e4a3
KR
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)
8b228fe9 302
b11fb939
KR
303case "${bfd_gas}" in
304 yes) AC_DEFINE(BFD_ASSEMBLER)
305 need_bfd=yes ;;
4f6f4aa8
KR
306esac
307
b11fb939
KR
308case "${need_bfd}" in
309 yes) BFDLIB=../bfd/libbfd.a
310 ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
c92d9ee9 311 ;;
4f6f4aa8 312esac
b11fb939
KR
313AC_SUBST(BFDLIB)
314AC_SUBST(ALL_OBJ_DEPS)
4f6f4aa8 315
b11fb939
KR
316AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}")
317AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}")
318AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}")
319AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}")
320AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}")
321
b11fb939
KR
322AC_PROG_CC
323AC_PROG_INSTALL
324
b11fb939
KR
325AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
326
bf111c9f
KR
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.
329AC_MSG_CHECKING(whether compiling a cross-assembler)
330if test "${host}" = "${target}"; then
f2889110
KR
331 cross_gas=no
332else
bf111c9f
KR
333 cross_gas=yes
334 AC_DEFINE(CROSS_COMPILE)
bf111c9f
KR
335fi
336AC_MSG_RESULT($cross_gas)
337
b11fb939
KR
338dnl ansidecl.h will deal with const
339dnl AC_CONST
340AC_FUNC_ALLOCA
341AC_C_INLINE
342
f2889110
KR
343# VMS doesn't have unlink.
344AC_CHECK_FUNCS(unlink remove, break)
28d3e4a3 345
b11fb939
KR
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
348# working properly!
bf111c9f 349GAS_WORKING_ASSERT
b11fb939
KR
350
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.
bf111c9f 354gas_test_headers="
b11fb939
KR
355#ifdef HAVE_MEMORY_H
356#include <memory.h>
357#endif
358#ifdef HAVE_STRING_H
359#include <string.h>
360#endif
361#ifdef HAVE_STDLIB_H
362#include <stdlib.h>
363#endif
364#ifdef HAVE_UNISTD_H
365#include <unistd.h>
366#endif
bf111c9f
KR
367"
368GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
369GAS_CHECK_DECL_NEEDED(free, f, int f, $gas_test_headers)
b11fb939
KR
370
371# Does errno.h declare errno, or do we have to add a separate declaration
372# for it?
bf111c9f 373GAS_CHECK_DECL_NEEDED(errno, f, int f, [
b11fb939
KR
374#ifdef HAVE_ERRNO_H
375#include <errno.h>
376#endif
bf111c9f 377])
b11fb939
KR
378
379AC_CONFIG_SUBDIRS(testsuite)
380
381dnl This must come last.
28d3e4a3 382AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in)
This page took 0.151416 seconds and 4 git commands to generate.