configure.in revision 61850
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 61850 2000-06-20 08:21:50Z 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.10)
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 ;;
205changequote(,)dnl
206      i386-*-freebsdaout* | i386-*-freebsd[12].* | i386-*-freebsd[12])
207                            fmt=aout em=386bsd ;;
208changequote([,])dnl
209      i386-*-freebsd*)	    fmt=elf em=freebsd bfd_gas=yes ;;
210      i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*)
211                          fmt=coff ;;
212      i386-*-sco3.2v5*)      fmt=elf
213			    if test ${this_target} = $target; then
214				AC_DEFINE(SCO_ELF, 1,
215				    [Define if defaulting to ELF on SCO 5.])
216			    fi
217			    ;;
218      i386-*-sco3.2*)       fmt=coff ;;
219      i386-*-vsta)          fmt=aout ;;
220      i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*)
221			    fmt=coff em=go32;;
222      i386-*-rtemscoff*)    fmt=coff ;;
223      i386-*-rtemself*)     fmt=elf ;;
224      i386-*-rtems*)        fmt=elf ;;
225      i386-*-gnu*)          fmt=elf ;;
226      i386-*-mach*)
227			    fmt=aout em=mach bfd_gas=yes ;;
228      i386-*-msdos*)        fmt=aout ;;
229      i386-*-moss*)	    fmt=elf ;;
230      i386-*-pe)            fmt=coff em=pe ;;
231      i386-*-cygwin*)       fmt=coff em=pe bfd_gas=yes ;;
232      i386-*-interix*)	    fmt=coff em=interix bfd_gas=yes ;;
233      i386-*-mingw32*)      fmt=coff em=pe bfd_gas=yes ;;
234      i386-*-*nt*)          fmt=coff em=pe ;;
235      i386-*-vxworks*)      fmt=aout ;;
236      i960-*-bout)          fmt=bout ;;
237      i960-*-coff)          fmt=coff em=ic960 ;;
238      i960-*-rtemscoff*)    fmt=coff em=ic960 ;;
239      i960-*-rtemself*)     fmt=elf ;;
240      i960-*-rtems*)        fmt=coff em=ic960 ;;
241      i960-*-nindy*)        fmt=bout ;;
242      i960-*-vxworks4*)     fmt=bout ;;
243      i960-*-vxworks5.0)    fmt=bout ;;
244      i960-*-vxworks5.*)    fmt=coff em=ic960 ;;
245      i960-*-vxworks*)      fmt=bout ;;
246      i960-*-elf*)	    fmt=elf ;;
247
248      m32r-*-*)		    fmt=elf bfd_gas=yes ;;
249
250      m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
251			    fmt=aout em=sun3 ;;
252      m68k-motorola-sysv*)  fmt=coff em=delta ;;
253      m68k-bull-sysv3*)     fmt=coff em=dpx2 ;;
254      m68k-apollo-*)        fmt=coff em=apollo ;;
255      m68k-*-sysv4*) # must be before -sysv*
256			    fmt=elf em=svr4 ;;
257      m68k-*-elf*)	    fmt=elf ;;
258      m68k-*-rtemscoff*)    fmt=coff ;;
259      m68k-*-rtemself*)	    fmt=elf ;;
260      m68k-*-rtems*)        fmt=elf ;;
261      m68k-*-coff | m68k-*-sysv*)
262			    fmt=coff ;;
263      m68k-*-hpux*)         fmt=hp300 em=hp300 ;;
264      m68k-*-linux*aout*)   fmt=aout em=linux ;;
265      m68k-*-linux-gnu*)    fmt=elf em=linux ;;
266      m68k-*-gnu*)	    fmt=elf ;;
267      m68k-*-lynxos*)       fmt=coff em=lynx ;;
268      m68k-*-netbsd*)       fmt=aout em=nbsd bfd_gas=yes ;;
269      m68k-*-openbsd*)      fmt=aout em=nbsd bfd_gas=yes ;;
270      m68k-apple-aux*)      fmt=coff em=aux ;;
271      m68k-*-psos*)         fmt=elf em=psos;;
272
273      m88k-motorola-sysv3*) fmt=coff em=delt88 ;;
274      m88k-*-coff*)         fmt=coff ;;
275
276      mcore-*-elf)	    fmt=elf bfd_gas=yes ;;
277      mcore-*-pe)	    fmt=coff em=pe bfd_gas=yes ;;
278
279      # don't change em like *-*-bsd does
280      mips-dec-netbsd*)	    fmt=elf endian=little ;;
281      mips-dec-openbsd*)    fmt=elf endian=little ;;
282      mips-dec-bsd*)        fmt=aout endian=little ;;
283      mips-sony-bsd*)       fmt=ecoff ;;
284      mips-*-bsd*)          AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
285      mips-*-ultrix*)       fmt=ecoff endian=little ;;
286      mips-*-osf*)          fmt=ecoff endian=little ;;
287      mips-*-ecoff*)        fmt=ecoff ;;
288      mips-*-ecoff*)        fmt=ecoff ;;
289      mips-*-pe*)           fmt=coff endian=little em=pe ;;
290      mips-*-irix6*)	    fmt=elf ;;
291      mips-*-irix5*)        fmt=elf ;;
292      mips-*-irix*)         fmt=ecoff ;;
293      mips-*-lnews*)        fmt=ecoff em=lnews ;;
294      mips-*-riscos*)       fmt=ecoff ;;
295      mips-*-sysv*)         fmt=ecoff ;;
296      mips-*-elf* | mips-*-rtems* | mips-*-linux-gnu* | mips-*-gnu* | mips-*-openbsd*)
297			    fmt=elf ;;
298      mips-*-vxworks*)      fmt=elf
299			    AC_DEFINE(MIPS_STABS_ELF, 1,
300				[Use ELF stabs for MIPS, not ECOFF stabs])
301			    ;;
302      mn10200-*-*)	    fmt=elf bfd_gas=yes ;;
303      mn10300-*-*)	    fmt=elf bfd_gas=yes ;;
304      pj*)		    fmt=elf ;;
305      ppc-*-pe | ppc-*-cygwin* | ppc-*-winnt*)
306		            fmt=coff em=pe ;;
307      ppc-*-aix*)           fmt=coff ;;
308      ppc-*-beos*)          fmt=coff ;;
309      ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
310			    fmt=elf ;;
311      ppc-*-linux-gnu*)	    fmt=elf
312			    case "$endian" in
313			    big)  ;;
314			    *)    AC_MSG_ERROR(GNU/Linux must be configured big endian) ;;
315			    esac
316			    ;;
317      ppc-*-solaris*)	    fmt=elf
318			    if test ${this_target} = $target; then
319				AC_DEFINE(TARGET_SOLARIS_COMMENT, 1,
320				[Define if default target is PowerPC Solaris.])
321			    fi
322			    if test x${endian} = xbig; then
323				AC_MSG_ERROR(Solaris must be configured little endian)
324			    fi
325			    ;;
326      ppc-*-rtems*)	    fmt=elf ;;
327      ppc-*-macos* | ppc-*-mpw*)
328			    fmt=coff em=macos ;;
329      ppc-*-netware*)       fmt=elf em=ppcnw ;;
330      ppc-*-vxworks*)       fmt=elf ;;
331
332      sh-*-elf*)	    fmt=elf ;;
333      sh-*-coff*)           fmt=coff ;;
334      sh-*-pe*)             fmt=coff em=pe bfd_gas=yes;;
335      sh-*-rtemself*)       fmt=elf ;;
336      sh-*-rtemscoff*)	    fmt=coff ;;
337      sh-*-rtems*)          fmt=coff ;;
338
339      ns32k-pc532-mach* | ns32k-pc532-ux*)    fmt=aout em=pc532mach ;;
340      ns32k-pc532-netbsd* | ns32k-pc532-lites*)  fmt=aout em=nbsd532 ;;
341      ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;
342
343      sparc-*-rtemsaout*)   fmt=aout ;;
344      sparc-*-rtemself*)    fmt=elf ;;
345      sparc-*-rtems*)       fmt=elf ;;
346      sparc-*-sunos4*)      fmt=aout em=sun3 ;;
347      sparc-*-aout | sparc*-*-vxworks*)
348			    fmt=aout em=sparcaout ;;
349      sparc-*-coff)         fmt=coff ;;
350      sparc-*-linux*aout*)  fmt=aout em=linux ;;
351      sparc-*-linux-gnu*)   fmt=elf em=linux ;;
352      sparc-*-lynxos*)      fmt=coff em=lynx ;;
353      sparc-fujitsu-none)   fmt=aout ;;
354      sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*)
355			    fmt=elf ;;
356      sparc-*-netbsd*)      fmt=aout em=nbsd ;;
357      sparc-*-openbsd*)     fmt=aout em=nbsd ;;
358
359      sparc*-*-freebsd)	    fmt=elf em=freebsd ;;
360
361      strongarm-*-coff)     fmt=coff ;;
362      strongarm-*-elf)      fmt=elf ;;
363
364      tic30-*-*aout*)	    fmt=aout bfd_gas=yes ;;
365      tic30-*-*coff*)       fmt=coff bfd_gas=yes ;;
366      tic80-*-*)	    fmt=coff ;;
367
368      v850-*-*)		    fmt=elf bfd_gas=yes ;;
369      v850e-*-*)	    fmt=elf bfd_gas=yes ;;
370      v850ea-*-*)	    fmt=elf bfd_gas=yes ;;
371
372      vax-*-bsd* | vax-*-ultrix*)
373			    fmt=aout ;;
374      vax-*-vms)            fmt=vms ;;
375
376
377      z8k-*-coff | z8k-*-sim)
378			    fmt=coff ;;
379
380      w65-*-*)              fmt=coff ;;
381
382      *-*-aout | *-*-scout)
383			    fmt=aout ;;
384      *-*-nindy*)
385			    fmt=bout ;;
386      *-*-bsd*)
387			    fmt=aout em=sun3 ;;
388      *-*-generic)          fmt=generic ;;
389      *-*-xray | *-*-hms)   fmt=coff ;;
390      *-*-sim)              fmt=coff ;;
391      *-*-elf | *-*-sysv4* | *-*-solaris*)
392			    AC_MSG_WARN(GAS support for ${generic_target} is incomplete.)
393			    fmt=elf dev=yes ;;
394      *-*-vxworks)          fmt=aout ;;
395      *-*-netware)          fmt=elf ;;
396    esac
397
398    if test ${this_target} = $target ; then
399      endian_def=
400      if test x${endian} = xbig; then
401	endian_def=1
402      elif test x${endian} = xlittle; then
403	endian_def=0
404      fi
405      if test x${endian_def} != x; then
406	AC_DEFINE_UNQUOTED(TARGET_BYTES_BIG_ENDIAN, $endian_def,
407			   [Define as 1 if big endian.])
408      fi
409    fi
410
411    case ${cpu_type}-${fmt} in
412      alpha*-*)	bfd_gas=yes ;;
413      arm-*)	bfd_gas=yes ;;
414    # not yet
415    # i386-aout)	bfd_gas=preferred ;;
416      mips-*)	bfd_gas=yes ;;
417      ns32k-*)	bfd_gas=yes ;;
418      ppc-*)	bfd_gas=yes ;;
419      sparc-*)	bfd_gas=yes ;;
420      strongarm-*)	bfd_gas=yes ;;
421      *-elf)	bfd_gas=yes ;;
422      *-ecoff)	bfd_gas=yes ;;
423      *-som)	bfd_gas=yes ;;
424    #enable bfd for coff and aout to allow testing if a bfd target is
425    #the primary target, but not for coff or aout as the primary target
426      i386-coff)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
427      i386-aout)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
428      *)		;;
429    esac
430
431# Other random stuff.
432
433    # Do we need the opcodes library?
434    case ${cpu_type} in
435      vax | i386 | tic30)
436	;;
437
438      *)
439	need_opcodes=yes
440
441	case "${enable_shared}" in
442	yes) shared_opcodes=true ;;
443	*opcodes*) shared_opcodes=true ;;
444	*) shared_opcodes=false ;;
445	esac
446	if test "${shared_opcodes}" = "true"; then
447	  # A shared libopcodes must be linked against libbfd.
448	  need_bfd=yes
449	fi
450	;;
451    esac
452
453    # Any other special object files needed ?
454    case ${cpu_type} in
455      fr30 | m32r)
456	using_cgen=yes
457	;;
458
459      m68k)
460	case ${extra_objects} in
461	*m68k-parse.o*) ;;
462	*) extra_objects="$extra_objects m68k-parse.o" ;;
463	esac
464	;;
465
466      mips)
467	echo ${extra_objects} | grep -s "itbl-parse.o" 
468	if test $? -ne 0 ; then
469	  extra_objects="$extra_objects itbl-parse.o"
470	fi
471
472	echo ${extra_objects} | grep -s "itbl-lex.o" 
473	if test $? -ne 0 ; then
474	  extra_objects="$extra_objects itbl-lex.o"
475	fi
476
477	echo ${extra_objects} | grep -s "itbl-ops.o" 
478	if test $? -ne 0 ; then
479	  extra_objects="$extra_objects itbl-ops.o"
480	fi
481	;;
482
483      sparc)
484	if test $this_target = $target ; then
485	  AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
486	fi
487	;;
488      *)
489	;;
490    esac
491
492    if test $using_cgen = yes ; then
493	case "x${extra_objects}" in
494	*cgen.o*) ;;
495	*) extra_objects="$extra_objects cgen.o" ;;
496	esac
497    fi
498
499# See if we really can support this configuration with the emulation code.
500
501    if test $this_target = $target ; then
502      primary_bfd_gas=$bfd_gas
503      obj_format=$fmt
504      te_file=$em
505
506      if test $bfd_gas = no ; then
507	# Can't support other configurations this way.
508	break
509      fi
510    elif test $bfd_gas = no ; then
511      # Can't support this configuration.
512      break
513    fi
514
515# From target name and format, produce a list of supported emulations.
516
517    case ${generic_target}-${fmt} in
518      mips-*-irix5*-*)	emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
519      mips-*-linux-gnu*-*) case "$endian" in
520			big)	emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
521			*)	emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;;
522			esac ;;
523      mips-*-lnews*-ecoff) ;;
524      mips-*-*-ecoff)	case "$endian" in
525			big)	emulation="mipsbecoff mipslecoff mipsecoff" ;;
526			*)	emulation="mipslecoff mipsbecoff mipsecoff" ;;
527			esac ;;
528      mips-*-*-elf)	case "$endian" in
529			big)	emulation="mipsbelf mipslelf mipself" ;;
530			*)	emulation="mipslelf mipsbelf mipself" ;;
531			esac ;;
532      # Uncommenting the next line will turn on support for i386 AOUT
533      # for the default linux configuration
534      # i386-*-linux*-elf) emulation="i386elf i386aout" ;;
535      #
536      i386-*-aout)	emulation="i386aout" ;;
537      i386-*-coff)	emulation="i386coff" ;;
538      i386-*-elf)	emulation="i386elf" ;;
539    esac
540
541    emulations="$emulations $emulation"
542
543done
544
545# Turn on all targets if possible
546if test ${all_targets} = "yes"; then
547  case ${target_cpu_type} in
548  i386)
549    case ${obj_format} in
550    aout)
551      emulations="$emulations i386coff i386elf"
552      ;;
553    coff)
554      emulations="$emulations i386aout i386elf"
555    ;;
556    elf)
557      emulations="$emulations i386aout i386coff"
558      ;;
559    esac
560  ;;
561  esac
562fi
563
564# Assign floating point type.  Most processors with FP support
565# IEEE FP.  On those that don't support FP at all, usually IEEE
566# is emulated.
567case ${target_cpu} in
568  vax | tahoe )	atof=${target_cpu} ;;
569  *)		atof=ieee ;;
570esac
571
572case "${obj_format}" in
573  "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
574esac
575
576# Unfortunately the cpu in cpu-opc.h file isn't always $(TARGET_CPU).
577cgen_cpu_prefix=""
578if test $using_cgen = yes ; then
579  case ${target_cpu} in
580    *) cgen_cpu_prefix=${target_cpu} ;;
581  esac
582  AC_SUBST(cgen_cpu_prefix)
583  AC_DEFINE(USING_CGEN, 1, [Using cgen code?])
584fi
585
586dnl
587dnl Make sure the desired support files exist.
588dnl
589
590if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
591  AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
592fi
593
594if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
595  AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
596fi
597
598case ${user_bfd_gas}-${primary_bfd_gas} in
599  yes-yes | no-no)
600    # We didn't override user's choice.
601    ;;
602  no-yes)
603    AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
604    ;;
605  no-preferred)
606    primary_bfd_gas=no
607    ;;
608  *-preferred)
609    primary_bfd_gas=yes
610    ;;
611  yes-*)
612    primary_bfd_gas=yes
613    ;;
614  -*)
615    # User specified nothing.
616    ;;
617esac
618
619# Some COFF configurations want these random other flags set.
620case ${obj_format} in
621  coff)
622    case ${target_cpu_type} in
623      i386) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;;
624      m68k) AC_DEFINE(M68KCOFF, 1, [Using m68k COFF?]) ;;
625      m88k) AC_DEFINE(M88KCOFF, 1, [Using m88k COFF?]) ;;
626    esac
627    ;;
628esac
629
630# Getting this done right is going to be a bitch.  Each configuration specified
631# with --enable-targets=... should be checked for environment, format, cpu, and
632# bfd_gas setting.
633#
634# For each configuration, the necessary object file support code must be linked
635# in.  This might be only one, it might be up to four.  The necessary emulation
636# code needs to be provided, too.
637#
638# And then there's "--enable-targets=all"....
639#
640# For now, just always do it for MIPS ELF or ECOFF configurations.  Sigh.
641
642formats="${obj_format}"
643emfiles=""
644EMULATIONS=""
645GAS_UNIQ(emulations)
646for em in . $emulations ; do
647  case $em in
648    .)	continue ;;
649    mipsbelf | mipslelf)
650	fmt=elf   file=mipself ;;
651    mipsbecoff | mipslecoff)
652	fmt=ecoff file=mipsecoff ;;
653    i386aout)
654	fmt=aout  file=i386aout ;;
655    i386coff)
656	fmt=coff  file=i386coff ;;
657    i386elf)
658	fmt=elf   file=i386elf ;;
659  esac
660  formats="$formats $fmt"
661  emfiles="$emfiles e-$file.o"
662  EMULATIONS="$EMULATIONS &$em,"
663done
664GAS_UNIQ(formats)
665GAS_UNIQ(emfiles)
666if test `set . $formats ; shift ; echo $#` -gt 1 ; then
667  for fmt in $formats ; do
668    case $fmt in
669      aout)	AC_DEFINE(OBJ_MAYBE_AOUT, 1,    [a.out support?])   ;;
670      bout)	AC_DEFINE(OBJ_MAYBE_BOUT, 1,    [b.out support?])   ;;
671      coff)	AC_DEFINE(OBJ_MAYBE_COFF, 1,    [COFF support?])    ;;
672      ecoff)	AC_DEFINE(OBJ_MAYBE_ECOFF, 1,   [ECOFF support?])   ;;
673      elf)	AC_DEFINE(OBJ_MAYBE_ELF, 1,     [ELF support?])     ;;
674      generic)	AC_DEFINE(OBJ_MAYBE_GENERIC, 1, [generic support?]) ;;
675      hp300)	AC_DEFINE(OBJ_MAYBE_HP300, 1,   [HP300 support?])   ;;
676      ieee)	AC_DEFINE(OBJ_MAYBE_IEEE, 1,    [IEEE support?])    ;;
677      som)	AC_DEFINE(OBJ_MAYBE_SOM, 1,     [SOM support?])     ;;
678      vms)	AC_DEFINE(OBJ_MAYBE_VMS, 1,     [VMS support?])     ;;
679    esac
680    extra_objects="$extra_objects obj-$fmt.o"
681  done
682  obj_format=multi
683fi
684if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
685  DEFAULT_EMULATION=`set . $emulations ; echo $2`
686  # e-mips* has more than one emulation per file, e-i386* has just one at the
687  # moment.  If only one emulation is specified, then don't define
688  # USE_EMULATIONS or include any of the e-files as they will only be bloat.
689  case "${obj_format}${emfiles}" in
690    multi* | *mips*)
691      extra_objects="$extra_objects $emfiles"
692      AC_DEFINE(USE_EMULATIONS, 1, [Use emulation support?]) ;;
693  esac
694fi
695AC_SUBST(extra_objects)
696AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS, [Supported emulations.])
697AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION",
698		   [Default emulation.])
699
700case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
701  yes-*-coff)	need_bfd=yes ;;
702  no-*-coff)	need_bfd=yes
703		AC_DEFINE(MANY_SEGMENTS, 1, [old COFF support?]) ;;
704esac
705
706reject_dev_configs=yes
707
708case ${reject_dev_configs}-${dev} in
709  yes-yes) # Oops.
710    AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
711    ;;
712esac
713
714AC_SUBST(target_cpu_type)
715AC_SUBST(obj_format)
716AC_SUBST(te_file)
717AC_SUBST(install_tooldir)
718AC_SUBST(atof)
719dnl AC_SUBST(emulation)
720
721case "${primary_bfd_gas}" in
722  yes)	AC_DEFINE(BFD_ASSEMBLER, 1, [Use BFD interface?])
723	need_bfd=yes ;;
724esac
725
726# do we need the opcodes library?
727case "${need_opcodes}" in
728yes)
729  OPCODES_LIB=../opcodes/libopcodes.la
730  ;;
731esac
732
733case "${need_bfd}" in
734yes)
735  BFDLIB=../bfd/libbfd.la
736  ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
737  ;;
738esac
739
740AC_SUBST(BFDLIB)
741AC_SUBST(OPCODES_LIB)
742
743AC_SUBST(ALL_OBJ_DEPS)
744
745AC_DEFINE_UNQUOTED(TARGET_ALIAS,	"${target_alias}", [Target alias.])
746AC_DEFINE_UNQUOTED(TARGET_CANONICAL,	"${target}",       [Canonical target.])
747AC_DEFINE_UNQUOTED(TARGET_CPU,		"${target_cpu}",   [Target CPU.])
748AC_DEFINE_UNQUOTED(TARGET_VENDOR,	"${target_vendor}", [Target vendor.])
749AC_DEFINE_UNQUOTED(TARGET_OS,		"${target_os}",    [Target OS.])
750
751AC_PROG_CC
752
753AC_PROG_YACC
754AM_PROG_LEX
755
756ALL_LINGUAS=
757CY_GNU_GETTEXT
758
759AM_MAINTAINER_MODE
760AC_EXEEXT
761
762AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
763
764# Put this here so that autoconf's "cross-compiling" message doesn't confuse
765# people who are not cross-compiling but are compiling cross-assemblers.
766AC_MSG_CHECKING(whether compiling a cross-assembler)
767if test "${host}" = "${target}"; then
768  cross_gas=no
769else
770  cross_gas=yes
771  AC_DEFINE(CROSS_COMPILE, 1, [Compiling cross-assembler?])
772fi
773AC_MSG_RESULT($cross_gas)
774
775dnl ansidecl.h will deal with const
776dnl AC_CONST
777AC_FUNC_ALLOCA
778AC_C_INLINE
779
780# VMS doesn't have unlink.
781AC_CHECK_FUNCS(unlink remove, break)
782
783# Some systems don't have sbrk().
784AC_CHECK_FUNCS(sbrk)
785
786# Some non-ANSI preprocessors botch requoting inside strings.  That's bad
787# enough, but on some of those systems, the assert macro relies on requoting
788# working properly!
789GAS_WORKING_ASSERT
790
791# On some systems, the system header files may not declare malloc, realloc,
792# and free.  There are places where gas needs these functions to have been
793# declared -- such as when taking their addresses.
794gas_test_headers="
795#ifdef HAVE_MEMORY_H
796#include <memory.h>
797#endif
798#ifdef HAVE_STRING_H
799#include <string.h>
800#else
801#ifdef HAVE_STRINGS_H
802#include <strings.h>
803#endif
804#endif
805#ifdef HAVE_STDLIB_H
806#include <stdlib.h>
807#endif
808#ifdef HAVE_UNISTD_H
809#include <unistd.h>
810#endif
811"
812GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
813GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
814GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
815GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
816GAS_CHECK_DECL_NEEDED(environ, f, char **f, $gas_test_headers)
817
818# Does errno.h declare errno, or do we have to add a separate declaration
819# for it?
820GAS_CHECK_DECL_NEEDED(errno, f, int f, [
821#ifdef HAVE_ERRNO_H
822#include <errno.h>
823#endif
824])
825
826dnl This must come last.
827
828dnl We used to make symlinks to files in the source directory, but now
829dnl we just use the right name for .c files, and create .h files in
830dnl the build directory which include the right .h file.  Make sure
831dnl the old symlinks don't exist, so that a reconfigure in an existing
832dnl directory behaves reasonably.
833
834AC_OUTPUT(Makefile doc/Makefile ${GDBINIT}:gdbinit.in po/Makefile.in:po/Make-in,
835[rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
836 echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
837 echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
838 echo '#include "te-'"${te_file}"'.h"' > targ-env.h
839 echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
840 if test "x$cgen_cpu_prefix" != x ; then
841   echo '#include "opcodes/'"${cgen_cpu_prefix}"'-desc.h"' > cgen-desc.h
842 fi
843
844 sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile],
845[target_cpu_type=${target_cpu_type}
846 cgen_cpu_prefix=${cgen_cpu_prefix}
847 obj_format=${obj_format}
848 te_file=${te_file}])
849