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