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