Wed Nov 1 15:17:02 1995 Manfred Hollstein KS/EF4A 60/1F/110 #40283 <manfred@lts...
[binutils-gdb.git] / gas / configure.in
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
7 AC_PREREQ(2.3)dnl We only need 2.0, but pre-2.3 loses on some AIX version.
8 AC_INIT(as.h)dnl
9 dnl
10 user_bfd_gas=
11 AC_ARG_ENABLE(bfd-assembler,
12 [ --enable-bfd-assembler use BFD back end for writing object files],
13 [case "${enableval}" in
14 yes) need_bfd=yes user_bfd_gas=yes ;;
15 no) user_bfd_gas=no ;;
16 *) AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;;
17 esac])dnl
18 AC_ARG_ENABLE(targets,
19 [ targets alternative target configurations besides the primary],
20 [case "${enableval}" in
21 yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
22 ;;
23 no) enable_targets= ;;
24 *) enable_targets=$enableval ;;
25 esac])dnl
26
27 # Generate a header file -- gets more post-processing by Makefile later.
28 AC_CONFIG_HEADER(conf)
29
30 dnl For recursion to work right, this must be an absolute pathname.
31 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
32 AC_CANONICAL_SYSTEM
33 AC_ARG_PROGRAM
34
35 te_file=generic
36
37 # assign cpu type
38
39 # check for architecture variants
40 case ${target_cpu} in
41 armeb) cpu_type=arm endian=big ;;
42 arm*) cpu_type=arm endian=little ;;
43 hppa*) cpu_type=hppa ;;
44 changequote(,)dnl
45 i[45]86) cpu_type=i386 ;;
46 m680[012346]0) cpu_type=m68k ;;
47 m68008) cpu_type=m68k ;;
48 m683??) cpu_type=m68k ;;
49 changequote([,])dnl
50 m8*) cpu_type=m88k ;;
51 mips*el) cpu_type=mips endian=little;;
52 mips*) cpu_type=mips endian=big ;;
53 powerpcle*) cpu_type=ppc endian=little ;;
54 powerpc*) cpu_type=ppc endian=big ;;
55 rs6000*) cpu_type=ppc ;;
56 sparc64) cpu_type=sparc obj_format=elf
57 AC_DEFINE(sparcv9) ;;
58 sparclite*) cpu_type=sparc ;;
59 *) cpu_type=${target_cpu} ;;
60 esac
61
62 # do we need the opcodes library?
63 case ${cpu_type} in
64 alpha | vax)
65 ;;
66 *)
67 OPCODES_LIB="../opcodes/libopcodes.a"
68 ;;
69 esac
70 AC_SUBST(OPCODES_LIB)
71
72 gas_target=${cpu_type}
73 this_target=${generic_target}
74
75 canon_targets=""
76 if test -n "$enable_targets" ; then
77 for t in `echo $enable_targets | sed 's/,/ /g'`; do
78 result=`$ac_config_sub $t 2>/dev/null`
79 if test -n "$result" ; then
80 canon_targets="$canon_targets $result"
81 # else
82 # # Permit "all", etc. We don't support it yet though.
83 # canon_targets="$canon_targets $t"
84 fi
85 done
86 GAS_UNIQ(canon_targets)
87 fi
88
89 emulations=""
90
91 for this_target in $target $canon_targets ; do
92
93 eval `echo $this_target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'`
94
95 # check for architecture variants
96 case ${cpu} in
97 hppa*) cpu_type=hppa ;;
98 changequote(,)dnl
99 i[45]86) cpu_type=i386 ;;
100 m680[012346]0) cpu_type=m68k ;;
101 m68008) cpu_type=m68k ;;
102 m683??) cpu_type=m68k ;;
103 changequote([,])dnl
104 m8*) cpu_type=m88k ;;
105 mips*el) cpu_type=mips endian=little;;
106 mips*) cpu_type=mips endian=big ;;
107 powerpcle*) cpu_type=ppc endian=little ;;
108 powerpc*) cpu_type=ppc endian=big ;;
109 rs6000*) cpu_type=ppc ;;
110 sparc64) cpu_type=sparc obj_format=elf want_sparcv9=true ;;
111 sparclite*) cpu_type=sparc ;;
112 *) cpu_type=${cpu} ;;
113 esac
114
115 if test ${this_target} = $target ; then
116 target_cpu_type=${cpu_type}
117 elif test ${target_cpu_type} != ${cpu_type} ; then
118 continue
119 fi
120
121 targ=${cpu_type}
122 generic_target=${cpu_type}-$vendor-$os
123 dev=no
124 bfd_gas=no
125 em=generic
126
127 # assign object format
128 case ${generic_target} in
129 a29k-amd-udi) fmt=coff targ=ebmon29k ;;
130 a29k-amd-ebmon) fmt=coff targ=ebmon29k ;;
131 a29k-*-vxworks*) fmt=coff ;;
132
133 alpha-*-netware*) fmt=ecoff ;;
134 alpha-*-osf*) fmt=ecoff ;;
135 alpha-*-linux*) fmt=ecoff ;;
136
137 # start-sanitize-arc
138 arc-*-elf*) fmt=elf bfd_gas=yes ;;
139 # end-sanitize-arc
140
141 arm-*-riscix*) fmt=aout targ=arm-lit ;;
142 arm-*-aout) fmt=aout
143 case "$endian" in
144 big) targ=arm-big ;;
145 *) targ=arm-lit ;;
146 esac
147 ;;
148 arm-*-coff) fmt=coff ;;
149 arm-*-riscix*) fmt=aout ;;
150 arm-*-pe) fmt=coff targ=armcoff em=pe ;;
151
152 hppa-*-*elf*) fmt=elf em=hppa ;;
153 hppa-*-lites*) fmt=elf em=hppa ;;
154 hppa-*-osf*) fmt=som em=hppa ;;
155 hppa-*-hpux*) fmt=som em=hppa ;;
156 hppa-*-bsd*) fmt=som em=hppa ;;
157 hppa-*-hiux*) fmt=som em=hppa ;;
158
159 h8300-*-coff) fmt=coff ;;
160
161 i386-ibm-aix*) fmt=coff targ=i386coff
162 em=i386aix ;;
163 i386-*-bsd*) fmt=aout em=386bsd ;;
164 i386-*-netbsd0.8) fmt=aout em=386bsd ;;
165 i386-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes;;
166 i386-*-linux*aout* | i386-*-linuxoldld) fmt=aout em=linux ;;
167 i386-*-linux*coff*) fmt=coff em=linux
168 targ=i386coff ;;
169 i386-*-linux*) fmt=elf em=linux ;;
170 i386-*-lynxos*) fmt=coff targ=i386coff
171 em=lynx ;;
172 i386-*-sysv4* | i386-*-solaris* | i386-*-elf)
173 fmt=elf ;;
174 i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*)
175 fmt=coff targ=i386coff ;;
176 i386-*-vsta) fmt=aout ;;
177 i386-*-go32) fmt=coff targ=i386coff ;;
178 i386-*-gnu*) fmt=elf ;;
179 i386-*-mach*)
180 fmt=aout em=mach bfd_gas=yes ;;
181 i386-*-msdos*) fmt=aout ;;
182 i386-*-moss*) fmt=elf ;;
183 i386-*-pe) fmt=coff targ=i386coff em=pe ;;
184 i386-*-win32) fmt=coff targ=i386coff em=pe ;;
185 i386-*-*nt) fmt=coff targ=i386coff em=pe ;;
186 i960-*-bout) fmt=bout ;;
187 i960-*-coff) fmt=coff em=ic960 targ=ic960coff ;;
188 i960-*-nindy*) fmt=bout ;;
189 i960-*-vxworks4*) fmt=bout ;;
190 i960-*-vxworks5.0) fmt=bout ;;
191 i960-*-vxworks5.*) fmt=coff em=ic960 targ=ic960coff ;;
192 i960-*-vxworks*) fmt=bout ;;
193
194 m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
195 fmt=aout em=sun3 ;;
196 m68k-motorola-sysv) fmt=coff targ=m68kcoff em=delta ;;
197 m68k-bull-sysv3*) fmt=coff targ=m68kcoff em=dpx2 ;;
198 m68k-apollo-*) fmt=coff targ=apollo em=apollo ;;
199 m68k-*-coff | m68k-*-sysv*)
200 fmt=coff targ=m68kcoff ;;
201 m68k-*-elf) fmt=elf ;;
202 m68k-*-hpux*) fmt=hp300 em=hp300 ;;
203 m68k-*-lynxos*) fmt=coff targ=m68kcoff
204 em=lynx ;;
205 m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
206
207 m88k-motorola-sysv3*) fmt=coff targ=m88kcoff em=delta88 ;;
208 m88k-*-coff*) fmt=coff targ=m88kcoff ;;
209
210 # don't change em like *-*-bsd does
211 mips-dec-netbsd*) fmt=elf targ=mips-lit endian=little ;;
212 mips-dec-bsd*) fmt=aout targ=mips-lit ;;
213 mips-sony-bsd*) fmt=ecoff targ=mips-big ;;
214 mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
215 mips-*-ultrix*) fmt=ecoff targ=mips-lit endian=little ;;
216 mips-*-ecoff*) fmt=ecoff
217 case "$endian" in
218 big) targ=mips-big ;;
219 *) targ=mips-lit ;;
220 esac
221 ;;
222 mips-*-ecoff*) fmt=ecoff targ=mips-big ;;
223 mips-*-gnu*) fmt=aout
224 case "$endian" in
225 big) targ=mips-big ;;
226 *) targ=mips-lit ;;
227 esac
228 ;;
229 mips-*-irix5*) fmt=elf targ=mips-big ;;
230 mips-*-irix*) fmt=ecoff targ=mips-big ;;
231 mips-*-riscos*) fmt=ecoff targ=mips-big ;;
232 mips-*-sysv*) fmt=ecoff targ=mips-big ;;
233 mips-*-elf*) fmt=elf
234 case "$endian" in
235 big) targ=mips-big ;;
236 *) targ=mips-lit ;;
237 esac
238 ;;
239 ppc-*-pe) fmt=coff em=pe
240 case "$endian" in
241 big) targ=ppc-big ;;
242 *) targ=ppc-lit ;;
243 esac
244 ;;
245 ppc-*-winnt*) fmt=coff em=pe
246 case "$endian" in
247 big) targ=ppc-big ;;
248 *) targ=ppc-lit ;;
249 esac
250 ;;
251 ppc-*-aix*) fmt=coff ;;
252 ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
253 fmt=elf
254 case "$endian" in
255 big) targ=ppc-big ;;
256 *) targ=ppc-lit ;;
257 esac
258 ;;
259 ppc-*-netware*) fmt=elf em=ppcnw ;;
260
261 sh-*-coff) fmt=coff ;;
262
263 # start-sanitize-rce
264 rce-*-aout) fmt=aout ;;
265 # end-sanitize-rce
266
267 ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;;
268 ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;;
269
270 sparc-*-sunos4*) fmt=aout em=sun3 ;;
271 sparc-*-aout | sparc*-*-vxworks)
272 fmt=aout ;;
273 sparc-*-coff) fmt=coff ;;
274 sparc-*-lynxos*) fmt=coff em=lynx ;;
275 sparc-fujitsu-none) fmt=aout ;;
276 sparc-*-elf | sparc*-*-solaris*)
277 fmt=elf ;;
278 sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
279
280 vax-*-bsd* | vax-*-ultrix*)
281 fmt=aout ;;
282 vax-*-vms) fmt=vms ;;
283
284 z8k-*-coff | z8k-*-sim)
285 fmt=coff ;;
286
287 w65-*-*) fmt=coff ;;
288
289 *-*-aout | *-*-scout)
290 fmt=aout ;;
291 *-*-nindy*)
292 fmt=bout ;;
293 *-*-bsd*)
294 fmt=aout em=sun3 ;;
295 *-*-generic) fmt=generic ;;
296 *-*-xray | *-*-hms) fmt=coff ;;
297 *-*-sim) fmt=coff ;;
298 *-*-elf | *-*-sysv4* | *-*-solaris*)
299 AC_MSG_WARN(GAS support for ELF format is incomplete.)
300 fmt=elf dev=yes ;;
301 *-*-vxworks) fmt=aout ;;
302 *-*-netware) fmt=elf ;;
303 esac
304
305 case ${cpu_type}-${fmt} in
306 arm-*) bfd_gas=yes ;;
307 # not yet
308 # i386-aout) bfd_gas=preferred ;;
309 mips-*) bfd_gas=yes ;;
310 ns32k-*) bfd_gas=yes ;;
311 ppc-*) bfd_gas=yes ;;
312 sparc-*) bfd_gas=yes ;;
313 *-elf) bfd_gas=yes ;;
314 *-ecoff) bfd_gas=yes ;;
315 *-som) bfd_gas=yes ;;
316 *) ;;
317 esac
318
319 # Other random stuff.
320
321 test -n "$want_sparcv9" && AC_DEFINE(sparcv9)
322
323 case ${cpu_type} in
324 m68k) extra_objects="$extra_objects m68k-parse.o" ;;
325 esac
326
327 # See if we really can support this configuration with the emulation code.
328
329 if test $this_target = $target ; then
330 primary_bfd_gas=$bfd_gas
331 obj_format=$fmt
332 gas_target=$targ
333 te_file=$em
334
335 if test $bfd_gas = no ; then
336 # Can't support other configurations this way.
337 break
338 fi
339 elif test $bfd_gas = no ; then
340 # Can't support this configuration.
341 break
342 fi
343
344 # From target name and format, produce a list of supported emulations.
345
346 case ${generic_target}-${fmt} in
347 mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
348 mips-*-*-ecoff) case "$endian" in
349 big) emulation="mipsbecoff mipslecoff mipsecoff" ;;
350 *) emulation="mipslecoff mipsbecoff mipsecoff" ;;
351 esac ;;
352 mips-*-*-elf) case "$endian" in
353 big) emulation="mipsbelf mipslelf mipself" ;;
354 *) emulation="mipslelf mipsbelf mipself" ;;
355 esac ;;
356 esac
357
358 emulations="$emulations $emulation"
359
360 done
361
362 # Assign floating point type. Most processors with FP support
363 # IEEE FP. On those that don't support FP at all, usually IEEE
364 # is emulated.
365 case ${target_cpu} in
366 vax | tahoe ) atof=${target_cpu} ;;
367 *) atof=ieee ;;
368 esac
369
370 case "${obj_format}" in
371 "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
372 esac
373
374 dnl
375 dnl Make sure the desired support files exist.
376 dnl
377
378 if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
379 AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
380 fi
381
382 if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
383 AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
384 fi
385
386 # and target makefile frag
387
388 target_frag=${srcdir}/config/${gas_target}.mt
389 if test ! -r ${target_frag}; then
390 target_frag=/dev/null # ick! but subst_file can't be conditionalized
391 fi
392 AC_SUBST_FILE(target_frag)
393
394 case ${user_bfd_gas}-${primary_bfd_gas} in
395 yes-yes | no-no)
396 # We didn't override user's choice.
397 ;;
398 no-yes)
399 AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
400 ;;
401 no-preferred)
402 primary_bfd_gas=no
403 ;;
404 *-preferred)
405 primary_bfd_gas=yes
406 ;;
407 yes-*)
408 primary_bfd_gas=yes
409 ;;
410 -*)
411 # User specified nothing.
412 ;;
413 esac
414
415 # Some COFF configurations want these random other flags set.
416 case ${obj_format} in
417 coff)
418 case ${target_cpu_type} in
419 i386) AC_DEFINE(I386COFF) ;;
420 m68k) AC_DEFINE(M68KCOFF) ;;
421 m88k) AC_DEFINE(M88KCOFF) ;;
422 esac
423 ;;
424 esac
425
426 # Getting this done right is going to be a bitch. Each configuration specified
427 # with --enable-targets=... should be checked for environment, format, cpu, and
428 # bfd_gas setting.
429 #
430 # For each configuration, the necessary object file support code must be linked
431 # in. This might be only one, it might be up to four. The necessary emulation
432 # code needs to be provided, too.
433 #
434 # And then there's "--enable-targets=all"....
435 #
436 # For now, just always do it for MIPS ELF or ECOFF configurations. Sigh.
437
438 formats="${obj_format}"
439 emfiles=""
440 EMULATIONS=""
441 GAS_UNIQ(emulations)
442 for em in . $emulations ; do
443 case $em in
444 .) continue ;;
445 mipsbelf | mipslelf)
446 fmt=elf file=mipself ;;
447 mipsbecoff | mipslecoff)
448 fmt=ecoff file=mipsecoff ;;
449 esac
450 formats="$formats $fmt"
451 emfiles="$emfiles e-$file.o"
452 EMULATIONS="$EMULATIONS &$em,"
453 done
454 GAS_UNIQ(formats)
455 GAS_UNIQ(emfiles)
456 if test `set . $formats ; shift ; echo $#` -gt 1 ; then
457 for fmt in $formats ; do
458 case $fmt in
459 aout) AC_DEFINE(OBJ_MAYBE_AOUT) ;;
460 bout) AC_DEFINE(OBJ_MAYBE_BOUT) ;;
461 coff) AC_DEFINE(OBJ_MAYBE_COFF) ;;
462 ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF) ;;
463 elf) AC_DEFINE(OBJ_MAYBE_ELF) ;;
464 generic) AC_DEFINE(OBJ_MAYBE_GENERIC) ;;
465 hp300) AC_DEFINE(OBJ_MAYBE_HP300) ;;
466 ieee) AC_DEFINE(OBJ_MAYBE_IEEE) ;;
467 som) AC_DEFINE(OBJ_MAYBE_SOM) ;;
468 vms) AC_DEFINE(OBJ_MAYBE_VMS) ;;
469 esac
470 extra_objects="$extra_objects obj-$fmt.o"
471 done
472 obj_format=multi
473 fi
474 if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
475 te_file=multi
476 extra_objects="$extra_objects $emfiles"
477 DEFAULT_EMULATION=`set . $emulations ; echo $2`
478 AC_DEFINE(USE_EMULATIONS)
479 fi
480 AC_SUBST(extra_objects)
481 AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS)
482 AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION")
483
484 files="config/tc-${target_cpu_type}.c config/tc-${target_cpu_type}.h \
485 config/obj-${obj_format}.h config/obj-${obj_format}.c \
486 config/te-${te_file}.h config/atof-${atof}.c \
487 $extra_files"
488 links="targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c \
489 $extra_links"
490
491 case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
492 yes-*-coff) need_bfd=yes ;;
493 no-*-coff) need_bfd=yes
494 AC_DEFINE(MANY_SEGMENTS) ;;
495 esac
496
497 reject_dev_configs=yes
498
499 case ${reject_dev_configs}-${dev} in
500 yes-yes) # Oops.
501 AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
502 ;;
503 esac
504
505 AC_SUBST(target_cpu_type)
506 AC_SUBST(obj_format)
507 AC_SUBST(atof)
508 dnl AC_SUBST(emulation)
509
510 AC_LINK_FILES($files, $links)
511
512 case "${primary_bfd_gas}" in
513 yes) AC_DEFINE(BFD_ASSEMBLER)
514 need_bfd=yes ;;
515 esac
516
517 case "${need_bfd}" in
518 yes) BFDLIB=../bfd/libbfd.a
519 ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
520 ;;
521 esac
522 AC_SUBST(BFDLIB)
523 AC_SUBST(ALL_OBJ_DEPS)
524
525 AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}")
526 AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}")
527 AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}")
528 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}")
529 AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}")
530
531 AC_PROG_CC
532 AC_PROG_INSTALL
533
534 AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
535
536 # Put this here so that autoconf's "cross-compiling" message doesn't confuse
537 # people who are not cross-compiling but are compiling cross-assemblers.
538 AC_MSG_CHECKING(whether compiling a cross-assembler)
539 if test "${host}" = "${target}"; then
540 cross_gas=no
541 else
542 cross_gas=yes
543 AC_DEFINE(CROSS_COMPILE)
544 fi
545 AC_MSG_RESULT($cross_gas)
546
547 dnl ansidecl.h will deal with const
548 dnl AC_CONST
549 AC_FUNC_ALLOCA
550 AC_C_INLINE
551
552 # VMS doesn't have unlink.
553 AC_CHECK_FUNCS(unlink remove, break)
554
555 # Some systems don't have sbrk().
556 AC_CHECK_FUNCS(sbrk)
557
558 # Some non-ANSI preprocessors botch requoting inside strings. That's bad
559 # enough, but on some of those systems, the assert macro relies on requoting
560 # working properly!
561 GAS_WORKING_ASSERT
562
563 # On some systems, the system header files may not declare malloc, realloc,
564 # and free. There are places where gas needs these functions to have been
565 # declared -- such as when taking their addresses.
566 gas_test_headers="
567 #ifdef HAVE_MEMORY_H
568 #include <memory.h>
569 #endif
570 #ifdef HAVE_STRING_H
571 #include <string.h>
572 #endif
573 #ifdef HAVE_STDLIB_H
574 #include <stdlib.h>
575 #endif
576 #ifdef HAVE_UNISTD_H
577 #include <unistd.h>
578 #endif
579 "
580 GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
581 GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
582
583 # Does errno.h declare errno, or do we have to add a separate declaration
584 # for it?
585 GAS_CHECK_DECL_NEEDED(errno, f, int f, [
586 #ifdef HAVE_ERRNO_H
587 #include <errno.h>
588 #endif
589 ])
590
591 dnl This must come last.
592 AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in)