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