configure.in revision 78837
133965Sjdpdnl Process this file with autoconf to produce a configure script.
233965Sjdpdnl
333965Sjdpdnl And be careful when changing it!  If you must add tests with square
433965Sjdpdnl brackets, be sure changequote invocations surround it.
533965Sjdpdnl
660517Sobriendnl $FreeBSD: head/contrib/binutils/gas/configure.in 78837 2001-06-26 17:51:35Z obrien $
733965Sjdpdnl
838891Sjdpdnl v2.5 needed for --bindir et al
960517SobrienAC_PREREQ(2.13)
1038891SjdpAC_INIT(as.h)
1138891Sjdp
1238891SjdpAC_CANONICAL_SYSTEM
1377310SobrienAC_ISC_POSIX
1438891Sjdp
1578837Sobrienchangequote(,)dnl
1678837SobrienBFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ 	]*\([^ 	]*\)[ 	]*).*/\1/p' < ${srcdir}/../bfd/configure.in`
1778837Sobrienchangequote([,])dnl
1878837SobrienAM_INIT_AUTOMAKE(gas, ${BFD_VERSION})
1938891Sjdp
2038891SjdpAM_PROG_LIBTOOL
2138891Sjdp
2233965Sjdpuser_bfd_gas=
2333965SjdpAC_ARG_ENABLE(bfd-assembler,
2433965Sjdp[  --enable-bfd-assembler  use BFD back end for writing object files],
2533965Sjdp[case "${enableval}" in
2633965Sjdp  yes) need_bfd=yes user_bfd_gas=yes ;;
2733965Sjdp  no)  user_bfd_gas=no ;;
2833965Sjdp  *)   AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;;
2933965Sjdpesac])dnl
3033965SjdpAC_ARG_ENABLE(targets,
3133965Sjdp[    targets            alternative target configurations besides the primary],
3233965Sjdp[case "${enableval}" in
3333965Sjdp  yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
3433965Sjdp	    ;;
3533965Sjdp  no)	    enable_targets= ;;
3633965Sjdp  *)	    enable_targets=$enableval ;;
3733965Sjdpesac])dnl
3833965SjdpAC_ARG_ENABLE(commonbfdlib,
3933965Sjdp[  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
4033965Sjdp[case "${enableval}" in
4133965Sjdp  yes) commonbfdlib=true ;;
4233965Sjdp  no)  commonbfdlib=false ;;
4333965Sjdp  *)   AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
4433965Sjdpesac])dnl
4533965Sjdp
4660517Sobrienusing_cgen=no
4760517Sobrien
4877310Sobrienbuild_warnings="-W -Wall"
4977310SobrienAC_ARG_ENABLE(build-warnings,
5077310Sobrien[  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
5177310Sobrien[case "${enableval}" in
5277310Sobrien  yes)	;;
5377310Sobrien  no)	build_warnings="-w";;
5477310Sobrien  ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
5577310Sobrien        build_warnings="${build_warnings} ${t}";;
5677310Sobrien  *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
5777310Sobrien        build_warnings="${t} ${build_warnings}";;
5877310Sobrien  *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
5977310Sobrienesac
6077310Sobrienif test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
6177310Sobrien  echo "Setting warning flags = $build_warnings" 6>&1
6277310Sobrienfi])dnl
6377310SobrienWARN_CFLAGS=""
6477310Sobrienif test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
6577310Sobrien    WARN_CFLAGS="${build_warnings}"
6677310Sobrienfi
6777310SobrienAC_SUBST(WARN_CFLAGS)
6877310Sobrien
6938891Sjdp# Generate a header file
7038891SjdpAM_CONFIG_HEADER(config.h:config.in)
7133965Sjdp
7260517Sobrien# If we are on a DOS filesystem, we must use gdb.ini rather than
7360517Sobrien# .gdbinit.
7460517SobrienGDBINIT=".gdbinit"
7560517Sobriencase "${host}" in
7660517Sobrien  *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
7760517Sobrien    GDBINIT="gdb.ini"
7860517Sobrien    ;;
7960517Sobrienesac
8060517SobrienAC_SUBST(GDBINIT)
8160517Sobrien
8233965Sjdpte_file=generic
8333965Sjdp
8460517Sobrien# Makefile target for installing gas in $(tooldir)/bin.
8560517Sobrieninstall_tooldir=install-exec-tooldir
8660517Sobrien
8733965Sjdpcanon_targets=""
8860517Sobrienall_targets=no
8933965Sjdpif test -n "$enable_targets" ; then
9033965Sjdp  for t in `echo $enable_targets | sed 's/,/ /g'`; do
9160517Sobrien    if test $t = "all"; then
9260517Sobrien      all_targets=yes
9360517Sobrien      continue
9460517Sobrien    fi
9560517Sobrien    result=`$ac_config_sub $t 2>/dev/null`
9633965Sjdp    if test -n "$result" ; then
9733965Sjdp      canon_targets="$canon_targets $result"
9833965Sjdp#    else
9933965Sjdp#      # Permit "all", etc.  We don't support it yet though.
10033965Sjdp#      canon_targets="$canon_targets $t"
10133965Sjdp    fi
10233965Sjdp  done
10333965Sjdp  GAS_UNIQ(canon_targets)
10433965Sjdpfi
10533965Sjdp
10633965Sjdpemulations=""
10733965Sjdp
10833965Sjdpfor this_target in $target $canon_targets ; do
10933965Sjdp
11033965Sjdpchangequote(,)dnl
11133965Sjdp    eval `echo $this_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'`
11233965Sjdpchangequote([,])dnl
11333965Sjdp
11433965Sjdp    # check for architecture variants
11538891Sjdp    arch=
11638891Sjdp    endian=
11733965Sjdp    case ${cpu} in
11838891Sjdp      alpha*)		cpu_type=alpha ;;
11933965Sjdp      armeb)		cpu_type=arm endian=big ;;
12033965Sjdp      arm*)		cpu_type=arm endian=little ;;
12160517Sobrien      armb*)		cpu_type=arm endian=little ;;
12260517Sobrien      armv*l)		cpu_type=arm endian=little ;;
12360517Sobrien      armv*b)		cpu_type=arm endian=big ;;
12477310Sobrien      xscale*)		cpu_type=arm endian=little ;;
12560517Sobrien      strongarm*)	cpu_type=arm endian=little ;;
12638891Sjdp      thumb*)		cpu_type=arm endian=little ;;
12733965Sjdp      hppa*)		cpu_type=hppa ;;
12833965Sjdpchangequote(,)dnl
12977310Sobrien      i[3456]86)	cpu_type=i386 arch=i386;;
13077310Sobrien      x86_64)		cpu_type=i386 arch=x86_64;;
13177310Sobrien      ia64)		cpu_type=ia64 ;;
13277310Sobrien      m6811|m6812|m68hc12) cpu_type=m68hc11 ;;
13333965Sjdp      m680[012346]0)	cpu_type=m68k ;;
13460517Sobrienchangequote([,])dnl
13533965Sjdp      m68008)		cpu_type=m68k ;;
13633965Sjdp      m683??)		cpu_type=m68k ;;
13760517Sobrien      m5200)		cpu_type=m68k ;;
13833965Sjdp      m8*)		cpu_type=m88k ;;
13933965Sjdp      mips*el)		cpu_type=mips endian=little ;;
14033965Sjdp      mips*)		cpu_type=mips endian=big ;;
14160517Sobrien      pjl*)		cpu_type=pj endian=little ;;
14260517Sobrien      pj*)		cpu_type=pj endian=big ;;
14333965Sjdp      powerpcle*)	cpu_type=ppc endian=little ;;
14433965Sjdp      powerpc*)		cpu_type=ppc endian=big ;;
14533965Sjdp      rs6000*)		cpu_type=ppc ;;
14638891Sjdp      sparclite*)	cpu_type=sparc arch=sparclite ;;
14738891Sjdp      sparclet*)	cpu_type=sparc arch=sparclet ;;
14838891Sjdp      sparc64*)		cpu_type=sparc arch=v9-64 ;;
14960517Sobrien      sparc86x*)	cpu_type=sparc arch=sparc86x  ;;
15038891Sjdp      sparc*)		cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
15138891Sjdp      v850*)		cpu_type=v850 ;;
15233965Sjdp      *)		cpu_type=${cpu} ;;
15333965Sjdp    esac
15433965Sjdp
15533965Sjdp    if test ${this_target} = $target ; then
15633965Sjdp      target_cpu_type=${cpu_type}
15733965Sjdp    elif test ${target_cpu_type} != ${cpu_type} ; then
15833965Sjdp      continue
15933965Sjdp    fi
16033965Sjdp
16133965Sjdp    generic_target=${cpu_type}-$vendor-$os
16233965Sjdp    dev=no
16333965Sjdp    bfd_gas=no
16433965Sjdp    em=generic
16533965Sjdp
16633965Sjdp    # assign object format
16733965Sjdp    case ${generic_target} in
16838891Sjdp      a29k-*-coff)          fmt=coff ;;
16938891Sjdp      a29k-amd-udi)         fmt=coff ;;
17038891Sjdp      a29k-amd-ebmon)       fmt=coff ;;
17138891Sjdp      a29k-nyu-sym1)        fmt=coff ;;
17277310Sobrien      a29k-*-rtems*)        fmt=coff ;;
17333965Sjdp      a29k-*-vxworks*)      fmt=coff ;;
17433965Sjdp
17538891Sjdp      alpha*-*-*vms*)	    fmt=evax ;;
17638891Sjdp      alpha*-*-netware*)    fmt=ecoff ;;
17738891Sjdp      alpha*-*-openbsd*)    fmt=ecoff ;;
17838891Sjdp      alpha*-*-osf*)        fmt=ecoff ;;
17938891Sjdp      alpha*-*-linuxecoff*) fmt=ecoff ;;
18038891Sjdp      alpha*-*-linux-gnu*)  fmt=elf em=linux ;;
18138891Sjdp      alpha*-*-netbsd*)     fmt=elf em=nbsd ;;
18233965Sjdp
18338891Sjdp      arc-*-elf*)           fmt=elf bfd_gas=yes ;;
18433965Sjdp
18560517Sobrien      arm-*-aout)	                fmt=aout ;;
18660517Sobrien      arm-*-coff | thumb-*-coff)        fmt=coff ;;
18777310Sobrien      arm-*-rtems | thumb-*-rtems)      fmt=elf ;;
18860517Sobrien      arm-*-elf | thumb-*-elf)          fmt=elf ;;
18960517Sobrien      arm*-*-conix*)			fmt=elf ;;
19060517Sobrien      arm-*-linux*aout*)	        fmt=aout em=linux ;;
19177310Sobrien      arm*-*-linux-gnu* | arm*-*-uclinux*)	
19277310Sobrien					fmt=elf  em=linux ;;
19377310Sobrien      arm-*-netbsd*)	                fmt=aout em=nbsd ;;
19460517Sobrien      arm-*-oabi | thumb-*-oabi)        fmt=elf ;;
19560517Sobrien      arm-epoc-pe | thumb-epoc-pe)      fmt=coff em=epoc-pe ;;
19677310Sobrien      arm-*-wince)			fmt=coff em=wince-pe ;;
19760517Sobrien      arm-*-pe | thumb-*-pe)            fmt=coff em=pe ;;
19860517Sobrien      arm-*-riscix*)	                fmt=aout em=riscix ;;
19978837Sobrien      arm-*-vxworks)	                fmt=coff ;;
20033965Sjdp
20160517Sobrien      avr-*-*)		    fmt=elf bfd_gas=yes ;;
20260517Sobrien
20377310Sobrien      cris-*-*)		    fmt=multi bfd_gas=yes ;;
20477310Sobrien
20533965Sjdp      d10v-*-*)		    fmt=elf bfd_gas=yes ;;
20660517Sobrien      d30v-*-*)		    fmt=elf bfd_gas=yes ;;
20733965Sjdp
20860517Sobrien
20960517Sobrien      fr30-*-*)		    fmt=elf bfd_gas=yes ;;
21060517Sobrien
21177310Sobrien      hppa-*-linux-gnu*)    case ${cpu} in
21277310Sobrien				hppa*64*)
21377310Sobrien					fmt=elf em=hppalinux64;;
21477310Sobrien				hppa*)
21577310Sobrien					fmt=elf em=linux;;
21677310Sobrien			    esac ;;
21733965Sjdp      hppa-*-*elf*)         fmt=elf em=hppa ;;
21833965Sjdp      hppa-*-lites*)        fmt=elf em=hppa ;;
21933965Sjdp      hppa-*-osf*)          fmt=som em=hppa ;;
22033965Sjdp      hppa-*-rtems*)        fmt=elf em=hppa ;;
22177310Sobrien      hppa-*-hpux11*)	    case ${cpu} in
22277310Sobrien				hppa*64*)
22377310Sobrien					fmt=elf em=hppa64 ;;
22477310Sobrien				hppa*)
22577310Sobrien					fmt=som em=hppa ;;
22677310Sobrien			    esac ;;
22733965Sjdp      hppa-*-hpux*)         fmt=som em=hppa ;;
22860517Sobrien      hppa-*-mpeix*)        fmt=som em=hppa ;;
22933965Sjdp      hppa-*-bsd*)          fmt=som em=hppa ;;
23033965Sjdp      hppa-*-hiux*)         fmt=som em=hppa ;;
23133965Sjdp
23277310Sobrien      h8300-*-rtems*)       fmt=coff ;;
23333965Sjdp      h8300-*-coff)         fmt=coff ;;
23478837Sobrien      h8500-*-rtems*)       fmt=coff ;;
23578837Sobrien      h8500-*-coff)         fmt=coff ;;
23633965Sjdp
23760517Sobrien      i370-*-elf* | i370-*-linux*) fmt=elf ;;
23838891Sjdp      i386-ibm-aix*)        fmt=coff em=i386aix ;;
23933965Sjdp      i386-sequent-bsd*)    fmt=aout em=dynix bfd_gas=yes ;;
24060517Sobrien      i386-*-beospe*)       fmt=coff em=pe bfd_gas=yes ;;
24160517Sobrien      i386-*-beoself* | i386-*-beos*) fmt=elf bfd_gas=yes ;;
24233965Sjdp      i386-*-bsd*)          fmt=aout em=386bsd ;;
24333965Sjdp      i386-*-netbsd0.8)     fmt=aout em=386bsd ;;
24433965Sjdp      i386-*-netbsd*)       fmt=aout em=nbsd bfd_gas=yes;;
24533965Sjdp      i386-*-openbsd*)      fmt=aout em=nbsd bfd_gas=yes;;
24678837Sobrien      i386-*-linux*aout* | i386-*-linux*oldld)   fmt=aout em=linux ;;
24738891Sjdp      i386-*-linux*coff*)   fmt=coff em=linux ;;
24860517Sobrien      i386-*-linux-gnu*)    fmt=elf em=linux bfd_gas=yes ;;
24977310Sobrien      x86_64-*-linux-gnu*)  fmt=elf em=linux bfd_gas=yes ;;
25038891Sjdp      i386-*-lynxos*)       fmt=coff em=lynx ;;
25177310Sobrienchangequote(,)dnl
25277310Sobrien      i386-*-sysv[45]* | i386-*-solaris* | i386-*-elf)
25360517Sobrien			    fmt=elf bfd_gas=yes ;;
25460517Sobrien      i386-*-freebsdaout* | i386-*-freebsd[12].* | i386-*-freebsd[12])
25560517Sobrien                            fmt=aout em=386bsd ;;
25661850Sobrienchangequote([,])dnl
25738891Sjdp      i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*)
25838891Sjdp                          fmt=coff ;;
25938891Sjdp      i386-*-sco3.2v5*)      fmt=elf
26038891Sjdp			    if test ${this_target} = $target; then
26160517Sobrien				AC_DEFINE(SCO_ELF, 1,
26260517Sobrien				    [Define if defaulting to ELF on SCO 5.])
26338891Sjdp			    fi
26438891Sjdp			    ;;
26538891Sjdp      i386-*-sco3.2*)       fmt=coff ;;
26633965Sjdp      i386-*-vsta)          fmt=aout ;;
26738891Sjdp      i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*)
26877310Sobrien			    fmt=coff em=go32 bfd_gas=yes
26977310Sobrien			    AC_DEFINE(STRICTCOFF, 1, [Using strict COFF?])
27077310Sobrien			    ;;
27160517Sobrien      i386-*-rtemself*)     fmt=elf ;;
27277310Sobrien      i386-*-rtems*)        fmt=coff ;;
27333965Sjdp      i386-*-gnu*)          fmt=elf ;;
27433965Sjdp      i386-*-mach*)
27533965Sjdp			    fmt=aout em=mach bfd_gas=yes ;;
27633965Sjdp      i386-*-msdos*)        fmt=aout ;;
27733965Sjdp      i386-*-moss*)	    fmt=elf ;;
27877310Sobrien      i386-*-pe)            fmt=coff em=pe bfd_gas=yes ;;
27960517Sobrien      i386-*-cygwin*)       fmt=coff em=pe bfd_gas=yes ;;
28060517Sobrien      i386-*-interix*)	    fmt=coff em=interix bfd_gas=yes ;;
28138891Sjdp      i386-*-mingw32*)      fmt=coff em=pe bfd_gas=yes ;;
28277310Sobrien      i386-*-*nt*)          fmt=coff em=pe bfd_gas=yes ;;
28360517Sobrien      i386-*-vxworks*)      fmt=aout ;;
28477310Sobrien      i386-*-chaos)         fmt=elf ;;
28577310Sobrien      i860-stardent-sysv4* | i860-stardent-elf*)
28677310Sobrien			    fmt=elf bfd_gas=yes endian=little
28777310Sobrien			    AC_MSG_WARN(GAS support for ${generic_target} is preliminary and a work in progress) ;;
28833965Sjdp      i960-*-bout)          fmt=bout ;;
28938891Sjdp      i960-*-coff)          fmt=coff em=ic960 ;;
29038891Sjdp      i960-*-rtems*)        fmt=coff em=ic960 ;;
29133965Sjdp      i960-*-nindy*)        fmt=bout ;;
29233965Sjdp      i960-*-vxworks4*)     fmt=bout ;;
29333965Sjdp      i960-*-vxworks5.0)    fmt=bout ;;
29438891Sjdp      i960-*-vxworks5.*)    fmt=coff em=ic960 ;;
29533965Sjdp      i960-*-vxworks*)      fmt=bout ;;
29660517Sobrien      i960-*-elf*)	    fmt=elf ;;
29733965Sjdp
29877310Sobrien      ia64-*-elf*)	    fmt=elf ;;
29977310Sobrien      ia64-*-linux-gnu*)    fmt=elf em=linux ;;
30077310Sobrien      ia64-*-hpux*)	    fmt=elf em=hpux ;;
30177310Sobrien
30233965Sjdp      m32r-*-*)		    fmt=elf bfd_gas=yes ;;
30333965Sjdp
30477310Sobrien      m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)fmt=elf bfd_gas=yes ;;
30577310Sobrien
30633965Sjdp      m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
30733965Sjdp			    fmt=aout em=sun3 ;;
30838891Sjdp      m68k-motorola-sysv*)  fmt=coff em=delta ;;
30938891Sjdp      m68k-bull-sysv3*)     fmt=coff em=dpx2 ;;
31038891Sjdp      m68k-apollo-*)        fmt=coff em=apollo ;;
31133965Sjdp      m68k-*-sysv4*) # must be before -sysv*
31233965Sjdp			    fmt=elf em=svr4 ;;
31333965Sjdp      m68k-*-elf*)	    fmt=elf ;;
31477310Sobrien      m68k-*-coff | m68k-*-sysv* | m68k-*-rtems*)
31538891Sjdp			    fmt=coff ;;
31633965Sjdp      m68k-*-hpux*)         fmt=hp300 em=hp300 ;;
31733965Sjdp      m68k-*-linux*aout*)   fmt=aout em=linux ;;
31838891Sjdp      m68k-*-linux-gnu*)    fmt=elf em=linux ;;
31960517Sobrien      m68k-*-gnu*)	    fmt=elf ;;
32038891Sjdp      m68k-*-lynxos*)       fmt=coff em=lynx ;;
32133965Sjdp      m68k-*-netbsd*)       fmt=aout em=nbsd bfd_gas=yes ;;
32233965Sjdp      m68k-*-openbsd*)      fmt=aout em=nbsd bfd_gas=yes ;;
32338891Sjdp      m68k-apple-aux*)      fmt=coff em=aux ;;
32433965Sjdp      m68k-*-psos*)         fmt=elf em=psos;;
32533965Sjdp
32638891Sjdp      m88k-motorola-sysv3*) fmt=coff em=delt88 ;;
32738891Sjdp      m88k-*-coff*)         fmt=coff ;;
32833965Sjdp
32960517Sobrien      mcore-*-elf)	    fmt=elf bfd_gas=yes ;;
33060517Sobrien      mcore-*-pe)	    fmt=coff em=pe bfd_gas=yes ;;
33160517Sobrien
33233965Sjdp      # don't change em like *-*-bsd does
33338891Sjdp      mips-dec-netbsd*)	    fmt=elf endian=little ;;
33438891Sjdp      mips-dec-openbsd*)    fmt=elf endian=little ;;
33560517Sobrien      mips-dec-bsd*)        fmt=aout endian=little ;;
33638891Sjdp      mips-sony-bsd*)       fmt=ecoff ;;
33733965Sjdp      mips-*-bsd*)          AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
33838891Sjdp      mips-*-ultrix*)       fmt=ecoff endian=little ;;
33938891Sjdp      mips-*-osf*)          fmt=ecoff endian=little ;;
34038891Sjdp      mips-*-ecoff*)        fmt=ecoff ;;
34160517Sobrien      mips-*-pe*)           fmt=coff endian=little em=pe ;;
34238891Sjdp      mips-*-irix6*)	    fmt=elf ;;
34338891Sjdp      mips-*-irix5*)        fmt=elf ;;
34438891Sjdp      mips-*-irix*)         fmt=ecoff ;;
34538891Sjdp      mips-*-lnews*)        fmt=ecoff em=lnews ;;
34638891Sjdp      mips-*-riscos*)       fmt=ecoff ;;
34778837Sobrien      mips-*-linux-gnu*)
34878837Sobrien			    fmt=elf em=tmips
34978837Sobrien			    AC_DEFINE(MIPS_STABS_ELF, 1,
35078837Sobrien				[Use ELF stabs for MIPS, not ECOFF stabs])
35178837Sobrien			    ;;
35278837Sobrien      mips-*-sysv4*MP* | mips-*-gnu*)
35378837Sobrien			    fmt=elf em=tmips ;;
35438891Sjdp      mips-*-sysv*)         fmt=ecoff ;;
35578837Sobrien      mips-*-elf* | mips-*-rtems* | mips-*-openbsd*)
35638891Sjdp			    fmt=elf ;;
35760517Sobrien      mips-*-vxworks*)      fmt=elf
35860517Sobrien			    AC_DEFINE(MIPS_STABS_ELF, 1,
35960517Sobrien				[Use ELF stabs for MIPS, not ECOFF stabs])
36060517Sobrien			    ;;
36133965Sjdp      mn10200-*-*)	    fmt=elf bfd_gas=yes ;;
36233965Sjdp      mn10300-*-*)	    fmt=elf bfd_gas=yes ;;
36360517Sobrien      pj*)		    fmt=elf ;;
36460517Sobrien      ppc-*-pe | ppc-*-cygwin* | ppc-*-winnt*)
36538891Sjdp		            fmt=coff em=pe ;;
36633965Sjdp      ppc-*-aix*)           fmt=coff ;;
36733965Sjdp      ppc-*-beos*)          fmt=coff ;;
36833965Sjdp      ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
36938891Sjdp			    fmt=elf ;;
37038891Sjdp      ppc-*-linux-gnu*)	    fmt=elf
37133965Sjdp			    case "$endian" in
37238891Sjdp			    big)  ;;
37338891Sjdp			    *)    AC_MSG_ERROR(GNU/Linux must be configured big endian) ;;
37433965Sjdp			    esac
37533965Sjdp			    ;;
37633965Sjdp      ppc-*-solaris*)	    fmt=elf
37738891Sjdp			    if test ${this_target} = $target; then
37860517Sobrien				AC_DEFINE(TARGET_SOLARIS_COMMENT, 1,
37960517Sobrien				[Define if default target is PowerPC Solaris.])
38038891Sjdp			    fi
38138891Sjdp			    if test x${endian} = xbig; then
38238891Sjdp				AC_MSG_ERROR(Solaris must be configured little endian)
38338891Sjdp			    fi
38433965Sjdp			    ;;
38538891Sjdp      ppc-*-rtems*)	    fmt=elf ;;
38633965Sjdp      ppc-*-macos* | ppc-*-mpw*)
38733965Sjdp			    fmt=coff em=macos ;;
38833965Sjdp      ppc-*-netware*)       fmt=elf em=ppcnw ;;
38960517Sobrien      ppc-*-vxworks*)       fmt=elf ;;
39033965Sjdp
39177310Sobrien      sh-*-linux*)	    fmt=elf em=linux ;;
39233965Sjdp      sh-*-elf*)	    fmt=elf ;;
39333965Sjdp      sh-*-coff*)           fmt=coff ;;
39460517Sobrien      sh-*-pe*)             fmt=coff em=pe bfd_gas=yes;;
39560517Sobrien      sh-*-rtemself*)       fmt=elf ;;
39677310Sobrien      sh-*-rtems*)	    fmt=coff ;;
39733965Sjdp
39833965Sjdp      ns32k-pc532-mach* | ns32k-pc532-ux*)    fmt=aout em=pc532mach ;;
39933965Sjdp      ns32k-pc532-netbsd* | ns32k-pc532-lites*)  fmt=aout em=nbsd532 ;;
40033965Sjdp      ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;
40133965Sjdp
40261850Sobrien      sparc-*-rtemsaout*)   fmt=aout ;;
40361850Sobrien      sparc-*-rtemself*)    fmt=elf ;;
40461850Sobrien      sparc-*-rtems*)       fmt=elf ;;
40533965Sjdp      sparc-*-sunos4*)      fmt=aout em=sun3 ;;
40633965Sjdp      sparc-*-aout | sparc*-*-vxworks*)
40733965Sjdp			    fmt=aout em=sparcaout ;;
40833965Sjdp      sparc-*-coff)         fmt=coff ;;
40933965Sjdp      sparc-*-linux*aout*)  fmt=aout em=linux ;;
41038891Sjdp      sparc-*-linux-gnu*)   fmt=elf em=linux ;;
41133965Sjdp      sparc-*-lynxos*)      fmt=coff em=lynx ;;
41233965Sjdp      sparc-fujitsu-none)   fmt=aout ;;
41333965Sjdp      sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*)
41433965Sjdp			    fmt=elf ;;
41568775Sobrien      sparc-*-netbsd*)      em=nbsd bfd_gas=yes
41668775Sobrien                            case ${cpu} in
41768775Sobrien                                sparc) case ${os} in
41868775Sobrien                                           *elf*) fmt=elf ;;
41968775Sobrien                                           *)     fmt=aout ;;
42068775Sobrien                                       esac ;;
42168775Sobrien                                sparc64) fmt=elf ;;
42268775Sobrien                            esac
42368775Sobrien                            ;;
42460517Sobrien      sparc-*-openbsd*)     fmt=aout em=nbsd ;;
42533965Sjdp
42660517Sobrien      strongarm-*-coff)     fmt=coff ;;
42760517Sobrien      strongarm-*-elf)      fmt=elf ;;
42877310Sobrien      xscale-*-coff)     fmt=coff ;;
42977310Sobrien      xscale-*-elf)      fmt=elf ;;
43060517Sobrien
43138891Sjdp      tic30-*-*aout*)	    fmt=aout bfd_gas=yes ;;
43238891Sjdp      tic30-*-*coff*)       fmt=coff bfd_gas=yes ;;
43377310Sobrien      tic54x-*-* | c54x*-*-*)
43477310Sobrien			    fmt=coff bfd_gas=yes need_libm=yes;;
43560517Sobrien      tic80-*-*)	    fmt=coff ;;
43638891Sjdp
43738891Sjdp      v850-*-*)		    fmt=elf bfd_gas=yes ;;
43860517Sobrien      v850e-*-*)	    fmt=elf bfd_gas=yes ;;
43960517Sobrien      v850ea-*-*)	    fmt=elf bfd_gas=yes ;;
44038891Sjdp
44133965Sjdp      vax-*-bsd* | vax-*-ultrix*)
44233965Sjdp			    fmt=aout ;;
44333965Sjdp      vax-*-vms)            fmt=vms ;;
44433965Sjdp
44560517Sobrien
44633965Sjdp      z8k-*-coff | z8k-*-sim)
44733965Sjdp			    fmt=coff ;;
44833965Sjdp
44933965Sjdp      w65-*-*)              fmt=coff ;;
45033965Sjdp
45133965Sjdp      *-*-aout | *-*-scout)
45233965Sjdp			    fmt=aout ;;
45378837Sobrien      *-*-freebsd*)	    fmt=elf em=freebsd bfd_gas=yes ;;
45433965Sjdp      *-*-nindy*)
45533965Sjdp			    fmt=bout ;;
45633965Sjdp      *-*-bsd*)
45733965Sjdp			    fmt=aout em=sun3 ;;
45833965Sjdp      *-*-generic)          fmt=generic ;;
45933965Sjdp      *-*-xray | *-*-hms)   fmt=coff ;;
46033965Sjdp      *-*-sim)              fmt=coff ;;
46133965Sjdp      *-*-elf | *-*-sysv4* | *-*-solaris*)
46233965Sjdp			    AC_MSG_WARN(GAS support for ${generic_target} is incomplete.)
46333965Sjdp			    fmt=elf dev=yes ;;
46433965Sjdp      *-*-vxworks)          fmt=aout ;;
46533965Sjdp      *-*-netware)          fmt=elf ;;
46633965Sjdp    esac
46733965Sjdp
46860517Sobrien    if test ${this_target} = $target ; then
46960517Sobrien      endian_def=
47060517Sobrien      if test x${endian} = xbig; then
47160517Sobrien	endian_def=1
47260517Sobrien      elif test x${endian} = xlittle; then
47360517Sobrien	endian_def=0
47460517Sobrien      fi
47560517Sobrien      if test x${endian_def} != x; then
47660517Sobrien	AC_DEFINE_UNQUOTED(TARGET_BYTES_BIG_ENDIAN, $endian_def,
47760517Sobrien			   [Define as 1 if big endian.])
47860517Sobrien      fi
47960517Sobrien    fi
48060517Sobrien
48133965Sjdp    case ${cpu_type}-${fmt} in
48238891Sjdp      alpha*-*)	bfd_gas=yes ;;
48333965Sjdp      arm-*)	bfd_gas=yes ;;
48433965Sjdp    # not yet
48533965Sjdp    # i386-aout)	bfd_gas=preferred ;;
48677310Sobrien      ia64*-*)	bfd_gas=yes ;;
48733965Sjdp      mips-*)	bfd_gas=yes ;;
48833965Sjdp      ns32k-*)	bfd_gas=yes ;;
48933965Sjdp      ppc-*)	bfd_gas=yes ;;
49033965Sjdp      sparc-*)	bfd_gas=yes ;;
49160517Sobrien      strongarm-*)	bfd_gas=yes ;;
49277310Sobrien      xscale-*)	bfd_gas=yes ;;
49333965Sjdp      *-elf)	bfd_gas=yes ;;
49433965Sjdp      *-ecoff)	bfd_gas=yes ;;
49533965Sjdp      *-som)	bfd_gas=yes ;;
49660517Sobrien    #enable bfd for coff and aout to allow testing if a bfd target is
49760517Sobrien    #the primary target, but not for coff or aout as the primary target
49860517Sobrien      i386-coff)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
49960517Sobrien      i386-aout)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
50033965Sjdp      *)		;;
50133965Sjdp    esac
50233965Sjdp
50333965Sjdp# Other random stuff.
50433965Sjdp
50560517Sobrien    # Do we need the opcodes library?
50633965Sjdp    case ${cpu_type} in
50738891Sjdp      vax | i386 | tic30)
50833965Sjdp	;;
50960517Sobrien
51033965Sjdp      *)
51133965Sjdp	need_opcodes=yes
51238891Sjdp
51338891Sjdp	case "${enable_shared}" in
51438891Sjdp	yes) shared_opcodes=true ;;
51538891Sjdp	*opcodes*) shared_opcodes=true ;;
51638891Sjdp	*) shared_opcodes=false ;;
51738891Sjdp	esac
51833965Sjdp	if test "${shared_opcodes}" = "true"; then
51933965Sjdp	  # A shared libopcodes must be linked against libbfd.
52033965Sjdp	  need_bfd=yes
52133965Sjdp	fi
52233965Sjdp	;;
52333965Sjdp    esac
52433965Sjdp
52560517Sobrien    # Any other special object files needed ?
52633965Sjdp    case ${cpu_type} in
52760517Sobrien      fr30 | m32r)
52860517Sobrien	using_cgen=yes
52933965Sjdp	;;
53033965Sjdp
53133965Sjdp      m68k)
53233965Sjdp	case ${extra_objects} in
53333965Sjdp	*m68k-parse.o*) ;;
53433965Sjdp	*) extra_objects="$extra_objects m68k-parse.o" ;;
53533965Sjdp	esac
53633965Sjdp	;;
53733965Sjdp
53833965Sjdp      mips)
53933965Sjdp	echo ${extra_objects} | grep -s "itbl-parse.o" 
54033965Sjdp	if test $? -ne 0 ; then
54133965Sjdp	  extra_objects="$extra_objects itbl-parse.o"
54233965Sjdp	fi
54333965Sjdp
54433965Sjdp	echo ${extra_objects} | grep -s "itbl-lex.o" 
54533965Sjdp	if test $? -ne 0 ; then
54633965Sjdp	  extra_objects="$extra_objects itbl-lex.o"
54733965Sjdp	fi
54833965Sjdp
54933965Sjdp	echo ${extra_objects} | grep -s "itbl-ops.o" 
55033965Sjdp	if test $? -ne 0 ; then
55133965Sjdp	  extra_objects="$extra_objects itbl-ops.o"
55233965Sjdp	fi
55333965Sjdp	;;
55433965Sjdp
55577310Sobrien      i386)
55677310Sobrien	if test $this_target = $target ; then
55777310Sobrien	  AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
55877310Sobrien	fi
55977310Sobrien	;;
56038891Sjdp      sparc)
56138891Sjdp	if test $this_target = $target ; then
56260517Sobrien	  AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
56338891Sjdp	fi
56438891Sjdp	;;
56533965Sjdp      *)
56633965Sjdp	;;
56733965Sjdp    esac
56833965Sjdp
56960517Sobrien    if test $using_cgen = yes ; then
57060517Sobrien	case "x${extra_objects}" in
57160517Sobrien	*cgen.o*) ;;
57260517Sobrien	*) extra_objects="$extra_objects cgen.o" ;;
57360517Sobrien	esac
57460517Sobrien    fi
57560517Sobrien
57633965Sjdp# See if we really can support this configuration with the emulation code.
57733965Sjdp
57833965Sjdp    if test $this_target = $target ; then
57933965Sjdp      primary_bfd_gas=$bfd_gas
58033965Sjdp      obj_format=$fmt
58133965Sjdp      te_file=$em
58233965Sjdp
58333965Sjdp      if test $bfd_gas = no ; then
58433965Sjdp	# Can't support other configurations this way.
58533965Sjdp	break
58633965Sjdp      fi
58733965Sjdp    elif test $bfd_gas = no ; then
58833965Sjdp      # Can't support this configuration.
58933965Sjdp      break
59033965Sjdp    fi
59133965Sjdp
59233965Sjdp# From target name and format, produce a list of supported emulations.
59333965Sjdp
59433965Sjdp    case ${generic_target}-${fmt} in
59533965Sjdp      mips-*-irix5*-*)	emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
59638891Sjdp      mips-*-linux-gnu*-*) case "$endian" in
59733965Sjdp			big)	emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
59833965Sjdp			*)	emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;;
59933965Sjdp			esac ;;
60033965Sjdp      mips-*-lnews*-ecoff) ;;
60133965Sjdp      mips-*-*-ecoff)	case "$endian" in
60233965Sjdp			big)	emulation="mipsbecoff mipslecoff mipsecoff" ;;
60333965Sjdp			*)	emulation="mipslecoff mipsbecoff mipsecoff" ;;
60433965Sjdp			esac ;;
60533965Sjdp      mips-*-*-elf)	case "$endian" in
60633965Sjdp			big)	emulation="mipsbelf mipslelf mipself" ;;
60733965Sjdp			*)	emulation="mipslelf mipsbelf mipself" ;;
60833965Sjdp			esac ;;
60977310Sobrien      mips-*-sysv4*MP*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
61077310Sobrien      # i386-pc-pe-coff != i386-pc-coff.
61177310Sobrien      i386-*-pe-coff)	;;
61260517Sobrien      # Uncommenting the next line will turn on support for i386 AOUT
61360517Sobrien      # for the default linux configuration
61460517Sobrien      # i386-*-linux*-elf) emulation="i386elf i386aout" ;;
61560517Sobrien      #
61660517Sobrien      i386-*-aout)	emulation="i386aout" ;;
61760517Sobrien      i386-*-coff)	emulation="i386coff" ;;
61860517Sobrien      i386-*-elf)	emulation="i386elf" ;;
61977310Sobrien
62077310Sobrien      # Always all formats.  The first stated emulation becomes the default.
62177310Sobrien      cris-*-*aout*)	emulation="crisaout criself" ;;
62277310Sobrien      cris-*-*)		emulation="criself crisaout" ;;
62333965Sjdp    esac
62433965Sjdp
62533965Sjdp    emulations="$emulations $emulation"
62633965Sjdp
62733965Sjdpdone
62833965Sjdp
62960517Sobrien# Turn on all targets if possible
63060517Sobrienif test ${all_targets} = "yes"; then
63160517Sobrien  case ${target_cpu_type} in
63260517Sobrien  i386)
63360517Sobrien    case ${obj_format} in
63460517Sobrien    aout)
63560517Sobrien      emulations="$emulations i386coff i386elf"
63660517Sobrien      ;;
63760517Sobrien    coff)
63860517Sobrien      emulations="$emulations i386aout i386elf"
63960517Sobrien    ;;
64060517Sobrien    elf)
64160517Sobrien      emulations="$emulations i386aout i386coff"
64260517Sobrien      ;;
64360517Sobrien    esac
64460517Sobrien  ;;
64560517Sobrien  esac
64660517Sobrienfi
64760517Sobrien
64833965Sjdp# Assign floating point type.  Most processors with FP support
64933965Sjdp# IEEE FP.  On those that don't support FP at all, usually IEEE
65033965Sjdp# is emulated.
65133965Sjdpcase ${target_cpu} in
65233965Sjdp  vax | tahoe )	atof=${target_cpu} ;;
65333965Sjdp  *)		atof=ieee ;;
65433965Sjdpesac
65533965Sjdp
65633965Sjdpcase "${obj_format}" in
65733965Sjdp  "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
65833965Sjdpesac
65933965Sjdp
66060517Sobrien# Unfortunately the cpu in cpu-opc.h file isn't always $(TARGET_CPU).
66160517Sobriencgen_cpu_prefix=""
66260517Sobrienif test $using_cgen = yes ; then
66360517Sobrien  case ${target_cpu} in
66460517Sobrien    *) cgen_cpu_prefix=${target_cpu} ;;
66560517Sobrien  esac
66660517Sobrien  AC_SUBST(cgen_cpu_prefix)
66760517Sobrien  AC_DEFINE(USING_CGEN, 1, [Using cgen code?])
66860517Sobrienfi
66960517Sobrien
67033965Sjdpdnl
67133965Sjdpdnl Make sure the desired support files exist.
67233965Sjdpdnl
67333965Sjdp
67433965Sjdpif test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
67533965Sjdp  AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
67633965Sjdpfi
67733965Sjdp
67833965Sjdpif test ! -r ${srcdir}/config/obj-${obj_format}.c; then
67933965Sjdp  AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
68033965Sjdpfi
68133965Sjdp
68233965Sjdpcase ${user_bfd_gas}-${primary_bfd_gas} in
68333965Sjdp  yes-yes | no-no)
68433965Sjdp    # We didn't override user's choice.
68533965Sjdp    ;;
68633965Sjdp  no-yes)
68733965Sjdp    AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
68833965Sjdp    ;;
68933965Sjdp  no-preferred)
69033965Sjdp    primary_bfd_gas=no
69133965Sjdp    ;;
69233965Sjdp  *-preferred)
69333965Sjdp    primary_bfd_gas=yes
69433965Sjdp    ;;
69533965Sjdp  yes-*)
69633965Sjdp    primary_bfd_gas=yes
69733965Sjdp    ;;
69833965Sjdp  -*)
69933965Sjdp    # User specified nothing.
70033965Sjdp    ;;
70133965Sjdpesac
70233965Sjdp
70333965Sjdp# Some COFF configurations want these random other flags set.
70433965Sjdpcase ${obj_format} in
70533965Sjdp  coff)
70633965Sjdp    case ${target_cpu_type} in
70760517Sobrien      i386) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;;
70860517Sobrien      m68k) AC_DEFINE(M68KCOFF, 1, [Using m68k COFF?]) ;;
70960517Sobrien      m88k) AC_DEFINE(M88KCOFF, 1, [Using m88k COFF?]) ;;
71033965Sjdp    esac
71133965Sjdp    ;;
71233965Sjdpesac
71333965Sjdp
71433965Sjdp# Getting this done right is going to be a bitch.  Each configuration specified
71533965Sjdp# with --enable-targets=... should be checked for environment, format, cpu, and
71633965Sjdp# bfd_gas setting.
71733965Sjdp#
71833965Sjdp# For each configuration, the necessary object file support code must be linked
71933965Sjdp# in.  This might be only one, it might be up to four.  The necessary emulation
72033965Sjdp# code needs to be provided, too.
72133965Sjdp#
72233965Sjdp# And then there's "--enable-targets=all"....
72333965Sjdp#
72433965Sjdp# For now, just always do it for MIPS ELF or ECOFF configurations.  Sigh.
72533965Sjdp
72633965Sjdpformats="${obj_format}"
72733965Sjdpemfiles=""
72833965SjdpEMULATIONS=""
72933965SjdpGAS_UNIQ(emulations)
73033965Sjdpfor em in . $emulations ; do
73133965Sjdp  case $em in
73233965Sjdp    .)	continue ;;
73378837Sobrien    mipsbelf | mipslelf | mipself)
73433965Sjdp	fmt=elf   file=mipself ;;
73578837Sobrien    mipsbecoff | mipslecoff | mipsecoff)
73633965Sjdp	fmt=ecoff file=mipsecoff ;;
73777310Sobrien    *coff)
73877310Sobrien	fmt=coff  file=$em ;;
73977310Sobrien    *aout)
74077310Sobrien	fmt=aout file=$em ;;
74177310Sobrien    *elf)
74277310Sobrien	fmt=elf file=$em ;;
74333965Sjdp  esac
74433965Sjdp  formats="$formats $fmt"
74533965Sjdp  emfiles="$emfiles e-$file.o"
74633965Sjdp  EMULATIONS="$EMULATIONS &$em,"
74733965Sjdpdone
74833965SjdpGAS_UNIQ(formats)
74933965SjdpGAS_UNIQ(emfiles)
75033965Sjdpif test `set . $formats ; shift ; echo $#` -gt 1 ; then
75133965Sjdp  for fmt in $formats ; do
75233965Sjdp    case $fmt in
75360517Sobrien      aout)	AC_DEFINE(OBJ_MAYBE_AOUT, 1,    [a.out support?])   ;;
75460517Sobrien      bout)	AC_DEFINE(OBJ_MAYBE_BOUT, 1,    [b.out support?])   ;;
75560517Sobrien      coff)	AC_DEFINE(OBJ_MAYBE_COFF, 1,    [COFF support?])    ;;
75660517Sobrien      ecoff)	AC_DEFINE(OBJ_MAYBE_ECOFF, 1,   [ECOFF support?])   ;;
75760517Sobrien      elf)	AC_DEFINE(OBJ_MAYBE_ELF, 1,     [ELF support?])     ;;
75860517Sobrien      generic)	AC_DEFINE(OBJ_MAYBE_GENERIC, 1, [generic support?]) ;;
75960517Sobrien      hp300)	AC_DEFINE(OBJ_MAYBE_HP300, 1,   [HP300 support?])   ;;
76060517Sobrien      ieee)	AC_DEFINE(OBJ_MAYBE_IEEE, 1,    [IEEE support?])    ;;
76160517Sobrien      som)	AC_DEFINE(OBJ_MAYBE_SOM, 1,     [SOM support?])     ;;
76260517Sobrien      vms)	AC_DEFINE(OBJ_MAYBE_VMS, 1,     [VMS support?])     ;;
76333965Sjdp    esac
76433965Sjdp    extra_objects="$extra_objects obj-$fmt.o"
76533965Sjdp  done
76633965Sjdp  obj_format=multi
76733965Sjdpfi
76833965Sjdpif test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
76933965Sjdp  DEFAULT_EMULATION=`set . $emulations ; echo $2`
77060517Sobrien  # e-mips* has more than one emulation per file, e-i386* has just one at the
77160517Sobrien  # moment.  If only one emulation is specified, then don't define
77260517Sobrien  # USE_EMULATIONS or include any of the e-files as they will only be bloat.
77360517Sobrien  case "${obj_format}${emfiles}" in
77460517Sobrien    multi* | *mips*)
77560517Sobrien      extra_objects="$extra_objects $emfiles"
77660517Sobrien      AC_DEFINE(USE_EMULATIONS, 1, [Use emulation support?]) ;;
77760517Sobrien  esac
77833965Sjdpfi
77933965SjdpAC_SUBST(extra_objects)
78060517SobrienAC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS, [Supported emulations.])
78160517SobrienAC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION",
78260517Sobrien		   [Default emulation.])
78333965Sjdp
78433965Sjdpcase ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
78533965Sjdp  yes-*-coff)	need_bfd=yes ;;
78633965Sjdp  no-*-coff)	need_bfd=yes
78760517Sobrien		AC_DEFINE(MANY_SEGMENTS, 1, [old COFF support?]) ;;
78833965Sjdpesac
78933965Sjdp
79033965Sjdpreject_dev_configs=yes
79133965Sjdp
79233965Sjdpcase ${reject_dev_configs}-${dev} in
79333965Sjdp  yes-yes) # Oops.
79433965Sjdp    AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
79533965Sjdp    ;;
79633965Sjdpesac
79733965Sjdp
79833965SjdpAC_SUBST(target_cpu_type)
79933965SjdpAC_SUBST(obj_format)
80033965SjdpAC_SUBST(te_file)
80160517SobrienAC_SUBST(install_tooldir)
80233965SjdpAC_SUBST(atof)
80333965Sjdpdnl AC_SUBST(emulation)
80433965Sjdp
80533965Sjdpcase "${primary_bfd_gas}" in
80660517Sobrien  yes)	AC_DEFINE(BFD_ASSEMBLER, 1, [Use BFD interface?])
80733965Sjdp	need_bfd=yes ;;
80833965Sjdpesac
80933965Sjdp
81033965Sjdp# do we need the opcodes library?
81133965Sjdpcase "${need_opcodes}" in
81233965Sjdpyes)
81338891Sjdp  OPCODES_LIB=../opcodes/libopcodes.la
81433965Sjdp  ;;
81533965Sjdpesac
81633965Sjdp
81733965Sjdpcase "${need_bfd}" in
81833965Sjdpyes)
81938891Sjdp  BFDLIB=../bfd/libbfd.la
82033965Sjdp  ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
82133965Sjdp  ;;
82233965Sjdpesac
82333965Sjdp
82433965SjdpAC_SUBST(BFDLIB)
82533965SjdpAC_SUBST(OPCODES_LIB)
82633965Sjdp
82733965SjdpAC_SUBST(ALL_OBJ_DEPS)
82833965Sjdp
82960517SobrienAC_DEFINE_UNQUOTED(TARGET_ALIAS,	"${target_alias}", [Target alias.])
83060517SobrienAC_DEFINE_UNQUOTED(TARGET_CANONICAL,	"${target}",       [Canonical target.])
83160517SobrienAC_DEFINE_UNQUOTED(TARGET_CPU,		"${target_cpu}",   [Target CPU.])
83260517SobrienAC_DEFINE_UNQUOTED(TARGET_VENDOR,	"${target_vendor}", [Target vendor.])
83360517SobrienAC_DEFINE_UNQUOTED(TARGET_OS,		"${target_os}",    [Target OS.])
83433965Sjdp
83533965SjdpAC_PROG_CC
83633965Sjdp
83738891SjdpAC_PROG_YACC
83860517SobrienAM_PROG_LEX
83938891Sjdp
84060517SobrienALL_LINGUAS=
84160517SobrienCY_GNU_GETTEXT
84260517Sobrien
84338891SjdpAM_MAINTAINER_MODE
84460517SobrienAC_EXEEXT
84538891Sjdp
84633965SjdpAC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
84733965Sjdp
84833965Sjdp# Put this here so that autoconf's "cross-compiling" message doesn't confuse
84933965Sjdp# people who are not cross-compiling but are compiling cross-assemblers.
85033965SjdpAC_MSG_CHECKING(whether compiling a cross-assembler)
85133965Sjdpif test "${host}" = "${target}"; then
85233965Sjdp  cross_gas=no
85333965Sjdpelse
85433965Sjdp  cross_gas=yes
85560517Sobrien  AC_DEFINE(CROSS_COMPILE, 1, [Compiling cross-assembler?])
85633965Sjdpfi
85733965SjdpAC_MSG_RESULT($cross_gas)
85833965Sjdp
85933965Sjdpdnl ansidecl.h will deal with const
86033965Sjdpdnl AC_CONST
86133965SjdpAC_FUNC_ALLOCA
86233965SjdpAC_C_INLINE
86333965Sjdp
86433965Sjdp# VMS doesn't have unlink.
86533965SjdpAC_CHECK_FUNCS(unlink remove, break)
86633965Sjdp
86733965Sjdp# Some systems don't have sbrk().
86833965SjdpAC_CHECK_FUNCS(sbrk)
86933965Sjdp
87077310Sobrien# do we need the math library?
87177310Sobriencase "${need_libm}" in
87277310Sobrienyes) 
87377310Sobrien  AC_CHECK_LIBM
87477310Sobrien  AC_SUBST(LIBM)
87577310Sobrien  ;;
87677310Sobrienesac
87777310Sobrien
87833965Sjdp# Some non-ANSI preprocessors botch requoting inside strings.  That's bad
87933965Sjdp# enough, but on some of those systems, the assert macro relies on requoting
88033965Sjdp# working properly!
88133965SjdpGAS_WORKING_ASSERT
88233965Sjdp
88333965Sjdp# On some systems, the system header files may not declare malloc, realloc,
88433965Sjdp# and free.  There are places where gas needs these functions to have been
88533965Sjdp# declared -- such as when taking their addresses.
88633965Sjdpgas_test_headers="
88733965Sjdp#ifdef HAVE_MEMORY_H
88833965Sjdp#include <memory.h>
88933965Sjdp#endif
89033965Sjdp#ifdef HAVE_STRING_H
89133965Sjdp#include <string.h>
89233965Sjdp#else
89333965Sjdp#ifdef HAVE_STRINGS_H
89433965Sjdp#include <strings.h>
89533965Sjdp#endif
89633965Sjdp#endif
89733965Sjdp#ifdef HAVE_STDLIB_H
89833965Sjdp#include <stdlib.h>
89933965Sjdp#endif
90033965Sjdp#ifdef HAVE_UNISTD_H
90133965Sjdp#include <unistd.h>
90233965Sjdp#endif
90333965Sjdp"
90433965SjdpGAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
90533965SjdpGAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
90633965SjdpGAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
90733965SjdpGAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
90860517SobrienGAS_CHECK_DECL_NEEDED(environ, f, char **f, $gas_test_headers)
90933965Sjdp
91033965Sjdp# Does errno.h declare errno, or do we have to add a separate declaration
91133965Sjdp# for it?
91233965SjdpGAS_CHECK_DECL_NEEDED(errno, f, int f, [
91333965Sjdp#ifdef HAVE_ERRNO_H
91433965Sjdp#include <errno.h>
91533965Sjdp#endif
91633965Sjdp])
91733965Sjdp
91833965Sjdpdnl This must come last.
91933965Sjdp
92033965Sjdpdnl We used to make symlinks to files in the source directory, but now
92133965Sjdpdnl we just use the right name for .c files, and create .h files in
92233965Sjdpdnl the build directory which include the right .h file.  Make sure
92333965Sjdpdnl the old symlinks don't exist, so that a reconfigure in an existing
92433965Sjdpdnl directory behaves reasonably.
92533965Sjdp
92660517SobrienAC_OUTPUT(Makefile doc/Makefile ${GDBINIT}:gdbinit.in po/Makefile.in:po/Make-in,
92733965Sjdp[rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
92833965Sjdp echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
92933965Sjdp echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
93033965Sjdp echo '#include "te-'"${te_file}"'.h"' > targ-env.h
93133965Sjdp echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
93260517Sobrien if test "x$cgen_cpu_prefix" != x ; then
93360517Sobrien   echo '#include "opcodes/'"${cgen_cpu_prefix}"'-desc.h"' > cgen-desc.h
93460517Sobrien fi
93560517Sobrien
93660517Sobrien sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile],
93733965Sjdp[target_cpu_type=${target_cpu_type}
93860517Sobrien cgen_cpu_prefix=${cgen_cpu_prefix}
93933965Sjdp obj_format=${obj_format}
94033965Sjdp te_file=${te_file}])
941