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