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