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