Tue Jul 22 18:38:56 1997 Robert Hoehne <robert.hoehne@Mathematik.TU-Chemnitz.DE>
[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.5)dnl v2.5 needed for --bindir et al
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 AC_ARG_ENABLE(shared,
27 [ --enable-shared build shared BFD library],
28 [case "${enableval}" in
29 yes) shared=true shared_bfd=true shared_opcodes=true ;;
30 no) shared=false ;;
31 *bfd*opcodes*) shared=true shared_bfd=true shared_opcodes=true ;;
32 *opcodes*bfd*) shared=true shared_bfd=true shared_opcodes=true ;;
33 *bfd*) shared=true shared_bfd=true ;;
34 *opcodes*) shared=true shared_opcodes=true ;;
35 *) shared=false ;;
36 esac])dnl
37 AC_ARG_ENABLE(commonbfdlib,
38 [ --enable-commonbfdlib build shared BFD/opcodes/libiberty library],
39 [case "${enableval}" in
40 yes) commonbfdlib=true ;;
41 no) commonbfdlib=false ;;
42 *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
43 esac])dnl
44
45 # Generate a header file -- gets more post-processing by Makefile later.
46 AC_CONFIG_HEADER(conf)
47
48 dnl For recursion to work right, this must be an absolute pathname.
49 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
50 AC_CANONICAL_SYSTEM
51 AC_ARG_PROGRAM
52
53 te_file=generic
54
55 canon_targets=""
56 if test -n "$enable_targets" ; then
57 for t in `echo $enable_targets | sed 's/,/ /g'`; do
58 result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $t 2>/dev/null`
59 if test -n "$result" ; then
60 canon_targets="$canon_targets $result"
61 # else
62 # # Permit "all", etc. We don't support it yet though.
63 # canon_targets="$canon_targets $t"
64 fi
65 done
66 GAS_UNIQ(canon_targets)
67 fi
68
69 emulations=""
70
71 for this_target in $target $canon_targets ; do
72
73 changequote(,)dnl
74 eval `echo $this_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'`
75 changequote([,])dnl
76
77 # check for architecture variants
78 case ${cpu} in
79 armeb) cpu_type=arm endian=big ;;
80 arm*) cpu_type=arm endian=little ;;
81 thumb*) cpu_type=arm endian=little ;;
82 hppa*) cpu_type=hppa ;;
83 changequote(,)dnl
84 i[456]86) cpu_type=i386 ;;
85 m680[012346]0) cpu_type=m68k ;;
86 m68008) cpu_type=m68k ;;
87 m683??) cpu_type=m68k ;;
88 changequote([,])dnl
89 m8*) cpu_type=m88k ;;
90 mips*el) cpu_type=mips endian=little ;;
91 mips*5900*) cpu_type=mips endian=little ;;
92 mips*) cpu_type=mips endian=big ;;
93 powerpcle*) cpu_type=ppc endian=little ;;
94 powerpc*) cpu_type=ppc endian=big ;;
95 rs6000*) cpu_type=ppc ;;
96 sparc64) cpu_type=sparc want_sparc_v9=true ;;
97 sparc*) cpu_type=sparc ;;
98 *) cpu_type=${cpu} ;;
99 esac
100
101 if test ${this_target} = $target ; then
102 target_cpu_type=${cpu_type}
103 elif test ${target_cpu_type} != ${cpu_type} ; then
104 continue
105 fi
106
107 targ=${cpu_type}
108 generic_target=${cpu_type}-$vendor-$os
109 dev=no
110 bfd_gas=no
111 em=generic
112
113 # assign object format
114 case ${generic_target} in
115 a29k-*-coff) fmt=coff targ=ebmon29k ;;
116 a29k-amd-udi) fmt=coff targ=ebmon29k ;;
117 a29k-amd-ebmon) fmt=coff targ=ebmon29k ;;
118 a29k-nyu-sym1) fmt=coff targ=ebmon29k ;;
119 a29k-*-vxworks*) fmt=coff ;;
120
121 alpha-*-*vms*) fmt=evax ;;
122 alpha-*-netware*) fmt=ecoff ;;
123 alpha-*-openbsd*) fmt=ecoff ;;
124 alpha-*-osf*) fmt=ecoff ;;
125 alpha-*-linuxecoff*) fmt=ecoff ;;
126 alpha-*-linux*) fmt=elf em=linux ;;
127
128 # start-sanitize-arc
129 arc-*-elf*) fmt=elf bfd_gas=yes ;;
130 # end-sanitize-arc
131
132 arm-*-riscix*) fmt=aout targ=arm-lit em=riscix ;;
133 arm-*-aout) fmt=aout
134 case "$endian" in
135 big) targ=arm-big ;;
136 *) targ=arm-lit ;;
137 esac
138 ;;
139 arm-*-coff | thumb-*-coff) fmt=coff ;;
140 arm-*-riscix*) fmt=aout ;;
141 arm-*-pe) fmt=coff targ=armcoff em=pe ;;
142
143 d10v-*-*) fmt=elf bfd_gas=yes ;;
144 # start-sanitize-d30v
145 d30v-*-*) fmt=elf bfd_gas=yes ;;
146 # end-sanitize-d30v
147
148 hppa-*-*elf*) fmt=elf em=hppa ;;
149 hppa-*-lites*) fmt=elf em=hppa ;;
150 hppa-*-osf*) fmt=som em=hppa ;;
151 hppa-*-rtems*) fmt=elf em=hppa ;;
152 hppa-*-hpux*) fmt=som em=hppa ;;
153 hppa-*-bsd*) fmt=som em=hppa ;;
154 hppa-*-hiux*) fmt=som em=hppa ;;
155
156 h8300-*-coff) fmt=coff ;;
157
158 i386-ibm-aix*) fmt=coff targ=i386coff
159 em=i386aix ;;
160 i386-sequent-bsd*) fmt=aout em=dynix bfd_gas=yes ;;
161 i386-*-bsd*) fmt=aout em=386bsd ;;
162 i386-*-netbsd0.8) fmt=aout em=386bsd ;;
163 i386-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes;;
164 i386-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes;;
165 i386-*-linux*aout* | i386-*-linuxoldld) fmt=aout em=linux ;;
166 i386-*-linux*coff*) fmt=coff em=linux
167 targ=i386coff ;;
168 i386-*-linux*) fmt=elf em=linux ;;
169 i386-*-lynxos*) fmt=coff targ=i386coff
170 em=lynx ;;
171 i386-*-sysv4* | i386-*-solaris* | i386-*-elf | i386-*-freebsdelf*)
172 fmt=elf ;;
173 i386-*-sco*elf*) fmt=elf targ=sco5 ;;
174 i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*)
175 fmt=coff targ=i386coff ;;
176 i386-*-vsta) fmt=aout ;;
177 i386-*-msdosdjgpp* | i386-*-go32*)
178 fmt=coff targ=coffgo32 em=go32;;
179 i386-*-rtems*) fmt=coff targ=i386coff ;;
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 targ=i386coff em=pe ;;
186 i386-*-cygwin32) fmt=coff targ=i386coff em=pe bfd_gas=yes ;;
187 i386-*-*nt) fmt=coff targ=i386coff em=pe ;;
188 i960-*-bout) fmt=bout ;;
189 i960-*-coff) fmt=coff em=ic960 targ=ic960coff ;;
190 i960-*-rtems*) fmt=coff em=ic960 targ=ic960coff ;;
191 i960-*-nindy*) fmt=bout ;;
192 i960-*-vxworks4*) fmt=bout ;;
193 i960-*-vxworks5.0) fmt=bout ;;
194 i960-*-vxworks5.*) fmt=coff em=ic960 targ=ic960coff ;;
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 targ=m68kcoff em=delta ;;
202 m68k-bull-sysv3*) fmt=coff targ=m68kcoff em=dpx2 ;;
203 m68k-apollo-*) fmt=coff targ=apollo 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 targ=m68kcoff ;;
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 targ=m68kcoff
213 em=lynx ;;
214 m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
215 m68k-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
216 m68k-apple-aux*) fmt=coff targ=m68kcoff em=aux ;;
217 m68k-*-psos*) fmt=elf em=psos;;
218
219 m88k-motorola-sysv3*) fmt=coff targ=m88kcoff em=delt88 ;;
220 m88k-*-coff*) fmt=coff targ=m88kcoff ;;
221
222 # don't change em like *-*-bsd does
223 mips-dec-netbsd*) fmt=elf targ=mips-lit endian=little ;;
224 mips-dec-openbsd*) fmt=elf targ=mips-lit endian=little ;;
225 mips-dec-bsd*) fmt=aout targ=mips-lit ;;
226 mips-sony-bsd*) fmt=ecoff targ=mips-big ;;
227 mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
228 mips-*-ultrix*) fmt=ecoff targ=mips-lit endian=little ;;
229 mips-*-osf*) fmt=ecoff targ=mips-lit endian=little ;;
230 mips-*-ecoff*) fmt=ecoff
231 case "$endian" in
232 big) targ=mips-big ;;
233 *) targ=mips-lit ;;
234 esac
235 ;;
236 mips-*-ecoff*) fmt=ecoff targ=mips-big ;;
237 mips-*-irix6*) fmt=elf targ=mips-big ;;
238 mips-*-irix5*) fmt=elf targ=mips-big ;;
239 mips-*-irix*) fmt=ecoff targ=mips-big ;;
240 mips-*-lnews*) fmt=ecoff targ=mips-lit em=lnews ;;
241 mips-*-riscos*) fmt=ecoff targ=mips-big ;;
242 mips-*-sysv*) fmt=ecoff targ=mips-big ;;
243 mips-*-elf* | mips-*-rtems* | mips-*-linux* | mips-*-gnu* | mips-*-openbsd*)
244 fmt=elf
245 case "$endian" in
246 big) targ=mips-big ;;
247 *) targ=mips-lit ;;
248 esac
249 ;;
250 mn10200-*-*) fmt=elf bfd_gas=yes ;;
251 mn10300-*-*) fmt=elf bfd_gas=yes ;;
252 ppc-*-pe | ppc-*-cygwin32 | ppc-*-winnt*)
253 fmt=coff em=pe
254 case "$endian" in
255 big) targ=ppc-big ;;
256 *) targ=ppc-lit ;;
257 esac
258 ;;
259 ppc-*-aix*) fmt=coff ;;
260 ppc-*-beos*) fmt=coff ;;
261 ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
262 fmt=elf
263 case "$endian" in
264 big) targ=ppc-big ;;
265 *) targ=ppc-lit ;;
266 esac
267 ;;
268 ppc-*-linux*) fmt=elf
269 case "$endian" in
270 big) targ=ppc-big ;;
271 *) AC_MSG_ERROR(Linux must be configured big endian) ;;
272 esac
273 ;;
274 ppc-*-solaris*) fmt=elf
275 case "$endian" in
276 big) AC_MSG_ERROR(Solaris must be configured little endian) ;;
277 *) targ=ppc-sol ;;
278 esac
279 ;;
280 ppc-*-rtems*)
281 fmt=elf
282 case "$endian" in
283 big) targ=ppc-big ;;
284 *) targ=ppc-lit ;;
285 esac
286 ;;
287 ppc-*-macos* | ppc-*-mpw*)
288 fmt=coff em=macos ;;
289 ppc-*-netware*) fmt=elf em=ppcnw ;;
290
291 sh-*-elf*) fmt=elf ;;
292 sh-*-coff*) fmt=coff ;;
293
294 ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;;
295 ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;;
296 ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;
297
298 sparc-*-rtems*) fmt=aout ;;
299 sparc-*-sunos4*) fmt=aout em=sun3 ;;
300 sparc-*-aout | sparc*-*-vxworks*)
301 fmt=aout em=sparcaout ;;
302 sparc-*-coff) fmt=coff ;;
303 sparc-*-linux*aout*) fmt=aout em=linux ;;
304 sparc-*-linux*) fmt=elf em=linux ;;
305 sparc-*-lynxos*) fmt=coff em=lynx ;;
306 sparc-fujitsu-none) fmt=aout ;;
307 sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*)
308 fmt=elf ;;
309 sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
310 sparc-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
311
312 # start-sanitize-tic80
313 tic80-*-*) fmt=coff targ=tic80coff;;
314 # end-sanitize-tic80
315 # start-sanitize-v850
316 v850-*-*) fmt=elf bfd_gas=yes ;;
317
318 # end-sanitize-v850
319 vax-*-bsd* | vax-*-ultrix*)
320 fmt=aout ;;
321 vax-*-vms) fmt=vms ;;
322
323 z8k-*-coff | z8k-*-sim)
324 fmt=coff ;;
325
326 w65-*-*) fmt=coff ;;
327
328 *-*-aout | *-*-scout)
329 fmt=aout ;;
330 *-*-nindy*)
331 fmt=bout ;;
332 *-*-bsd*)
333 fmt=aout em=sun3 ;;
334 *-*-generic) fmt=generic ;;
335 *-*-xray | *-*-hms) fmt=coff ;;
336 *-*-sim) fmt=coff ;;
337 *-*-elf | *-*-sysv4* | *-*-solaris*)
338 AC_MSG_WARN(GAS support for ${generic_target} is incomplete.)
339 fmt=elf dev=yes ;;
340 *-*-vxworks) fmt=aout ;;
341 *-*-netware) fmt=elf ;;
342 esac
343
344 case ${cpu_type}-${fmt} in
345 alpha-*) bfd_gas=yes ;;
346 arm-*) bfd_gas=yes ;;
347 # not yet
348 # i386-aout) bfd_gas=preferred ;;
349 mips-*) bfd_gas=yes ;;
350 ns32k-*) bfd_gas=yes ;;
351 ppc-*) bfd_gas=yes ;;
352 sparc-*) bfd_gas=yes ;;
353 *-elf) bfd_gas=yes ;;
354 *-ecoff) bfd_gas=yes ;;
355 *-som) bfd_gas=yes ;;
356 *) ;;
357 esac
358
359 # Other random stuff.
360
361 # do we need the opcodes library?
362 case ${cpu_type} in
363 vax | i386)
364 ;;
365 *)
366 need_opcodes=yes
367 if test "${shared_opcodes}" = "true"; then
368 # A shared libopcodes must be linked against libbfd.
369 need_bfd=yes
370 fi
371 ;;
372 esac
373
374 test -n "$want_sparc_v9" && AC_DEFINE(SPARC_V9)
375
376 case ${cpu}-${vendor}-${os} in
377 sparc64-*-elf*) AC_DEFINE(SPARC_ARCH64) ;;
378 esac
379
380 case ${cpu_type} in
381 m32r)
382 case ${extra_objects} in
383 *cgen.o*) ;;
384 *) extra_objects="$extra_objects cgen.o"
385 AC_DEFINE(USING_CGEN)
386 ;;
387 esac
388 ;;
389
390 m68k)
391 case ${extra_objects} in
392 *m68k-parse.o*) ;;
393 *) extra_objects="$extra_objects m68k-parse.o" ;;
394 esac
395 ;;
396
397 mips)
398 echo ${extra_objects} | grep -s "itbl-parse.o"
399 if test $? -ne 0 ; then
400 extra_objects="$extra_objects itbl-parse.o"
401 fi
402
403 echo ${extra_objects} | grep -s "itbl-lex.o"
404 if test $? -ne 0 ; then
405 extra_objects="$extra_objects itbl-lex.o"
406 fi
407
408 echo ${extra_objects} | grep -s "itbl-ops.o"
409 if test $? -ne 0 ; then
410 extra_objects="$extra_objects itbl-ops.o"
411 fi
412 ;;
413
414 *)
415 ;;
416 esac
417
418 # See if we really can support this configuration with the emulation code.
419
420 if test $this_target = $target ; then
421 primary_bfd_gas=$bfd_gas
422 obj_format=$fmt
423 gas_target=$targ
424 te_file=$em
425
426 if test $bfd_gas = no ; then
427 # Can't support other configurations this way.
428 break
429 fi
430 elif test $bfd_gas = no ; then
431 # Can't support this configuration.
432 break
433 fi
434
435 # From target name and format, produce a list of supported emulations.
436
437 case ${generic_target}-${fmt} in
438 mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
439 mips-*-linux*-*) case "$endian" in
440 big) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
441 *) emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;;
442 esac ;;
443 mips-*-lnews*-ecoff) ;;
444 mips-*-*-ecoff) case "$endian" in
445 big) emulation="mipsbecoff mipslecoff mipsecoff" ;;
446 *) emulation="mipslecoff mipsbecoff mipsecoff" ;;
447 esac ;;
448 mips-*-*-elf) case "$endian" in
449 big) emulation="mipsbelf mipslelf mipself" ;;
450 *) emulation="mipslelf mipsbelf mipself" ;;
451 # Uncommenting the next line will turn on support for i386 COFF
452 # in any i386 ELF configuration. This probably doesn't work
453 # correctly.
454 # i386-*-*-elf) emulation="i386coff i386elf" ;;
455 esac ;;
456 esac
457
458 emulations="$emulations $emulation"
459
460 done
461
462 # Assign floating point type. Most processors with FP support
463 # IEEE FP. On those that don't support FP at all, usually IEEE
464 # is emulated.
465 case ${target_cpu} in
466 vax | tahoe ) atof=${target_cpu} ;;
467 *) atof=ieee ;;
468 esac
469
470 case "${obj_format}" in
471 "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
472 esac
473
474 dnl
475 dnl Make sure the desired support files exist.
476 dnl
477
478 if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
479 AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
480 fi
481
482 if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
483 AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
484 fi
485
486 # and target makefile frag
487
488 target_frag=${srcdir}/config/${gas_target}.mt
489 if test ! -r ${target_frag}; then
490 target_frag=/dev/null # ick! but subst_file can't be conditionalized
491 fi
492 AC_SUBST_FILE(target_frag)
493
494 case ${user_bfd_gas}-${primary_bfd_gas} in
495 yes-yes | no-no)
496 # We didn't override user's choice.
497 ;;
498 no-yes)
499 AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
500 ;;
501 no-preferred)
502 primary_bfd_gas=no
503 ;;
504 *-preferred)
505 primary_bfd_gas=yes
506 ;;
507 yes-*)
508 primary_bfd_gas=yes
509 ;;
510 -*)
511 # User specified nothing.
512 ;;
513 esac
514
515 # Some COFF configurations want these random other flags set.
516 case ${obj_format} in
517 coff)
518 case ${target_cpu_type} in
519 i386) AC_DEFINE(I386COFF) ;;
520 m68k) AC_DEFINE(M68KCOFF) ;;
521 m88k) AC_DEFINE(M88KCOFF) ;;
522 esac
523 ;;
524 esac
525
526 # Getting this done right is going to be a bitch. Each configuration specified
527 # with --enable-targets=... should be checked for environment, format, cpu, and
528 # bfd_gas setting.
529 #
530 # For each configuration, the necessary object file support code must be linked
531 # in. This might be only one, it might be up to four. The necessary emulation
532 # code needs to be provided, too.
533 #
534 # And then there's "--enable-targets=all"....
535 #
536 # For now, just always do it for MIPS ELF or ECOFF configurations. Sigh.
537
538 formats="${obj_format}"
539 emfiles=""
540 EMULATIONS=""
541 GAS_UNIQ(emulations)
542 for em in . $emulations ; do
543 case $em in
544 .) continue ;;
545 mipsbelf | mipslelf)
546 fmt=elf file=mipself ;;
547 mipsbecoff | mipslecoff)
548 fmt=ecoff file=mipsecoff ;;
549 i386coff)
550 fmt=coff file=i386coff ;;
551 i386elf)
552 fmt=elf file=i386elf ;;
553 esac
554 formats="$formats $fmt"
555 emfiles="$emfiles e-$file.o"
556 EMULATIONS="$EMULATIONS &$em,"
557 done
558 GAS_UNIQ(formats)
559 GAS_UNIQ(emfiles)
560 if test `set . $formats ; shift ; echo $#` -gt 1 ; then
561 for fmt in $formats ; do
562 case $fmt in
563 aout) AC_DEFINE(OBJ_MAYBE_AOUT) ;;
564 bout) AC_DEFINE(OBJ_MAYBE_BOUT) ;;
565 coff) AC_DEFINE(OBJ_MAYBE_COFF) ;;
566 ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF) ;;
567 elf) AC_DEFINE(OBJ_MAYBE_ELF) ;;
568 generic) AC_DEFINE(OBJ_MAYBE_GENERIC) ;;
569 hp300) AC_DEFINE(OBJ_MAYBE_HP300) ;;
570 ieee) AC_DEFINE(OBJ_MAYBE_IEEE) ;;
571 som) AC_DEFINE(OBJ_MAYBE_SOM) ;;
572 vms) AC_DEFINE(OBJ_MAYBE_VMS) ;;
573 esac
574 extra_objects="$extra_objects obj-$fmt.o"
575 done
576 obj_format=multi
577 fi
578 if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
579 te_file=multi
580 extra_objects="$extra_objects $emfiles"
581 DEFAULT_EMULATION=`set . $emulations ; echo $2`
582 AC_DEFINE(USE_EMULATIONS)
583 fi
584 AC_SUBST(extra_objects)
585 AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS)
586 AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION")
587
588 case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
589 yes-*-coff) need_bfd=yes ;;
590 no-*-coff) need_bfd=yes
591 AC_DEFINE(MANY_SEGMENTS) ;;
592 esac
593
594 reject_dev_configs=yes
595
596 case ${reject_dev_configs}-${dev} in
597 yes-yes) # Oops.
598 AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
599 ;;
600 esac
601
602 AC_SUBST(target_cpu_type)
603 AC_SUBST(obj_format)
604 AC_SUBST(te_file)
605 AC_SUBST(atof)
606 dnl AC_SUBST(emulation)
607
608 case "${primary_bfd_gas}" in
609 yes) AC_DEFINE(BFD_ASSEMBLER)
610 need_bfd=yes ;;
611 esac
612
613 # do we need the opcodes library?
614 case "${need_opcodes}" in
615 yes)
616 OPCODES_DEP=../opcodes/libopcodes.a
617 OPCODES_LIB='-L../opcodes -lopcodes'
618
619 # We need to handle some special cases for shared libraries.
620 case "${host}" in
621 *-*-sunos*)
622 # On SunOS, we must link against the name we are going to install,
623 # not -lbfd, since SunOS does not support SONAME.
624 if test "${shared_opcodes}" = "true"; then
625 OPCODES_LIB='-L../opcodes -l`echo opcodes | sed '"'"'$(program_transform_name)'"'"'`'
626 fi
627 ;;
628 alpha*-*-osf*)
629 # On Alpha OSF/1, the native linker searches all the -L
630 # directories for any LIB.so files, and only then searches for any
631 # LIB.a files. That means that if there is an installed
632 # libbfd.so, but this build is not done with --enable-shared, the
633 # link will wind up being against the install libbfd.so rather
634 # than the newly built libbfd. To avoid this, we must explicitly
635 # link against libbfd.a when --enable-shared is not used.
636 if test "${shared_opcodes}" != "true"; then
637 OPCODES_LIB='../opcodes/libopcodes.a'
638 fi
639 ;;
640 esac
641 ;;
642 esac
643
644 case "${need_bfd}" in
645 yes)
646 BFDDEP=../bfd/libbfd.a
647 BFDLIB='-L../bfd -lbfd'
648 ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
649
650 # We need to handle some special cases for shared libraries
651 case "${host}" in
652 *-*-sunos*)
653 # On SunOS, we must link against the name we are going to install,
654 # not -lbfd, since SunOS does not support SONAME.
655 if test "${shared_bfd}" = "true"; then
656 BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`'
657 fi
658 ;;
659 alpha*-*-osf*)
660 # On Alpha OSF/1, the native linker searches all the -L
661 # directories for any LIB.so files, and only then searches for any
662 # LIB.a files. That means that if there is an installed
663 # libbfd.so, but this build is not done with --enable-shared, the
664 # link will wind up being against the install libbfd.so rather
665 # than the newly built libbfd. To avoid this, we must explicitly
666 # link against libbfd.a when --enable-shared is not used.
667 if test "${shared_bfd}" != "true"; then
668 BFDLIB='../bfd/libbfd.a'
669 fi
670 ;;
671 esac
672
673 if test "${commonbfdlib}" = "true"; then
674 # when a shared libbfd is built with --enable-commonbfdlib,
675 # all of libopcodes is available in libbfd.so
676 OPCODES_LIB=
677 fi
678 ;;
679 esac
680
681 AC_SUBST(BFDDEP)
682 AC_SUBST(BFDLIB)
683 AC_SUBST(OPCODES_DEP)
684 AC_SUBST(OPCODES_LIB)
685
686 AC_SUBST(ALL_OBJ_DEPS)
687
688 AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}")
689 AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}")
690 AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}")
691 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}")
692 AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}")
693
694 AC_PROG_CC
695 AC_PROG_INSTALL
696
697 AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
698
699 # Put this here so that autoconf's "cross-compiling" message doesn't confuse
700 # people who are not cross-compiling but are compiling cross-assemblers.
701 AC_MSG_CHECKING(whether compiling a cross-assembler)
702 if test "${host}" = "${target}"; then
703 cross_gas=no
704 else
705 cross_gas=yes
706 AC_DEFINE(CROSS_COMPILE)
707 fi
708 AC_MSG_RESULT($cross_gas)
709
710 dnl ansidecl.h will deal with const
711 dnl AC_CONST
712 AC_FUNC_ALLOCA
713 AC_C_INLINE
714
715 # VMS doesn't have unlink.
716 AC_CHECK_FUNCS(unlink remove, break)
717
718 # Some systems don't have sbrk().
719 AC_CHECK_FUNCS(sbrk)
720
721 # Some non-ANSI preprocessors botch requoting inside strings. That's bad
722 # enough, but on some of those systems, the assert macro relies on requoting
723 # working properly!
724 GAS_WORKING_ASSERT
725
726 # On some systems, the system header files may not declare malloc, realloc,
727 # and free. There are places where gas needs these functions to have been
728 # declared -- such as when taking their addresses.
729 gas_test_headers="
730 #ifdef HAVE_MEMORY_H
731 #include <memory.h>
732 #endif
733 #ifdef HAVE_STRING_H
734 #include <string.h>
735 #else
736 #ifdef HAVE_STRINGS_H
737 #include <strings.h>
738 #endif
739 #endif
740 #ifdef HAVE_STDLIB_H
741 #include <stdlib.h>
742 #endif
743 #ifdef HAVE_UNISTD_H
744 #include <unistd.h>
745 #endif
746 "
747 GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
748 GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
749 GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
750 GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
751
752 # Does errno.h declare errno, or do we have to add a separate declaration
753 # for it?
754 GAS_CHECK_DECL_NEEDED(errno, f, int f, [
755 #ifdef HAVE_ERRNO_H
756 #include <errno.h>
757 #endif
758 ])
759
760 HLDFLAGS=
761 HLDENV=
762 RPATH_ENVVAR=LD_LIBRARY_PATH
763 # If we have shared libraries, try to set rpath reasonably.
764 if test "${shared}" = "true"; then
765 case "${host}" in
766 *-*-hpux*)
767 HLDFLAGS='-Wl,+s,+b,$(libdir)'
768 RPATH_ENVVAR=SHLIB_PATH
769 ;;
770 *-*-irix5* | *-*-irix6*)
771 HLDFLAGS='-Wl,-rpath,$(libdir)'
772 ;;
773 *-*-linux*aout*)
774 ;;
775 *-*-linux*)
776 HLDFLAGS='-Wl,-rpath,$(libdir)'
777 ;;
778 *-*-solaris*)
779 HLDFLAGS='-R $(libdir)'
780 ;;
781 *-*-sysv4*)
782 HLDENV='if test -z "$${LD_RUN_PATH}"; then LD_RUN_PATH=$(libdir); else LD_RUN_PATH=$${LD_RUN_PATH}:$(libdir); fi; export LD_RUN_PATH;'
783 ;;
784 esac
785 fi
786
787 # On SunOS, if the linker supports the -rpath option, use it to
788 # prevent ../bfd and ../opcodes from being included in the run time
789 # search path.
790 case "${host}" in
791 *-*-sunos*)
792 echo 'main () { }' > conftest.c
793 ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
794 if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
795 :
796 elif grep 'No such file' conftest.t >/dev/null 2>&1; then
797 :
798 elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
799 :
800 elif test "${shared}" = "true"; then
801 HLDFLAGS='-Wl,-rpath=$(libdir)'
802 else
803 HLDFLAGS='-Wl,-rpath='
804 fi
805 rm -f conftest.t conftest.c conftest
806 ;;
807 esac
808 AC_SUBST(HLDFLAGS)
809 AC_SUBST(HLDENV)
810 AC_SUBST(RPATH_ENVVAR)
811
812 dnl This must come last.
813
814 dnl We used to make symlinks to files in the source directory, but now
815 dnl we just use the right name for .c files, and create .h files in
816 dnl the build directory which include the right .h file. Make sure
817 dnl the old symlinks don't exist, so that a reconfigure in an existing
818 dnl directory behaves reasonably.
819
820 AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in,
821 [rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
822 echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
823 echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
824 echo '#include "te-'"${te_file}"'.h"' > targ-env.h
825 echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
826 case ${target_cpu_type} in
827 m32r) echo '#include "opcodes/'"${target_cpu_type}"'-opc.h"' > cgen-opc.h ;;
828 esac],
829 [target_cpu_type=${target_cpu_type}
830 obj_format=${obj_format}
831 te_file=${te_file}])