Tue Jan 27 13:32:01 1998 Robert Lipe <robertl@dgii.com>
[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 dnl v2.5 needed for --bindir et al
8 AC_PREREQ(2.5)
9 AC_INIT(as.h)
10
11 AC_CANONICAL_SYSTEM
12
13 AM_INIT_AUTOMAKE(gas, 2.8.2)
14
15 AM_PROG_LIBTOOL
16
17 user_bfd_gas=
18 AC_ARG_ENABLE(bfd-assembler,
19 [ --enable-bfd-assembler use BFD back end for writing object files],
20 [case "${enableval}" in
21 yes) need_bfd=yes user_bfd_gas=yes ;;
22 no) user_bfd_gas=no ;;
23 *) AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;;
24 esac])dnl
25 AC_ARG_ENABLE(targets,
26 [ targets alternative target configurations besides the primary],
27 [case "${enableval}" in
28 yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
29 ;;
30 no) enable_targets= ;;
31 *) enable_targets=$enableval ;;
32 esac])dnl
33 AC_ARG_ENABLE(commonbfdlib,
34 [ --enable-commonbfdlib build shared BFD/opcodes/libiberty library],
35 [case "${enableval}" in
36 yes) commonbfdlib=true ;;
37 no) commonbfdlib=false ;;
38 *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
39 esac])dnl
40
41 # Generate a header file
42 AM_CONFIG_HEADER(config.h:config.in)
43
44 te_file=generic
45
46 canon_targets=""
47 if test -n "$enable_targets" ; then
48 for t in `echo $enable_targets | sed 's/,/ /g'`; do
49 result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $t 2>/dev/null`
50 if test -n "$result" ; then
51 canon_targets="$canon_targets $result"
52 # else
53 # # Permit "all", etc. We don't support it yet though.
54 # canon_targets="$canon_targets $t"
55 fi
56 done
57 GAS_UNIQ(canon_targets)
58 fi
59
60 emulations=""
61
62 for this_target in $target $canon_targets ; do
63
64 changequote(,)dnl
65 eval `echo $this_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'`
66 changequote([,])dnl
67
68 # check for architecture variants
69 arch=
70 endian=
71 case ${cpu} in
72 alpha*) cpu_type=alpha ;;
73 armeb) cpu_type=arm endian=big ;;
74 arm*) cpu_type=arm endian=little ;;
75 thumb*) cpu_type=arm endian=little ;;
76 hppa*) cpu_type=hppa ;;
77 changequote(,)dnl
78 i[456]86) cpu_type=i386 ;;
79 m680[012346]0) cpu_type=m68k ;;
80 m68008) cpu_type=m68k ;;
81 m683??) cpu_type=m68k ;;
82 changequote([,])dnl
83 m8*) cpu_type=m88k ;;
84 mips*el) cpu_type=mips endian=little ;;
85 # start-sanitize-r5900
86 mips*5900*) cpu_type=mips endian=little ;;
87 # end-sanitize-r5900
88 mips*) cpu_type=mips endian=big ;;
89 powerpcle*) cpu_type=ppc endian=little ;;
90 powerpc*) cpu_type=ppc endian=big ;;
91 rs6000*) cpu_type=ppc ;;
92 sparclite*) cpu_type=sparc arch=sparclite ;;
93 sparclet*) cpu_type=sparc arch=sparclet ;;
94 sparc64*) cpu_type=sparc arch=v9-64 ;;
95 sparc*) cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
96 v850*) cpu_type=v850 ;;
97 *) cpu_type=${cpu} ;;
98 esac
99
100 if test ${this_target} = $target ; then
101 target_cpu_type=${cpu_type}
102 if test x${endian} = xbig; then
103 AC_DEFINE(TARGET_BYTES_BIG_ENDIAN, 1)
104 elif test x${endian} = xlittle; then
105 AC_DEFINE(TARGET_BYTES_BIG_ENDIAN, 0)
106 fi
107 elif test ${target_cpu_type} != ${cpu_type} ; then
108 continue
109 fi
110
111 generic_target=${cpu_type}-$vendor-$os
112 dev=no
113 bfd_gas=no
114 em=generic
115
116 # assign object format
117 case ${generic_target} in
118 a29k-*-coff) fmt=coff ;;
119 a29k-amd-udi) fmt=coff ;;
120 a29k-amd-ebmon) fmt=coff ;;
121 a29k-nyu-sym1) fmt=coff ;;
122 a29k-*-vxworks*) fmt=coff ;;
123
124 alpha*-*-*vms*) fmt=evax ;;
125 alpha*-*-netware*) fmt=ecoff ;;
126 alpha*-*-openbsd*) fmt=ecoff ;;
127 alpha*-*-osf*) fmt=ecoff ;;
128 alpha*-*-linuxecoff*) fmt=ecoff ;;
129 alpha*-*-linux*) fmt=elf em=linux ;;
130
131 arc-*-elf*) fmt=elf bfd_gas=yes ;;
132
133 arm-*-riscix*) fmt=aout em=riscix ;;
134 arm-*-aout) fmt=aout ;;
135 arm-*-coff | thumb-*-coff) fmt=coff ;;
136 arm-*-riscix*) fmt=aout ;;
137 arm-*-pe) fmt=coff em=pe ;;
138
139 d10v-*-*) fmt=elf bfd_gas=yes ;;
140 # start-sanitize-d30v
141 d30v-*-*) fmt=elf bfd_gas=yes ;;
142 # end-sanitize-d30v
143
144 hppa-*-*elf*) fmt=elf em=hppa ;;
145 hppa-*-lites*) fmt=elf em=hppa ;;
146 hppa-*-osf*) fmt=som em=hppa ;;
147 hppa-*-rtems*) fmt=elf em=hppa ;;
148 hppa-*-hpux*) fmt=som em=hppa ;;
149 hppa-*-bsd*) fmt=som em=hppa ;;
150 hppa-*-hiux*) fmt=som em=hppa ;;
151
152 h8300-*-coff) fmt=coff ;;
153
154 i386-ibm-aix*) fmt=coff em=i386aix ;;
155 i386-sequent-bsd*) fmt=aout em=dynix bfd_gas=yes ;;
156 i386-*-bsd*) fmt=aout em=386bsd ;;
157 i386-*-netbsd0.8) fmt=aout em=386bsd ;;
158 i386-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes;;
159 i386-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes;;
160 i386-*-linux*aout* | i386-*-linuxoldld) fmt=aout em=linux ;;
161 i386-*-linux*coff*) fmt=coff em=linux ;;
162 i386-*-linux*) fmt=elf em=linux ;;
163 i386-*-lynxos*) fmt=coff em=lynx ;;
164 i386-*-sysv4* | i386-*-solaris* | i386-*-elf)
165 fmt=elf ;;
166 i386-*-freebsdelf*) fmt=elf ;;
167 i386-*-freebsd*) fmt=aout em=386bsd ;;
168 i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*)
169 fmt=coff ;;
170 i386-*-sco3.2v5*) fmt=elf
171 if test ${this_target} = $target; then
172 AC_DEFINE(SCO_ELF)
173 fi
174 ;;
175 i386-*-sco3.2*) fmt=coff ;;
176 i386-*-vsta) fmt=aout ;;
177 i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*)
178 fmt=coff em=go32;;
179 i386-*-rtems*) fmt=coff ;;
180 i386-*-gnu*) fmt=elf ;;
181 i386-*-mach*)
182 fmt=aout em=mach bfd_gas=yes ;;
183 i386-*-msdos*) fmt=aout ;;
184 i386-*-moss*) fmt=elf ;;
185 i386-*-pe) fmt=coff em=pe ;;
186 i386-*-cygwin32) fmt=coff em=pe bfd_gas=yes ;;
187 i386-*-*nt) fmt=coff em=pe ;;
188 i960-*-bout) fmt=bout ;;
189 i960-*-coff) fmt=coff em=ic960 ;;
190 i960-*-rtems*) fmt=coff em=ic960 ;;
191 i960-*-nindy*) fmt=bout ;;
192 i960-*-vxworks4*) fmt=bout ;;
193 i960-*-vxworks5.0) fmt=bout ;;
194 i960-*-vxworks5.*) fmt=coff em=ic960 ;;
195 i960-*-vxworks*) fmt=bout ;;
196
197 m32r-*-*) fmt=elf bfd_gas=yes ;;
198
199 m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
200 fmt=aout em=sun3 ;;
201 m68k-motorola-sysv*) fmt=coff em=delta ;;
202 m68k-bull-sysv3*) fmt=coff em=dpx2 ;;
203 m68k-apollo-*) fmt=coff em=apollo ;;
204 m68k-*-sysv4*) # must be before -sysv*
205 fmt=elf em=svr4 ;;
206 m68k-*-elf*) fmt=elf ;;
207 m68k-*-coff | m68k-*-sysv* | m68k-*-rtems*)
208 fmt=coff ;;
209 m68k-*-hpux*) fmt=hp300 em=hp300 ;;
210 m68k-*-linux*aout*) fmt=aout em=linux ;;
211 m68k-*-linux*) fmt=elf em=linux ;;
212 m68k-*-lynxos*) fmt=coff em=lynx ;;
213 m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
214 m68k-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
215 m68k-apple-aux*) fmt=coff em=aux ;;
216 m68k-*-psos*) fmt=elf em=psos;;
217
218 m88k-motorola-sysv3*) fmt=coff em=delt88 ;;
219 m88k-*-coff*) fmt=coff ;;
220
221 # don't change em like *-*-bsd does
222 mips-dec-netbsd*) fmt=elf endian=little ;;
223 mips-dec-openbsd*) fmt=elf endian=little ;;
224 mips-dec-bsd*) fmt=aout ;;
225 mips-sony-bsd*) fmt=ecoff ;;
226 mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
227 mips-*-ultrix*) fmt=ecoff endian=little ;;
228 mips-*-osf*) fmt=ecoff endian=little ;;
229 mips-*-ecoff*) fmt=ecoff ;;
230 mips-*-ecoff*) fmt=ecoff ;;
231 mips-*-irix6*) fmt=elf ;;
232 mips-*-irix5*) fmt=elf ;;
233 mips-*-irix*) fmt=ecoff ;;
234 mips-*-lnews*) fmt=ecoff em=lnews ;;
235 mips-*-riscos*) fmt=ecoff ;;
236 mips-*-sysv*) fmt=ecoff ;;
237 mips-*-elf* | mips-*-rtems* | mips-*-linux* | mips-*-gnu* | mips-*-openbsd*)
238 fmt=elf ;;
239 mn10200-*-*) fmt=elf bfd_gas=yes ;;
240 mn10300-*-*) fmt=elf bfd_gas=yes ;;
241 ppc-*-pe | ppc-*-cygwin32 | ppc-*-winnt*)
242 fmt=coff em=pe ;;
243 ppc-*-aix*) fmt=coff ;;
244 ppc-*-beos*) fmt=coff ;;
245 ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
246 fmt=elf ;;
247 ppc-*-linux*) fmt=elf
248 case "$endian" in
249 big) ;;
250 *) AC_MSG_ERROR(Linux must be configured big endian) ;;
251 esac
252 ;;
253 ppc-*-solaris*) fmt=elf
254 if test ${this_target} = $target; then
255 AC_DEFINE(TARGET_SOLARIS_COMMENT)
256 fi
257 if test x${endian} = xbig; then
258 AC_MSG_ERROR(Solaris must be configured little endian)
259 fi
260 ;;
261 ppc-*-rtems*) fmt=elf ;;
262 ppc-*-macos* | ppc-*-mpw*)
263 fmt=coff em=macos ;;
264 ppc-*-netware*) fmt=elf em=ppcnw ;;
265
266 sh-*-elf*) fmt=elf ;;
267 sh-*-coff*) fmt=coff ;;
268 sh-*-rtems*) fmt=elf ;;
269
270 ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;;
271 ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;;
272 ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;
273
274 sparc-*-rtems*) fmt=aout ;;
275 sparc-*-sunos4*) fmt=aout em=sun3 ;;
276 sparc-*-aout | sparc*-*-vxworks*)
277 fmt=aout em=sparcaout ;;
278 sparc-*-coff) fmt=coff ;;
279 sparc-*-linux*aout*) fmt=aout em=linux ;;
280 sparc-*-linux*) fmt=elf em=linux ;;
281 sparc-*-lynxos*) fmt=coff em=lynx ;;
282 sparc-fujitsu-none) fmt=aout ;;
283 sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*)
284 fmt=elf ;;
285 sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
286 sparc-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
287
288 # start-sanitize-tic80
289 tic80-*-*) fmt=coff ;;
290 # end-sanitize-tic80
291
292 # start-sanitize-sky
293 txvu-*-*) fmt=elf bfd_gas=yes ;;
294 # end-sanitize-sky
295
296 v850-*-*) fmt=elf bfd_gas=yes ;;
297
298 # start-sanitize-v850e
299 v850e-*-*) fmt=elf bfd_gas=yes ;;
300 v850ea-*-*) fmt=elf bfd_gas=yes ;;
301 # end-sanitize-v850e
302 vax-*-bsd* | vax-*-ultrix*)
303 fmt=aout ;;
304 vax-*-vms) fmt=vms ;;
305
306 z8k-*-coff | z8k-*-sim)
307 fmt=coff ;;
308
309 w65-*-*) fmt=coff ;;
310
311 *-*-aout | *-*-scout)
312 fmt=aout ;;
313 *-*-nindy*)
314 fmt=bout ;;
315 *-*-bsd*)
316 fmt=aout em=sun3 ;;
317 *-*-generic) fmt=generic ;;
318 *-*-xray | *-*-hms) fmt=coff ;;
319 *-*-sim) fmt=coff ;;
320 *-*-elf | *-*-sysv4* | *-*-solaris*)
321 AC_MSG_WARN(GAS support for ${generic_target} is incomplete.)
322 fmt=elf dev=yes ;;
323 *-*-vxworks) fmt=aout ;;
324 *-*-netware) fmt=elf ;;
325 esac
326
327 case ${cpu_type}-${fmt} in
328 alpha*-*) bfd_gas=yes ;;
329 arm-*) bfd_gas=yes ;;
330 # not yet
331 # i386-aout) bfd_gas=preferred ;;
332 mips-*) bfd_gas=yes ;;
333 ns32k-*) bfd_gas=yes ;;
334 ppc-*) bfd_gas=yes ;;
335 sparc-*) bfd_gas=yes ;;
336 *-elf) bfd_gas=yes ;;
337 *-ecoff) bfd_gas=yes ;;
338 *-som) bfd_gas=yes ;;
339 *) ;;
340 esac
341
342 # Other random stuff.
343
344 # do we need the opcodes library?
345 case ${cpu_type} in
346 vax | i386)
347 ;;
348 *)
349 need_opcodes=yes
350 if test "${shared_opcodes}" = "true"; then
351 # A shared libopcodes must be linked against libbfd.
352 need_bfd=yes
353 fi
354 ;;
355 esac
356
357 case ${cpu_type} in
358 m32r)
359 case ${extra_objects} in
360 *cgen.o*) ;;
361 *) extra_objects="$extra_objects cgen.o"
362 AC_DEFINE(USING_CGEN)
363 ;;
364 esac
365 ;;
366
367 m68k)
368 case ${extra_objects} in
369 *m68k-parse.o*) ;;
370 *) extra_objects="$extra_objects m68k-parse.o" ;;
371 esac
372 ;;
373
374 mips)
375 echo ${extra_objects} | grep -s "itbl-parse.o"
376 if test $? -ne 0 ; then
377 extra_objects="$extra_objects itbl-parse.o"
378 fi
379
380 echo ${extra_objects} | grep -s "itbl-lex.o"
381 if test $? -ne 0 ; then
382 extra_objects="$extra_objects itbl-lex.o"
383 fi
384
385 echo ${extra_objects} | grep -s "itbl-ops.o"
386 if test $? -ne 0 ; then
387 extra_objects="$extra_objects itbl-ops.o"
388 fi
389 ;;
390
391 sparc)
392 if test $this_target = $target ; then
393 AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}")
394 fi
395 ;;
396
397 *)
398 ;;
399 esac
400
401 # See if we really can support this configuration with the emulation code.
402
403 if test $this_target = $target ; then
404 primary_bfd_gas=$bfd_gas
405 obj_format=$fmt
406 te_file=$em
407
408 if test $bfd_gas = no ; then
409 # Can't support other configurations this way.
410 break
411 fi
412 elif test $bfd_gas = no ; then
413 # Can't support this configuration.
414 break
415 fi
416
417 # From target name and format, produce a list of supported emulations.
418
419 case ${generic_target}-${fmt} in
420 mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
421 mips-*-linux*-*) case "$endian" in
422 big) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
423 *) emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;;
424 esac ;;
425 mips-*-lnews*-ecoff) ;;
426 mips-*-*-ecoff) case "$endian" in
427 big) emulation="mipsbecoff mipslecoff mipsecoff" ;;
428 *) emulation="mipslecoff mipsbecoff mipsecoff" ;;
429 esac ;;
430 mips-*-*-elf) case "$endian" in
431 big) emulation="mipsbelf mipslelf mipself" ;;
432 *) emulation="mipslelf mipsbelf mipself" ;;
433 # Uncommenting the next line will turn on support for i386 COFF
434 # in any i386 ELF configuration. This probably doesn't work
435 # correctly.
436 # i386-*-*-elf) emulation="i386coff i386elf" ;;
437 esac ;;
438 esac
439
440 emulations="$emulations $emulation"
441
442 done
443
444 # Assign floating point type. Most processors with FP support
445 # IEEE FP. On those that don't support FP at all, usually IEEE
446 # is emulated.
447 case ${target_cpu} in
448 vax | tahoe ) atof=${target_cpu} ;;
449 *) atof=ieee ;;
450 esac
451
452 case "${obj_format}" in
453 "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
454 esac
455
456 dnl
457 dnl Make sure the desired support files exist.
458 dnl
459
460 if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
461 AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
462 fi
463
464 if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
465 AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
466 fi
467
468 case ${user_bfd_gas}-${primary_bfd_gas} in
469 yes-yes | no-no)
470 # We didn't override user's choice.
471 ;;
472 no-yes)
473 AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
474 ;;
475 no-preferred)
476 primary_bfd_gas=no
477 ;;
478 *-preferred)
479 primary_bfd_gas=yes
480 ;;
481 yes-*)
482 primary_bfd_gas=yes
483 ;;
484 -*)
485 # User specified nothing.
486 ;;
487 esac
488
489 # Some COFF configurations want these random other flags set.
490 case ${obj_format} in
491 coff)
492 case ${target_cpu_type} in
493 i386) AC_DEFINE(I386COFF) ;;
494 m68k) AC_DEFINE(M68KCOFF) ;;
495 m88k) AC_DEFINE(M88KCOFF) ;;
496 esac
497 ;;
498 esac
499
500 # Getting this done right is going to be a bitch. Each configuration specified
501 # with --enable-targets=... should be checked for environment, format, cpu, and
502 # bfd_gas setting.
503 #
504 # For each configuration, the necessary object file support code must be linked
505 # in. This might be only one, it might be up to four. The necessary emulation
506 # code needs to be provided, too.
507 #
508 # And then there's "--enable-targets=all"....
509 #
510 # For now, just always do it for MIPS ELF or ECOFF configurations. Sigh.
511
512 formats="${obj_format}"
513 emfiles=""
514 EMULATIONS=""
515 GAS_UNIQ(emulations)
516 for em in . $emulations ; do
517 case $em in
518 .) continue ;;
519 mipsbelf | mipslelf)
520 fmt=elf file=mipself ;;
521 mipsbecoff | mipslecoff)
522 fmt=ecoff file=mipsecoff ;;
523 i386coff)
524 fmt=coff file=i386coff ;;
525 i386elf)
526 fmt=elf file=i386elf ;;
527 esac
528 formats="$formats $fmt"
529 emfiles="$emfiles e-$file.o"
530 EMULATIONS="$EMULATIONS &$em,"
531 done
532 GAS_UNIQ(formats)
533 GAS_UNIQ(emfiles)
534 if test `set . $formats ; shift ; echo $#` -gt 1 ; then
535 for fmt in $formats ; do
536 case $fmt in
537 aout) AC_DEFINE(OBJ_MAYBE_AOUT) ;;
538 bout) AC_DEFINE(OBJ_MAYBE_BOUT) ;;
539 coff) AC_DEFINE(OBJ_MAYBE_COFF) ;;
540 ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF) ;;
541 elf) AC_DEFINE(OBJ_MAYBE_ELF) ;;
542 generic) AC_DEFINE(OBJ_MAYBE_GENERIC) ;;
543 hp300) AC_DEFINE(OBJ_MAYBE_HP300) ;;
544 ieee) AC_DEFINE(OBJ_MAYBE_IEEE) ;;
545 som) AC_DEFINE(OBJ_MAYBE_SOM) ;;
546 vms) AC_DEFINE(OBJ_MAYBE_VMS) ;;
547 esac
548 extra_objects="$extra_objects obj-$fmt.o"
549 done
550 obj_format=multi
551 fi
552 if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
553 te_file=multi
554 extra_objects="$extra_objects $emfiles"
555 DEFAULT_EMULATION=`set . $emulations ; echo $2`
556 AC_DEFINE(USE_EMULATIONS)
557 fi
558 AC_SUBST(extra_objects)
559 AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS)
560 AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION")
561
562 case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
563 yes-*-coff) need_bfd=yes ;;
564 no-*-coff) need_bfd=yes
565 AC_DEFINE(MANY_SEGMENTS) ;;
566 esac
567
568 reject_dev_configs=yes
569
570 case ${reject_dev_configs}-${dev} in
571 yes-yes) # Oops.
572 AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
573 ;;
574 esac
575
576 AC_SUBST(target_cpu_type)
577 AC_SUBST(obj_format)
578 AC_SUBST(te_file)
579 AC_SUBST(atof)
580 dnl AC_SUBST(emulation)
581
582 case "${primary_bfd_gas}" in
583 yes) AC_DEFINE(BFD_ASSEMBLER)
584 need_bfd=yes ;;
585 esac
586
587 # do we need the opcodes library?
588 case "${need_opcodes}" in
589 yes)
590 OPCODES_LIB=../opcodes/libopcodes.la
591 ;;
592 esac
593
594 case "${need_bfd}" in
595 yes)
596 BFDLIB=../bfd/libbfd.la
597 ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
598 ;;
599 esac
600
601 AC_SUBST(BFDLIB)
602 AC_SUBST(OPCODES_LIB)
603
604 AC_SUBST(ALL_OBJ_DEPS)
605
606 AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}")
607 AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}")
608 AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}")
609 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}")
610 AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}")
611
612 AC_PROG_CC
613
614 AC_PROG_YACC
615 AC_PROG_LEX
616 AC_DECL_YYTEXT
617
618 AM_MAINTAINER_MODE
619 AM_CYGWIN32
620 AM_EXEEXT
621
622 AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
623
624 # Put this here so that autoconf's "cross-compiling" message doesn't confuse
625 # people who are not cross-compiling but are compiling cross-assemblers.
626 AC_MSG_CHECKING(whether compiling a cross-assembler)
627 if test "${host}" = "${target}"; then
628 cross_gas=no
629 else
630 cross_gas=yes
631 AC_DEFINE(CROSS_COMPILE)
632 fi
633 AC_MSG_RESULT($cross_gas)
634
635 dnl ansidecl.h will deal with const
636 dnl AC_CONST
637 AC_FUNC_ALLOCA
638 AC_C_INLINE
639
640 # VMS doesn't have unlink.
641 AC_CHECK_FUNCS(unlink remove, break)
642
643 # Some systems don't have sbrk().
644 AC_CHECK_FUNCS(sbrk)
645
646 # Some non-ANSI preprocessors botch requoting inside strings. That's bad
647 # enough, but on some of those systems, the assert macro relies on requoting
648 # working properly!
649 GAS_WORKING_ASSERT
650
651 # On some systems, the system header files may not declare malloc, realloc,
652 # and free. There are places where gas needs these functions to have been
653 # declared -- such as when taking their addresses.
654 gas_test_headers="
655 #ifdef HAVE_MEMORY_H
656 #include <memory.h>
657 #endif
658 #ifdef HAVE_STRING_H
659 #include <string.h>
660 #else
661 #ifdef HAVE_STRINGS_H
662 #include <strings.h>
663 #endif
664 #endif
665 #ifdef HAVE_STDLIB_H
666 #include <stdlib.h>
667 #endif
668 #ifdef HAVE_UNISTD_H
669 #include <unistd.h>
670 #endif
671 "
672 GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
673 GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
674 GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
675 GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
676
677 # Does errno.h declare errno, or do we have to add a separate declaration
678 # for it?
679 GAS_CHECK_DECL_NEEDED(errno, f, int f, [
680 #ifdef HAVE_ERRNO_H
681 #include <errno.h>
682 #endif
683 ])
684
685 dnl This must come last.
686
687 dnl We used to make symlinks to files in the source directory, but now
688 dnl we just use the right name for .c files, and create .h files in
689 dnl the build directory which include the right .h file. Make sure
690 dnl the old symlinks don't exist, so that a reconfigure in an existing
691 dnl directory behaves reasonably.
692
693 AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in,
694 [rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
695 echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
696 echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
697 echo '#include "te-'"${te_file}"'.h"' > targ-env.h
698 echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
699 case ${target_cpu_type} in
700 m32r) echo '#include "opcodes/'"${target_cpu_type}"'-opc.h"' > cgen-opc.h ;;
701 esac],
702 [target_cpu_type=${target_cpu_type}
703 obj_format=${obj_format}
704 te_file=${te_file}])