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