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 | |
6 | dnl Remember to use "dnl" in each line before the AC_INIT call... | |
7 | dnl | |
8 | dnl | |
9 | AC_INIT(as.h) | |
10 | dnl | |
11 | AC_ARG_ENABLE(bfd-assembler, | |
12 | [ bfd-assembler use BFD back end for writing object files], | |
13 | [case "${enableval}" in | |
14 | yes) need_bfd=yes bfd_gas=yes ;; | |
15 | no) ;; | |
16 | *) AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;; | |
17 | esac])dnl | |
18 | ||
19 | # Generate a header file -- gets more post-processing by Makefile later. | |
20 | AC_CONFIG_HEADER(conf) | |
21 | ||
22 | dnl For recursion to work right, this must be an absolute pathname. | |
23 | AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..) | |
24 | AC_CANONICAL_SYSTEM | |
7cf4d7ff | 25 | |
b678740d RP |
26 | emulation=generic |
27 | ||
b11fb939 | 28 | # assign cpu type |
5f8a3788 | 29 | |
b53ccaac ILT |
30 | # check for architecture variants |
31 | case ${target_cpu} in | |
8cac6ca6 | 32 | hppa*) cpu_type=hppa ;; |
b11fb939 | 33 | changequote(,)dnl |
904b6037 | 34 | i[45]86) cpu_type=i386 ;; |
82489ea0 | 35 | m680[012346]0) cpu_type=m68k ;; |
8cac6ca6 KR |
36 | m68008) cpu_type=m68k ;; |
37 | m683??) cpu_type=m68k ;; | |
b11fb939 | 38 | changequote([,])dnl |
8cac6ca6 | 39 | m8*) cpu_type=m88k ;; |
5f8a3788 | 40 | mips*el) cpu_type=mips endian=little;; |
b11fb939 | 41 | mips*) cpu_type=mips endian=big ;; |
5e65fbc8 | 42 | powerpc*) cpu_type=ppc ;; |
1c11ab0e | 43 | rs6000*) cpu_type=ppc ;; |
b11fb939 | 44 | sparc64) cpu_type=sparc obj_format=elf AC_DEFINE(sparcv9) ;; |
8cac6ca6 | 45 | sparclite*) cpu_type=sparc ;; |
7cf4d7ff | 46 | *) cpu_type=${target_cpu} ;; |
b53ccaac ILT |
47 | esac |
48 | ||
634233a3 KR |
49 | # do we need the opcodes library? |
50 | case ${cpu_type} in | |
51 | alpha | vax) | |
634233a3 KR |
52 | ;; |
53 | *) | |
b11fb939 | 54 | OPCODES_LIB="../opcodes/libopcodes.a" |
634233a3 KR |
55 | ;; |
56 | esac | |
b11fb939 | 57 | AC_SUBST(OPCODES_LIB) |
634233a3 | 58 | |
b53ccaac | 59 | gas_target=${cpu_type} |
f70a4714 | 60 | generic_target=${cpu_type}-${target_vendor}-${target_os} |
8cac6ca6 KR |
61 | dev=no |
62 | ||
74cc5508 | 63 | # assign object format |
f70a4714 | 64 | case ${generic_target} in |
b418bc52 KR |
65 | a29k-amd-udi) obj_format=coff gas_target=ebmon29k ;; |
66 | a29k-amd-ebmon) obj_format=coff gas_target=ebmon29k ;; | |
7cf4d7ff | 67 | |
c25be7f4 | 68 | alpha-*-netware*) obj_format=ecoff ;; |
34de45f9 | 69 | alpha-*-osf*) obj_format=ecoff ;; |
816153a3 | 70 | |
c25be7f4 KR |
71 | hppa-*-*elf*) obj_format=elf emulation=hppa ;; |
72 | hppa-*-osf*) obj_format=som emulation=hppa ;; | |
7cf4d7ff | 73 | hppa-*-hpux*) obj_format=som emulation=hppa ;; |
5f8a3788 | 74 | hppa-*-bsd*) obj_format=som emulation=hppa ;; |
f8693e71 | 75 | hppa-*-hiux*) obj_format=som emulation=hppa ;; |
7cf4d7ff | 76 | |
b418bc52 | 77 | h8300-*-coff) obj_format=coff ;; |
8f4b9142 | 78 | |
b418bc52 | 79 | i386-ibm-aix*) obj_format=coff gas_target=i386coff |
7cf4d7ff KR |
80 | emulation=i386aix ;; |
81 | i386-*-bsd*) obj_format=aout emulation=386bsd ;; | |
b418bc52 | 82 | i386-*-netbsd0.8) obj_format=aout emulation=386bsd ;; |
420065a5 | 83 | i386-*-netbsd*) obj_format=aout emulation=netbsd ;; |
8cac6ca6 | 84 | i386-*-linux*elf*) obj_format=elf emulation=linux ;; |
b418bc52 | 85 | i386-*-linux*coff*) obj_format=coff emulation=linux |
8cac6ca6 | 86 | gas_target=i386coff ;; |
7cf4d7ff | 87 | i386-*-linux*) obj_format=aout emulation=linux ;; |
b418bc52 | 88 | i386-*-lynxos*) obj_format=coff gas_target=i386coff |
8cac6ca6 KR |
89 | emulation=lynx ;; |
90 | i386-*-sysv4* | i386-*-solaris* | i386-*-elf) | |
91 | obj_format=elf ;; | |
92 | i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*) | |
b418bc52 | 93 | obj_format=coff gas_target=i386coff ;; |
420065a5 | 94 | i386-*-vsta) obj_format=aout ;; |
b418bc52 | 95 | i386-*-go32) obj_format=coff gas_target=i386coff ;; |
de66fe1f KR |
96 | i386-*-mach* | i386-*-gnu*) |
97 | obj_format=aout emulation=mach bfd_gas=yes ;; | |
7cf4d7ff | 98 | |
c25be7f4 | 99 | i960-*-bout) obj_format=bout ;; |
b418bc52 | 100 | i960-*-coff) obj_format=coff emulation=ic960 gas_target=ic960coff ;; |
c25be7f4 KR |
101 | i960-*-nindy*) obj_format=bout ;; |
102 | i960-*-vxworks4*) obj_format=bout ;; | |
103 | i960-*-vxworks5.0) obj_format=bout ;; | |
b418bc52 | 104 | i960-*-vxworks5.*) obj_format=coff emulation=ic960 gas_target=ic960coff ;; |
c25be7f4 | 105 | i960-*-vxworks*) obj_format=bout ;; |
7cf4d7ff | 106 | |
8cac6ca6 | 107 | m68k-wrs-vxworks | m68k-ericsson-ose | m68k-*-sunos*) |
7cf4d7ff | 108 | obj_format=aout emulation=sun3 ;; |
b418bc52 KR |
109 | m68k-motorola-sysv) obj_format=coff gas_target=m68kcoff emulation=delta ;; |
110 | m68k-bull-sysv3*) obj_format=coff gas_target=m68kcoff emulation=dpx2 ;; | |
111 | m68k-apollo-*) obj_format=coff gas_target=apollo emulation=apollo ;; | |
8cac6ca6 | 112 | m68k-*-coff | m68k-*-sysv*) |
b418bc52 | 113 | obj_format=coff gas_target=m68kcoff ;; |
7cf4d7ff | 114 | m68k-*-hpux) obj_format=hp300 emulation=hp300 ;; |
b418bc52 | 115 | m68k-*-lynxos*) obj_format=coff gas_target=m68kcoff |
8cac6ca6 | 116 | emulation=lynx ;; |
7cf4d7ff | 117 | |
b418bc52 | 118 | m88k-*-coff*) obj_format=coff gas_target=m88kcoff ;; |
c978e704 | 119 | |
7cf4d7ff KR |
120 | # don't change emulation like *-*-bsd does |
121 | mips-*-bsd*) bfd_gas=yes obj_format=aout gas_target=mips-lit ;; | |
122 | mips-*-ultrix*) obj_format=ecoff gas_target=mips-lit ;; | |
5f8a3788 | 123 | mips-*-ecoff*) obj_format=ecoff |
b11fb939 KR |
124 | case "$endian" in |
125 | big) gas_target=mips-big ;; | |
126 | *) gas_target=mips-lit ;; | |
127 | esac | |
5f8a3788 | 128 | ;; |
47fcc4f5 | 129 | mips-*-ecoff*) obj_format=ecoff gas_target=mips-big ;; |
00f4e659 | 130 | mips-*-irix5*) obj_format=elf gas_target=mips-big ;; |
20ae2fb8 | 131 | mips-*-irix*) obj_format=ecoff gas_target=mips-big ;; |
8cac6ca6 KR |
132 | mips-*-riscos*) obj_format=ecoff gas_target=mips-big ;; |
133 | mips-*-sysv*) obj_format=ecoff gas_target=mips-big ;; | |
5f8a3788 | 134 | mips-*-elf*) obj_format=elf |
b11fb939 KR |
135 | case "$endian" in |
136 | big) gas_target=mips-big ;; | |
137 | *) gas_target=mips-lit ;; | |
138 | esac | |
5f8a3788 | 139 | ;; |
1c11ab0e | 140 | ppc-*-aix*) obj_format=coff bfd_gas=yes ;; |
904b6037 ILT |
141 | ppc-*-elf*) obj_format=elf bfd_gas=yes ;; |
142 | ppc-*-netware*) obj_format=elf emulation=ppcnw ;; | |
5e65fbc8 | 143 | ppc-*-sysv4*) obj_format=elf bfd_gas=yes ;; |
1c11ab0e | 144 | |
b418bc52 | 145 | sh-*-coff) obj_format=coff ;; |
816153a3 | 146 | |
904b6037 ILT |
147 | ns32k-pc532-mach*) obj_format=aout emulation=pc532 bfd_gas=yes ;; |
148 | ns32k-pc532-netbsd*) obj_format=aout emulation=netbsd532 bfd_gas=yes ;; | |
149 | ||
8cac6ca6 KR |
150 | sparc*-*-sunos4*) obj_format=aout emulation=sun3 bfd_gas=yes ;; |
151 | sparc*-*-aout | sparc*-*-vxworks) | |
152 | obj_format=aout bfd_gas=yes ;; | |
153 | sparc*-*-coff) obj_format=coff bfd_gas=yes ;; | |
634233a3 | 154 | sparc*-*-lynxos*) obj_format=coff bfd_gas=yes emulation=lynx ;; |
8cac6ca6 KR |
155 | sparc*-fujitsu-none) obj_format=aout bfd_gas=yes ;; |
156 | sparc*-*-elf | sparc*-*-solaris*) | |
157 | obj_format=elf ;; | |
7cf4d7ff | 158 | |
5677c028 KR |
159 | vax-*-bsd* | vax-*-ultrix*) |
160 | obj_format=aout ;; | |
8cac6ca6 | 161 | vax-*-vms) obj_format=vms ;; |
a8285504 | 162 | |
8cac6ca6 | 163 | z8k-*-coff | z8k-*-sim) |
b418bc52 | 164 | obj_format=coff ;; |
07ef2075 | 165 | |
8cac6ca6 | 166 | *-*-aout | *-*-scout) |
7cf4d7ff | 167 | obj_format=aout ;; |
8cac6ca6 | 168 | *-*-nindy*) |
7cf4d7ff | 169 | obj_format=bout ;; |
8cac6ca6 | 170 | *-*-bsd*) |
7cf4d7ff KR |
171 | obj_format=aout emulation=sun3 ;; |
172 | *-*-generic) obj_format=generic ;; | |
b418bc52 KR |
173 | *-*-xray | *-*-hms) obj_format=coff ;; |
174 | *-*-sim) obj_format=coff ;; | |
8cac6ca6 | 175 | *-*-elf | *-*-sysv4* | *-*-solaris*) |
b11fb939 | 176 | AC_MSG_WARN(GAS support for ELF format is incomplete) |
8cac6ca6 | 177 | obj_format=elf dev=yes ;; |
7cf4d7ff | 178 | *-*-vxworks) obj_format=aout ;; |
5f8a3788 | 179 | *-*-netware) obj_format=elf ;; |
fecd2382 RP |
180 | esac |
181 | ||
8cac6ca6 KR |
182 | # Assign floating point type. Most processors with FP support |
183 | # IEEE FP. On those that don't support FP at all, usually IEEE | |
184 | # is emulated. | |
b678740d | 185 | case ${target_cpu} in |
904b6037 | 186 | vax | tahoe ) atof=${target_cpu} ;; |
7cf4d7ff | 187 | *) atof=ieee ;; |
fecd2382 RP |
188 | esac |
189 | ||
8cac6ca6 | 190 | case "${obj_format}" in |
b11fb939 | 191 | "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;; |
8cac6ca6 | 192 | esac |
7cf4d7ff | 193 | |
b11fb939 KR |
194 | dnl |
195 | dnl Make sure the desired support files exist. | |
196 | dnl | |
197 | ||
198 | changequote(<<<,>>>)dnl | |
199 | ||
200 | if [ ! -r ${srcdir}/config/tc-${cpu_type}.c ]; then | |
201 | AC_MSG_ERROR(GAS does not support target CPU ${cpu_type}) | |
202 | fi | |
203 | ||
7cf4d7ff | 204 | if [ ! -r ${srcdir}/config/obj-${obj_format}.c ]; then |
b11fb939 | 205 | AC_MSG_ERROR(GAS does not have support for object file format ${obj_format}) |
7cf4d7ff KR |
206 | fi |
207 | ||
b11fb939 KR |
208 | changequote([,])dnl |
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 | |
7cf4d7ff | 215 | case ${bfd_gas}-${obj_format} in |
b418bc52 | 216 | yes-coff) need_bfd=yes ;; |
b11fb939 KR |
217 | no-coff) need_bfd=yes |
218 | AC_DEFINE(MANY_SEGMENTS) ;; | |
7cf4d7ff KR |
219 | *-elf) bfd_gas=yes ;; |
220 | *-ecoff) bfd_gas=yes ;; | |
5f8a3788 | 221 | *-som) bfd_gas=yes ;; |
7cf4d7ff KR |
222 | *) ;; |
223 | esac | |
224 | ||
a8285504 DZ |
225 | case ${with_bfd_assembler}-${bfd_gas} in |
226 | yes-yes | no-no) | |
7cf4d7ff KR |
227 | # We didn't override user's choice. |
228 | ;; | |
a8285504 | 229 | no-yes) |
b11fb939 | 230 | AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.) |
7cf4d7ff | 231 | ;; |
a8285504 DZ |
232 | no-preferred) |
233 | bfd_gas=no | |
234 | ;; | |
235 | *-preferred) | |
236 | bfd_gas=yes | |
237 | ;; | |
238 | -*) | |
239 | # User specified nothing. | |
240 | ;; | |
7cf4d7ff KR |
241 | esac |
242 | ||
69ecc03f | 243 | reject_dev_configs=yes |
8cac6ca6 KR |
244 | |
245 | case ${reject_dev_configs}-${dev} in | |
246 | yes-yes) # Oops. | |
b11fb939 | 247 | AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.) |
8cac6ca6 KR |
248 | ;; |
249 | esac | |
250 | ||
b11fb939 KR |
251 | dnl Looks like the AC_MAKE_LINKS string is taken literally and put into the |
252 | dnl config.status file. So the necessary variables also have to be | |
253 | dnl exported. | |
254 | AC_SUBST(cpu_type) AC_SUBST(obj_format) AC_SUBST(emulation) AC_SUBST(atof) | |
255 | AC_LINK_FILES(targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c, | |
256 | config/tc-${cpu_type}.c config/tc-${cpu_type}.h \ | |
74cc5508 | 257 | config/obj-${obj_format}.h config/obj-${obj_format}.c \ |
b11fb939 | 258 | config/te-${emulation}.h config/atof-${atof}.c) |
8b228fe9 | 259 | |
b11fb939 KR |
260 | case "${bfd_gas}" in |
261 | yes) AC_DEFINE(BFD_ASSEMBLER) | |
262 | need_bfd=yes ;; | |
4f6f4aa8 KR |
263 | esac |
264 | ||
b11fb939 KR |
265 | case "${need_bfd}" in |
266 | yes) BFDLIB=../bfd/libbfd.a | |
267 | ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h" | |
c92d9ee9 | 268 | ;; |
4f6f4aa8 | 269 | esac |
b11fb939 KR |
270 | AC_SUBST(BFDLIB) |
271 | AC_SUBST(ALL_OBJ_DEPS) | |
4f6f4aa8 | 272 | |
b11fb939 KR |
273 | case "x${host_canon}" in |
274 | x${target_canon}) ;; | |
275 | *) AC_DEFINE(CROSS_COMPILE);; | |
8cac6ca6 KR |
276 | esac |
277 | ||
b11fb939 KR |
278 | AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}") |
279 | AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}") | |
280 | AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}") | |
281 | AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}") | |
282 | AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}") | |
283 | ||
284 | case ${host} in | |
285 | rs6000-*-*) | |
286 | # The IBM compiler mis-compiles some expressions used in gas. | |
287 | # This will tell gas to work around this lossage. | |
288 | AC_DEFINE(IBM_COMPILER_SUX) ;; | |
289 | i386-*-go32) | |
290 | # Using fopen(..., "w") for a binary file breaks under DOS. | |
291 | AC_DEFINE(WANT_FOPEN_BIN) ;; | |
292 | esac | |
8f4b9142 | 293 | |
b11fb939 KR |
294 | AC_PROG_CC |
295 | AC_PROG_INSTALL | |
296 | ||
297 | AC_HEADER_STDC | |
298 | AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h) | |
299 | ||
300 | dnl ansidecl.h will deal with const | |
301 | dnl AC_CONST | |
302 | AC_FUNC_ALLOCA | |
303 | AC_C_INLINE | |
304 | ||
305 | # Some non-ANSI preprocessors botch requoting inside strings. That's bad | |
306 | # enough, but on some of those systems, the assert macro relies on requoting | |
307 | # working properly! | |
308 | AC_CHECKING([for working assert macro]) | |
309 | AC_TRY_LINK([#include <assert.h> | |
310 | #include <stdio.h>], [ | |
311 | /* check for requoting problems */ | |
312 | static int a, b, c, d; | |
313 | static char *s; | |
314 | assert (!strcmp(s, "foo bar baz quux")); | |
315 | /* check for newline handling */ | |
316 | assert (a == b | |
317 | || c == d); | |
318 | ], , AC_DEFINE(BROKEN_ASSERT)) | |
319 | ||
320 | # On some systems, the system header files may not declare malloc, realloc, | |
321 | # and free. There are places where gas needs these functions to have been | |
322 | # declared -- such as when taking their addresses. | |
323 | AC_CHECKING([whether malloc declaration is required]) | |
324 | AC_TRY_LINK([ | |
325 | #ifdef HAVE_MEMORY_H | |
326 | #include <memory.h> | |
327 | #endif | |
328 | #ifdef HAVE_STRING_H | |
329 | #include <string.h> | |
330 | #endif | |
331 | #ifdef HAVE_STDLIB_H | |
332 | #include <stdlib.h> | |
333 | #endif | |
334 | #ifdef HAVE_UNISTD_H | |
335 | #include <unistd.h> | |
336 | #endif | |
337 | ], [ | |
338 | char *(*f) (); | |
339 | f = (char *(*)()) malloc; | |
340 | ], , AC_DEFINE(NEED_MALLOC_DECLARATION)) | |
341 | AC_CHECKING([free declaration required]) | |
342 | AC_TRY_LINK([ | |
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 | |
355 | ], [ | |
356 | int (*f) (); | |
357 | f = (int (*)()) free; | |
358 | ], , AC_DEFINE(NEED_FREE_DECLARATION)) | |
359 | ||
360 | # Does errno.h declare errno, or do we have to add a separate declaration | |
361 | # for it? | |
362 | AC_CHECKING([errno declaration required]) | |
363 | AC_TRY_LINK([ | |
364 | #ifdef HAVE_ERRNO_H | |
365 | #include <errno.h> | |
366 | #endif | |
367 | ], [ | |
368 | int x; | |
369 | x = errno; | |
370 | ], , AC_DEFINE(NEED_ERRNO_DECLARATION)) | |
371 | ||
372 | AC_CONFIG_SUBDIRS(testsuite) | |
373 | ||
374 | dnl This must come last. | |
375 | dnl Apparently symlinks are checked for in the directory containing | |
376 | dnl the last Makefile. Thus the order used here... | |
377 | AC_OUTPUT(doc/Makefile Makefile) |