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