configure.in revision 89866
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 89866 2002-01-27 12:15:52Z 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
4889866Sobrienbuild_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
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 ;;
14389866Sobrien      powerpc*le*)	cpu_type=ppc endian=little ;;
14433965Sjdp      powerpc*)		cpu_type=ppc endian=big ;;
14533965Sjdp      rs6000*)		cpu_type=ppc ;;
14689866Sobrien      s390x*)		cpu_type=s390 arch=s390x ;;
14789866Sobrien      s390*)		cpu_type=s390 arch=s390 ;;
14889866Sobrien      sh*le)		cpu_type=sh endian=little ;;
14989866Sobrien      sh*)		cpu_type=sh endian=big ;;
15038891Sjdp      sparclite*)	cpu_type=sparc arch=sparclite ;;
15138891Sjdp      sparclet*)	cpu_type=sparc arch=sparclet ;;
15238891Sjdp      sparc64*)		cpu_type=sparc arch=v9-64 ;;
15360517Sobrien      sparc86x*)	cpu_type=sparc arch=sparc86x  ;;
15438891Sjdp      sparc*)		cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
15538891Sjdp      v850*)		cpu_type=v850 ;;
15633965Sjdp      *)		cpu_type=${cpu} ;;
15733965Sjdp    esac
15833965Sjdp
15933965Sjdp    if test ${this_target} = $target ; then
16033965Sjdp      target_cpu_type=${cpu_type}
16133965Sjdp    elif test ${target_cpu_type} != ${cpu_type} ; then
16233965Sjdp      continue
16333965Sjdp    fi
16433965Sjdp
16533965Sjdp    generic_target=${cpu_type}-$vendor-$os
16633965Sjdp    dev=no
16733965Sjdp    bfd_gas=no
16833965Sjdp    em=generic
16989866Sobrien    mips_stabs_elf=
17033965Sjdp
17133965Sjdp    # assign object format
17233965Sjdp    case ${generic_target} in
17338891Sjdp      a29k-*-coff)          fmt=coff ;;
17438891Sjdp      a29k-amd-udi)         fmt=coff ;;
17538891Sjdp      a29k-amd-ebmon)       fmt=coff ;;
17638891Sjdp      a29k-nyu-sym1)        fmt=coff ;;
17777310Sobrien      a29k-*-rtems*)        fmt=coff ;;
17833965Sjdp      a29k-*-vxworks*)      fmt=coff ;;
17933965Sjdp
18038891Sjdp      alpha*-*-*vms*)	    fmt=evax ;;
18138891Sjdp      alpha*-*-netware*)    fmt=ecoff ;;
18238891Sjdp      alpha*-*-openbsd*)    fmt=ecoff ;;
18338891Sjdp      alpha*-*-osf*)        fmt=ecoff ;;
18438891Sjdp      alpha*-*-linuxecoff*) fmt=ecoff ;;
18538891Sjdp      alpha*-*-linux-gnu*)  fmt=elf em=linux ;;
18638891Sjdp      alpha*-*-netbsd*)     fmt=elf em=nbsd ;;
18733965Sjdp
18838891Sjdp      arc-*-elf*)           fmt=elf bfd_gas=yes ;;
18933965Sjdp
19060517Sobrien      arm-*-aout)	                fmt=aout ;;
19160517Sobrien      arm-*-coff | thumb-*-coff)        fmt=coff ;;
19277310Sobrien      arm-*-rtems | thumb-*-rtems)      fmt=elf ;;
19360517Sobrien      arm-*-elf | thumb-*-elf)          fmt=elf ;;
19460517Sobrien      arm*-*-conix*)			fmt=elf ;;
19560517Sobrien      arm-*-linux*aout*)	        fmt=aout em=linux ;;
19677310Sobrien      arm*-*-linux-gnu* | arm*-*-uclinux*)	
19777310Sobrien					fmt=elf  em=linux ;;
19889866Sobrien      arm-*-netbsdelf*)                 fmt=elf  em=nbsd ;;
19989866Sobrien      arm-*-netbsd* | arm-*-openbsd*)   fmt=aout em=nbsd ;;
20060517Sobrien      arm-*-oabi | thumb-*-oabi)        fmt=elf ;;
20160517Sobrien      arm-epoc-pe | thumb-epoc-pe)      fmt=coff em=epoc-pe ;;
20277310Sobrien      arm-*-wince)			fmt=coff em=wince-pe ;;
20360517Sobrien      arm-*-pe | thumb-*-pe)            fmt=coff em=pe ;;
20460517Sobrien      arm-*-riscix*)	                fmt=aout em=riscix ;;
20578837Sobrien      arm-*-vxworks)	                fmt=coff ;;
20633965Sjdp
20760517Sobrien      avr-*-*)		    fmt=elf bfd_gas=yes ;;
20860517Sobrien
20977310Sobrien      cris-*-*)		    fmt=multi bfd_gas=yes ;;
21077310Sobrien
21133965Sjdp      d10v-*-*)		    fmt=elf bfd_gas=yes ;;
21260517Sobrien      d30v-*-*)		    fmt=elf bfd_gas=yes ;;
21333965Sjdp
21460517Sobrien
21560517Sobrien      fr30-*-*)		    fmt=elf bfd_gas=yes ;;
21660517Sobrien
21777310Sobrien      hppa-*-linux-gnu*)    case ${cpu} in
21877310Sobrien				hppa*64*)
21977310Sobrien					fmt=elf em=hppalinux64;;
22077310Sobrien				hppa*)
22177310Sobrien					fmt=elf em=linux;;
22277310Sobrien			    esac ;;
22333965Sjdp      hppa-*-*elf*)         fmt=elf em=hppa ;;
22433965Sjdp      hppa-*-lites*)        fmt=elf em=hppa ;;
22533965Sjdp      hppa-*-osf*)          fmt=som em=hppa ;;
22633965Sjdp      hppa-*-rtems*)        fmt=elf em=hppa ;;
22777310Sobrien      hppa-*-hpux11*)	    case ${cpu} in
22877310Sobrien				hppa*64*)
22977310Sobrien					fmt=elf em=hppa64 ;;
23077310Sobrien				hppa*)
23177310Sobrien					fmt=som em=hppa ;;
23277310Sobrien			    esac ;;
23333965Sjdp      hppa-*-hpux*)         fmt=som em=hppa ;;
23460517Sobrien      hppa-*-mpeix*)        fmt=som em=hppa ;;
23533965Sjdp      hppa-*-bsd*)          fmt=som em=hppa ;;
23633965Sjdp      hppa-*-hiux*)         fmt=som em=hppa ;;
23733965Sjdp
23877310Sobrien      h8300-*-rtems*)       fmt=coff ;;
23933965Sjdp      h8300-*-coff)         fmt=coff ;;
24089866Sobrien      h8300-*-elf)          fmt=elf ;;
24178837Sobrien      h8500-*-rtems*)       fmt=coff ;;
24278837Sobrien      h8500-*-coff)         fmt=coff ;;
24333965Sjdp
24460517Sobrien      i370-*-elf* | i370-*-linux*) fmt=elf ;;
24538891Sjdp      i386-ibm-aix*)        fmt=coff em=i386aix ;;
24633965Sjdp      i386-sequent-bsd*)    fmt=aout em=dynix bfd_gas=yes ;;
24760517Sobrien      i386-*-beospe*)       fmt=coff em=pe bfd_gas=yes ;;
24860517Sobrien      i386-*-beoself* | i386-*-beos*) fmt=elf bfd_gas=yes ;;
24933965Sjdp      i386-*-bsd*)          fmt=aout em=386bsd ;;
25033965Sjdp      i386-*-netbsd0.8)     fmt=aout em=386bsd ;;
25189866Sobrien      i386-*-netbsd*)       em=nbsd bfd_gas=yes
25289866Sobrien			    case ${cpu} in
25389866Sobrien			      x86_64)	fmt=elf ;;
25489866Sobrien			      *)	case ${os} in
25589866Sobrien					  *elf*) fmt=elf ;;
25689866Sobrien					  *)     fmt=aout ;;
25789866Sobrien					esac
25889866Sobrien					;;
25989866Sobrien			    esac
26089866Sobrien			    ;;
26133965Sjdp      i386-*-openbsd*)      fmt=aout em=nbsd bfd_gas=yes;;
26278837Sobrien      i386-*-linux*aout* | i386-*-linux*oldld)   fmt=aout em=linux ;;
26338891Sjdp      i386-*-linux*coff*)   fmt=coff em=linux ;;
26460517Sobrien      i386-*-linux-gnu*)    fmt=elf em=linux bfd_gas=yes ;;
26577310Sobrien      x86_64-*-linux-gnu*)  fmt=elf em=linux bfd_gas=yes ;;
26638891Sjdp      i386-*-lynxos*)       fmt=coff em=lynx ;;
26777310Sobrienchangequote(,)dnl
26877310Sobrien      i386-*-sysv[45]* | i386-*-solaris* | i386-*-elf)
26960517Sobrien			    fmt=elf bfd_gas=yes ;;
27060517Sobrien      i386-*-freebsdaout* | i386-*-freebsd[12].* | i386-*-freebsd[12])
27160517Sobrien                            fmt=aout em=386bsd ;;
27261850Sobrienchangequote([,])dnl
27338891Sjdp      i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*)
27438891Sjdp                          fmt=coff ;;
27538891Sjdp      i386-*-sco3.2v5*)      fmt=elf
27638891Sjdp			    if test ${this_target} = $target; then
27760517Sobrien				AC_DEFINE(SCO_ELF, 1,
27860517Sobrien				    [Define if defaulting to ELF on SCO 5.])
27938891Sjdp			    fi
28038891Sjdp			    ;;
28138891Sjdp      i386-*-sco3.2*)       fmt=coff ;;
28233965Sjdp      i386-*-vsta)          fmt=aout ;;
28338891Sjdp      i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*)
28477310Sobrien			    fmt=coff em=go32 bfd_gas=yes
28577310Sobrien			    AC_DEFINE(STRICTCOFF, 1, [Using strict COFF?])
28677310Sobrien			    ;;
28760517Sobrien      i386-*-rtemself*)     fmt=elf ;;
28885822Sobrien      i386-*-rtemscoff*)    fmt=coff ;;
28985822Sobrien      i386-*-rtems*)        fmt=elf ;;
29033965Sjdp      i386-*-gnu*)          fmt=elf ;;
29133965Sjdp      i386-*-mach*)
29233965Sjdp			    fmt=aout em=mach bfd_gas=yes ;;
29333965Sjdp      i386-*-msdos*)        fmt=aout ;;
29433965Sjdp      i386-*-moss*)	    fmt=elf ;;
29577310Sobrien      i386-*-pe)            fmt=coff em=pe bfd_gas=yes ;;
29660517Sobrien      i386-*-cygwin*)       fmt=coff em=pe bfd_gas=yes ;;
29760517Sobrien      i386-*-interix*)	    fmt=coff em=interix bfd_gas=yes ;;
29838891Sjdp      i386-*-mingw32*)      fmt=coff em=pe bfd_gas=yes ;;
29977310Sobrien      i386-*-*nt*)          fmt=coff em=pe bfd_gas=yes ;;
30060517Sobrien      i386-*-vxworks*)      fmt=aout ;;
30177310Sobrien      i386-*-chaos)         fmt=elf ;;
30277310Sobrien      i860-stardent-sysv4* | i860-stardent-elf*)
30377310Sobrien			    fmt=elf bfd_gas=yes endian=little
30477310Sobrien			    AC_MSG_WARN(GAS support for ${generic_target} is preliminary and a work in progress) ;;
30533965Sjdp      i960-*-bout)          fmt=bout ;;
30638891Sjdp      i960-*-coff)          fmt=coff em=ic960 ;;
30738891Sjdp      i960-*-rtems*)        fmt=coff em=ic960 ;;
30833965Sjdp      i960-*-nindy*)        fmt=bout ;;
30933965Sjdp      i960-*-vxworks4*)     fmt=bout ;;
31033965Sjdp      i960-*-vxworks5.0)    fmt=bout ;;
31138891Sjdp      i960-*-vxworks5.*)    fmt=coff em=ic960 ;;
31233965Sjdp      i960-*-vxworks*)      fmt=bout ;;
31360517Sobrien      i960-*-elf*)	    fmt=elf ;;
31433965Sjdp
31577310Sobrien      ia64-*-elf*)	    fmt=elf ;;
31689866Sobrien      ia64-*-aix*)	    fmt=elf em=ia64aix ;;
31777310Sobrien      ia64-*-linux-gnu*)    fmt=elf em=linux ;;
31877310Sobrien      ia64-*-hpux*)	    fmt=elf em=hpux ;;
31989866Sobrien      ia64-*-netbsd*)       fmt=elf em=nbsd ;;
32077310Sobrien
32133965Sjdp      m32r-*-*)		    fmt=elf bfd_gas=yes ;;
32233965Sjdp
32377310Sobrien      m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)fmt=elf bfd_gas=yes ;;
32477310Sobrien
32533965Sjdp      m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
32633965Sjdp			    fmt=aout em=sun3 ;;
32738891Sjdp      m68k-motorola-sysv*)  fmt=coff em=delta ;;
32838891Sjdp      m68k-bull-sysv3*)     fmt=coff em=dpx2 ;;
32938891Sjdp      m68k-apollo-*)        fmt=coff em=apollo ;;
33033965Sjdp      m68k-*-sysv4*) # must be before -sysv*
33133965Sjdp			    fmt=elf em=svr4 ;;
33233965Sjdp      m68k-*-elf*)	    fmt=elf ;;
33385822Sobrien      m68k-*-coff | m68k-*-sysv* | m68k-*-rtemscoff*)
33438891Sjdp			    fmt=coff ;;
33585822Sobrien      m68k-*-rtems*)	    fmt=elf ;;
33633965Sjdp      m68k-*-hpux*)         fmt=hp300 em=hp300 ;;
33733965Sjdp      m68k-*-linux*aout*)   fmt=aout em=linux ;;
33838891Sjdp      m68k-*-linux-gnu*)    fmt=elf em=linux ;;
33960517Sobrien      m68k-*-gnu*)	    fmt=elf ;;
34038891Sjdp      m68k-*-lynxos*)       fmt=coff em=lynx ;;
34189866Sobrien      m68k-*-netbsdelf*)    fmt=elf em=nbsd bfd_gas=yes ;;
34289866Sobrien      m68k-*-netbsdaout* | m68k-*-netbsd*)
34389866Sobrien			    fmt=aout em=nbsd bfd_gas=yes ;;
34433965Sjdp      m68k-*-openbsd*)      fmt=aout em=nbsd bfd_gas=yes ;;
34538891Sjdp      m68k-apple-aux*)      fmt=coff em=aux ;;
34633965Sjdp      m68k-*-psos*)         fmt=elf em=psos;;
34733965Sjdp
34838891Sjdp      m88k-motorola-sysv3*) fmt=coff em=delt88 ;;
34938891Sjdp      m88k-*-coff*)         fmt=coff ;;
35033965Sjdp
35160517Sobrien      mcore-*-elf)	    fmt=elf bfd_gas=yes ;;
35260517Sobrien      mcore-*-pe)	    fmt=coff em=pe bfd_gas=yes ;;
35360517Sobrien
35433965Sjdp      # don't change em like *-*-bsd does
35538891Sjdp      mips-dec-openbsd*)    fmt=elf endian=little ;;
35660517Sobrien      mips-dec-bsd*)        fmt=aout endian=little ;;
35738891Sjdp      mips-sony-bsd*)       fmt=ecoff ;;
35833965Sjdp      mips-*-bsd*)          AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
35938891Sjdp      mips-*-ultrix*)       fmt=ecoff endian=little ;;
36038891Sjdp      mips-*-osf*)          fmt=ecoff endian=little ;;
36138891Sjdp      mips-*-ecoff*)        fmt=ecoff ;;
36260517Sobrien      mips-*-pe*)           fmt=coff endian=little em=pe ;;
36338891Sjdp      mips-*-irix6*)	    fmt=elf ;;
36438891Sjdp      mips-*-irix5*)        fmt=elf ;;
36538891Sjdp      mips-*-irix*)         fmt=ecoff ;;
36638891Sjdp      mips-*-lnews*)        fmt=ecoff em=lnews ;;
36738891Sjdp      mips-*-riscos*)       fmt=ecoff ;;
36889866Sobrien      mips*-*-linux*)	    fmt=elf em=tmips mips_stabs_elf=y ;;
36978837Sobrien      mips-*-sysv4*MP* | mips-*-gnu*)
37078837Sobrien			    fmt=elf em=tmips ;;
37138891Sjdp      mips-*-sysv*)         fmt=ecoff ;;
37289866Sobrien      mips-*-elf* | mips-*-rtems* | mips-*-netbsd* | mips-*-openbsd*)
37338891Sjdp			    fmt=elf ;;
37489866Sobrien      mips-*-vxworks*)      fmt=elf mips_stabs_elf=y ;;
37589866Sobrien      mmix-*-*)		    fmt=elf bfd_gas=yes ;;
37633965Sjdp      mn10200-*-*)	    fmt=elf bfd_gas=yes ;;
37733965Sjdp      mn10300-*-*)	    fmt=elf bfd_gas=yes ;;
37889866Sobrien      openrisc-*-*)	    fmt=elf bfd_gas=yes ;;
37960517Sobrien      pj*)		    fmt=elf ;;
38060517Sobrien      ppc-*-pe | ppc-*-cygwin* | ppc-*-winnt*)
38138891Sjdp		            fmt=coff em=pe ;;
38233965Sjdp      ppc-*-aix*)           fmt=coff ;;
38333965Sjdp      ppc-*-beos*)          fmt=coff ;;
38433965Sjdp      ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
38538891Sjdp			    fmt=elf ;;
38638891Sjdp      ppc-*-linux-gnu*)	    fmt=elf
38733965Sjdp			    case "$endian" in
38838891Sjdp			    big)  ;;
38938891Sjdp			    *)    AC_MSG_ERROR(GNU/Linux must be configured big endian) ;;
39033965Sjdp			    esac
39133965Sjdp			    ;;
39233965Sjdp      ppc-*-solaris*)	    fmt=elf
39338891Sjdp			    if test ${this_target} = $target; then
39460517Sobrien				AC_DEFINE(TARGET_SOLARIS_COMMENT, 1,
39560517Sobrien				[Define if default target is PowerPC Solaris.])
39638891Sjdp			    fi
39738891Sjdp			    if test x${endian} = xbig; then
39838891Sjdp				AC_MSG_ERROR(Solaris must be configured little endian)
39938891Sjdp			    fi
40033965Sjdp			    ;;
40138891Sjdp      ppc-*-rtems*)	    fmt=elf ;;
40233965Sjdp      ppc-*-macos* | ppc-*-mpw*)
40333965Sjdp			    fmt=coff em=macos ;;
40433965Sjdp      ppc-*-netware*)       fmt=elf em=ppcnw ;;
40560517Sobrien      ppc-*-vxworks*)       fmt=elf ;;
40633965Sjdp
40789866Sobrien      s390x-*-linux-gnu*)   fmt=elf em=linux ;;
40889866Sobrien      s390-*-linux-gnu*)    fmt=elf em=linux ;;
40989866Sobrien
41089866Sobrien      sh*-*-linux*)	    fmt=elf em=linux
41189866Sobrien			    case ${cpu} in
41289866Sobrien				sh*eb)
41389866Sobrien					endian=big ;;
41489866Sobrien				sh*)
41589866Sobrien					endian=little ;;
41689866Sobrien			    esac ;;
41789866Sobrien      sh*-*-netbsdelf*)     fmt=elf em=nbsd ;;
41833965Sjdp      sh-*-elf*)	    fmt=elf ;;
41985822Sobrien      sh-*-coff*)           fmt=coff bfd_gas=yes;;
42089866Sobrien      sh-*-pe*)             fmt=coff em=pe bfd_gas=yes endian=little ;;
42160517Sobrien      sh-*-rtemself*)       fmt=elf ;;
42285822Sobrien      sh-*-rtems*)	    fmt=coff bfd_gas=yes;;
42333965Sjdp
42433965Sjdp      ns32k-pc532-mach* | ns32k-pc532-ux*)    fmt=aout em=pc532mach ;;
42533965Sjdp      ns32k-pc532-netbsd* | ns32k-pc532-lites*)  fmt=aout em=nbsd532 ;;
42633965Sjdp      ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;
42733965Sjdp
42861850Sobrien      sparc-*-rtemsaout*)   fmt=aout ;;
42961850Sobrien      sparc-*-rtemself*)    fmt=elf ;;
43061850Sobrien      sparc-*-rtems*)       fmt=elf ;;
43133965Sjdp      sparc-*-sunos4*)      fmt=aout em=sun3 ;;
43233965Sjdp      sparc-*-aout | sparc*-*-vxworks*)
43333965Sjdp			    fmt=aout em=sparcaout ;;
43433965Sjdp      sparc-*-coff)         fmt=coff ;;
43533965Sjdp      sparc-*-linux*aout*)  fmt=aout em=linux ;;
43638891Sjdp      sparc-*-linux-gnu*)   fmt=elf em=linux ;;
43733965Sjdp      sparc-*-lynxos*)      fmt=coff em=lynx ;;
43833965Sjdp      sparc-fujitsu-none)   fmt=aout ;;
43933965Sjdp      sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*)
44033965Sjdp			    fmt=elf ;;
44168775Sobrien      sparc-*-netbsd*)      em=nbsd bfd_gas=yes
44268775Sobrien                            case ${cpu} in
44368775Sobrien                                sparc) case ${os} in
44468775Sobrien                                           *elf*) fmt=elf ;;
44568775Sobrien                                           *)     fmt=aout ;;
44668775Sobrien                                       esac ;;
44768775Sobrien                                sparc64) fmt=elf ;;
44868775Sobrien                            esac
44968775Sobrien                            ;;
45060517Sobrien      sparc-*-openbsd*)     fmt=aout em=nbsd ;;
45133965Sjdp
45260517Sobrien      strongarm-*-coff)     fmt=coff ;;
45360517Sobrien      strongarm-*-elf)      fmt=elf ;;
45477310Sobrien      xscale-*-coff)     fmt=coff ;;
45577310Sobrien      xscale-*-elf)      fmt=elf ;;
45660517Sobrien
45738891Sjdp      tic30-*-*aout*)	    fmt=aout bfd_gas=yes ;;
45838891Sjdp      tic30-*-*coff*)       fmt=coff bfd_gas=yes ;;
45977310Sobrien      tic54x-*-* | c54x*-*-*)
46077310Sobrien			    fmt=coff bfd_gas=yes need_libm=yes;;
46160517Sobrien      tic80-*-*)	    fmt=coff ;;
46238891Sjdp
46338891Sjdp      v850-*-*)		    fmt=elf bfd_gas=yes ;;
46460517Sobrien      v850e-*-*)	    fmt=elf bfd_gas=yes ;;
46560517Sobrien      v850ea-*-*)	    fmt=elf bfd_gas=yes ;;
46638891Sjdp
46733965Sjdp      vax-*-bsd* | vax-*-ultrix*)
46833965Sjdp			    fmt=aout ;;
46933965Sjdp      vax-*-vms)            fmt=vms ;;
47033965Sjdp
47189866Sobrien      w65-*-*)              fmt=coff ;;
47260517Sobrien
47389866Sobrien      xstormy16-*-*)	    fmt=elf bfd_gas=yes ;;
47489866Sobrien
47533965Sjdp      z8k-*-coff | z8k-*-sim)
47633965Sjdp			    fmt=coff ;;
47733965Sjdp
47833965Sjdp      *-*-aout | *-*-scout)
47933965Sjdp			    fmt=aout ;;
48078837Sobrien      *-*-freebsd*)	    fmt=elf em=freebsd bfd_gas=yes ;;
48133965Sjdp      *-*-nindy*)
48233965Sjdp			    fmt=bout ;;
48333965Sjdp      *-*-bsd*)
48433965Sjdp			    fmt=aout em=sun3 ;;
48533965Sjdp      *-*-generic)          fmt=generic ;;
48633965Sjdp      *-*-xray | *-*-hms)   fmt=coff ;;
48733965Sjdp      *-*-sim)              fmt=coff ;;
48833965Sjdp      *-*-elf | *-*-sysv4* | *-*-solaris*)
48933965Sjdp			    AC_MSG_WARN(GAS support for ${generic_target} is incomplete.)
49033965Sjdp			    fmt=elf dev=yes ;;
49133965Sjdp      *-*-vxworks)          fmt=aout ;;
49233965Sjdp      *-*-netware)          fmt=elf ;;
49333965Sjdp    esac
49433965Sjdp
49560517Sobrien    if test ${this_target} = $target ; then
49660517Sobrien      endian_def=
49760517Sobrien      if test x${endian} = xbig; then
49860517Sobrien	endian_def=1
49960517Sobrien      elif test x${endian} = xlittle; then
50060517Sobrien	endian_def=0
50160517Sobrien      fi
50260517Sobrien      if test x${endian_def} != x; then
50360517Sobrien	AC_DEFINE_UNQUOTED(TARGET_BYTES_BIG_ENDIAN, $endian_def,
50460517Sobrien			   [Define as 1 if big endian.])
50560517Sobrien      fi
50660517Sobrien    fi
50760517Sobrien
50889866Sobrien    if test x${mips_stabs_elf} != x; then
50989866Sobrien      AC_DEFINE(MIPS_STABS_ELF, 1,
51089866Sobrien		[Use ELF stabs for MIPS, not ECOFF stabs])
51189866Sobrien    fi
51289866Sobrien
51333965Sjdp    case ${cpu_type}-${fmt} in
51438891Sjdp      alpha*-*)	bfd_gas=yes ;;
51533965Sjdp      arm-*)	bfd_gas=yes ;;
51633965Sjdp    # not yet
51733965Sjdp    # i386-aout)	bfd_gas=preferred ;;
51877310Sobrien      ia64*-*)	bfd_gas=yes ;;
51933965Sjdp      mips-*)	bfd_gas=yes ;;
52033965Sjdp      ns32k-*)	bfd_gas=yes ;;
52189866Sobrien      pdp11-*)	bfd_gas=yes ;;
52233965Sjdp      ppc-*)	bfd_gas=yes ;;
52333965Sjdp      sparc-*)	bfd_gas=yes ;;
52460517Sobrien      strongarm-*)	bfd_gas=yes ;;
52577310Sobrien      xscale-*)	bfd_gas=yes ;;
52633965Sjdp      *-elf)	bfd_gas=yes ;;
52733965Sjdp      *-ecoff)	bfd_gas=yes ;;
52833965Sjdp      *-som)	bfd_gas=yes ;;
52960517Sobrien    #enable bfd for coff and aout to allow testing if a bfd target is
53060517Sobrien    #the primary target, but not for coff or aout as the primary target
53160517Sobrien      i386-coff)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
53260517Sobrien      i386-aout)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
53333965Sjdp      *)		;;
53433965Sjdp    esac
53533965Sjdp
53633965Sjdp# Other random stuff.
53733965Sjdp
53860517Sobrien    # Do we need the opcodes library?
53933965Sjdp    case ${cpu_type} in
54038891Sjdp      vax | i386 | tic30)
54133965Sjdp	;;
54260517Sobrien
54333965Sjdp      *)
54433965Sjdp	need_opcodes=yes
54538891Sjdp
54638891Sjdp	case "${enable_shared}" in
54738891Sjdp	yes) shared_opcodes=true ;;
54838891Sjdp	*opcodes*) shared_opcodes=true ;;
54938891Sjdp	*) shared_opcodes=false ;;
55038891Sjdp	esac
55133965Sjdp	if test "${shared_opcodes}" = "true"; then
55233965Sjdp	  # A shared libopcodes must be linked against libbfd.
55333965Sjdp	  need_bfd=yes
55433965Sjdp	fi
55533965Sjdp	;;
55633965Sjdp    esac
55733965Sjdp
55860517Sobrien    # Any other special object files needed ?
55933965Sjdp    case ${cpu_type} in
56089866Sobrien      fr30 | m32r | openrisc)
56160517Sobrien	using_cgen=yes
56233965Sjdp	;;
56333965Sjdp
56433965Sjdp      m68k)
56533965Sjdp	case ${extra_objects} in
56633965Sjdp	*m68k-parse.o*) ;;
56733965Sjdp	*) extra_objects="$extra_objects m68k-parse.o" ;;
56833965Sjdp	esac
56933965Sjdp	;;
57033965Sjdp
57133965Sjdp      mips)
57233965Sjdp	echo ${extra_objects} | grep -s "itbl-parse.o" 
57333965Sjdp	if test $? -ne 0 ; then
57433965Sjdp	  extra_objects="$extra_objects itbl-parse.o"
57533965Sjdp	fi
57633965Sjdp
57733965Sjdp	echo ${extra_objects} | grep -s "itbl-lex.o" 
57833965Sjdp	if test $? -ne 0 ; then
57933965Sjdp	  extra_objects="$extra_objects itbl-lex.o"
58033965Sjdp	fi
58133965Sjdp
58233965Sjdp	echo ${extra_objects} | grep -s "itbl-ops.o" 
58333965Sjdp	if test $? -ne 0 ; then
58433965Sjdp	  extra_objects="$extra_objects itbl-ops.o"
58533965Sjdp	fi
58633965Sjdp	;;
58733965Sjdp
58889866Sobrien      i386 | s390 | sparc)
58977310Sobrien	if test $this_target = $target ; then
59077310Sobrien	  AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
59177310Sobrien	fi
59277310Sobrien	;;
59389866Sobrien
59489866Sobrien      xstormy16)
59589866Sobrien	using_cgen=yes
59638891Sjdp	;;
59789866Sobrien
59833965Sjdp      *)
59933965Sjdp	;;
60033965Sjdp    esac
60133965Sjdp
60260517Sobrien    if test $using_cgen = yes ; then
60360517Sobrien	case "x${extra_objects}" in
60460517Sobrien	*cgen.o*) ;;
60560517Sobrien	*) extra_objects="$extra_objects cgen.o" ;;
60660517Sobrien	esac
60760517Sobrien    fi
60860517Sobrien
60933965Sjdp# See if we really can support this configuration with the emulation code.
61033965Sjdp
61133965Sjdp    if test $this_target = $target ; then
61233965Sjdp      primary_bfd_gas=$bfd_gas
61333965Sjdp      obj_format=$fmt
61433965Sjdp      te_file=$em
61533965Sjdp
61633965Sjdp      if test $bfd_gas = no ; then
61733965Sjdp	# Can't support other configurations this way.
61833965Sjdp	break
61933965Sjdp      fi
62033965Sjdp    elif test $bfd_gas = no ; then
62133965Sjdp      # Can't support this configuration.
62233965Sjdp      break
62333965Sjdp    fi
62433965Sjdp
62533965Sjdp# From target name and format, produce a list of supported emulations.
62633965Sjdp
62733965Sjdp    case ${generic_target}-${fmt} in
62833965Sjdp      mips-*-irix5*-*)	emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
62989866Sobrien      mips*-*-linux*-*) case "$endian" in
63089866Sobrien			big)	emulation="mipsbelf mipslelf mipself" ;;
63189866Sobrien			*)	emulation="mipslelf mipsbelf mipself" ;;
63233965Sjdp			esac ;;
63333965Sjdp      mips-*-lnews*-ecoff) ;;
63433965Sjdp      mips-*-*-ecoff)	case "$endian" in
63533965Sjdp			big)	emulation="mipsbecoff mipslecoff mipsecoff" ;;
63633965Sjdp			*)	emulation="mipslecoff mipsbecoff mipsecoff" ;;
63733965Sjdp			esac ;;
63833965Sjdp      mips-*-*-elf)	case "$endian" in
63933965Sjdp			big)	emulation="mipsbelf mipslelf mipself" ;;
64033965Sjdp			*)	emulation="mipslelf mipsbelf mipself" ;;
64133965Sjdp			esac ;;
64277310Sobrien      mips-*-sysv4*MP*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
64377310Sobrien      # i386-pc-pe-coff != i386-pc-coff.
64477310Sobrien      i386-*-pe-coff)	;;
64560517Sobrien      # Uncommenting the next line will turn on support for i386 AOUT
64660517Sobrien      # for the default linux configuration
64760517Sobrien      # i386-*-linux*-elf) emulation="i386elf i386aout" ;;
64860517Sobrien      #
64960517Sobrien      i386-*-aout)	emulation="i386aout" ;;
65060517Sobrien      i386-*-coff)	emulation="i386coff" ;;
65160517Sobrien      i386-*-elf)	emulation="i386elf" ;;
65277310Sobrien
65377310Sobrien      # Always all formats.  The first stated emulation becomes the default.
65477310Sobrien      cris-*-*aout*)	emulation="crisaout criself" ;;
65577310Sobrien      cris-*-*)		emulation="criself crisaout" ;;
65633965Sjdp    esac
65733965Sjdp
65833965Sjdp    emulations="$emulations $emulation"
65933965Sjdp
66033965Sjdpdone
66133965Sjdp
66260517Sobrien# Turn on all targets if possible
66360517Sobrienif test ${all_targets} = "yes"; then
66460517Sobrien  case ${target_cpu_type} in
66560517Sobrien  i386)
66660517Sobrien    case ${obj_format} in
66760517Sobrien    aout)
66860517Sobrien      emulations="$emulations i386coff i386elf"
66960517Sobrien      ;;
67060517Sobrien    coff)
67160517Sobrien      emulations="$emulations i386aout i386elf"
67260517Sobrien    ;;
67360517Sobrien    elf)
67460517Sobrien      emulations="$emulations i386aout i386coff"
67560517Sobrien      ;;
67660517Sobrien    esac
67760517Sobrien  ;;
67860517Sobrien  esac
67960517Sobrienfi
68060517Sobrien
68133965Sjdp# Assign floating point type.  Most processors with FP support
68233965Sjdp# IEEE FP.  On those that don't support FP at all, usually IEEE
68333965Sjdp# is emulated.
68433965Sjdpcase ${target_cpu} in
68533965Sjdp  vax | tahoe )	atof=${target_cpu} ;;
68689866Sobrien  pdp11)	atof=vax ;;
68733965Sjdp  *)		atof=ieee ;;
68833965Sjdpesac
68933965Sjdp
69033965Sjdpcase "${obj_format}" in
69133965Sjdp  "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
69233965Sjdpesac
69333965Sjdp
69460517Sobrien# Unfortunately the cpu in cpu-opc.h file isn't always $(TARGET_CPU).
69560517Sobriencgen_cpu_prefix=""
69660517Sobrienif test $using_cgen = yes ; then
69760517Sobrien  case ${target_cpu} in
69860517Sobrien    *) cgen_cpu_prefix=${target_cpu} ;;
69960517Sobrien  esac
70060517Sobrien  AC_SUBST(cgen_cpu_prefix)
70160517Sobrien  AC_DEFINE(USING_CGEN, 1, [Using cgen code?])
70260517Sobrienfi
70360517Sobrien
70433965Sjdpdnl
70533965Sjdpdnl Make sure the desired support files exist.
70633965Sjdpdnl
70733965Sjdp
70833965Sjdpif test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
70933965Sjdp  AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
71033965Sjdpfi
71133965Sjdp
71233965Sjdpif test ! -r ${srcdir}/config/obj-${obj_format}.c; then
71333965Sjdp  AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
71433965Sjdpfi
71533965Sjdp
71633965Sjdpcase ${user_bfd_gas}-${primary_bfd_gas} in
71733965Sjdp  yes-yes | no-no)
71833965Sjdp    # We didn't override user's choice.
71933965Sjdp    ;;
72033965Sjdp  no-yes)
72133965Sjdp    AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
72233965Sjdp    ;;
72333965Sjdp  no-preferred)
72433965Sjdp    primary_bfd_gas=no
72533965Sjdp    ;;
72633965Sjdp  *-preferred)
72733965Sjdp    primary_bfd_gas=yes
72833965Sjdp    ;;
72933965Sjdp  yes-*)
73033965Sjdp    primary_bfd_gas=yes
73133965Sjdp    ;;
73233965Sjdp  -*)
73333965Sjdp    # User specified nothing.
73433965Sjdp    ;;
73533965Sjdpesac
73633965Sjdp
73733965Sjdp# Some COFF configurations want these random other flags set.
73833965Sjdpcase ${obj_format} in
73933965Sjdp  coff)
74033965Sjdp    case ${target_cpu_type} in
74160517Sobrien      i386) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;;
74260517Sobrien      m68k) AC_DEFINE(M68KCOFF, 1, [Using m68k COFF?]) ;;
74360517Sobrien      m88k) AC_DEFINE(M88KCOFF, 1, [Using m88k COFF?]) ;;
74433965Sjdp    esac
74533965Sjdp    ;;
74633965Sjdpesac
74733965Sjdp
74833965Sjdp# Getting this done right is going to be a bitch.  Each configuration specified
74933965Sjdp# with --enable-targets=... should be checked for environment, format, cpu, and
75033965Sjdp# bfd_gas setting.
75133965Sjdp#
75233965Sjdp# For each configuration, the necessary object file support code must be linked
75333965Sjdp# in.  This might be only one, it might be up to four.  The necessary emulation
75433965Sjdp# code needs to be provided, too.
75533965Sjdp#
75633965Sjdp# And then there's "--enable-targets=all"....
75733965Sjdp#
75833965Sjdp# For now, just always do it for MIPS ELF or ECOFF configurations.  Sigh.
75933965Sjdp
76033965Sjdpformats="${obj_format}"
76133965Sjdpemfiles=""
76233965SjdpEMULATIONS=""
76333965SjdpGAS_UNIQ(emulations)
76433965Sjdpfor em in . $emulations ; do
76533965Sjdp  case $em in
76633965Sjdp    .)	continue ;;
76778837Sobrien    mipsbelf | mipslelf | mipself)
76833965Sjdp	fmt=elf   file=mipself ;;
76978837Sobrien    mipsbecoff | mipslecoff | mipsecoff)
77033965Sjdp	fmt=ecoff file=mipsecoff ;;
77177310Sobrien    *coff)
77277310Sobrien	fmt=coff  file=$em ;;
77377310Sobrien    *aout)
77477310Sobrien	fmt=aout file=$em ;;
77577310Sobrien    *elf)
77677310Sobrien	fmt=elf file=$em ;;
77733965Sjdp  esac
77833965Sjdp  formats="$formats $fmt"
77933965Sjdp  emfiles="$emfiles e-$file.o"
78033965Sjdp  EMULATIONS="$EMULATIONS &$em,"
78133965Sjdpdone
78233965SjdpGAS_UNIQ(formats)
78333965SjdpGAS_UNIQ(emfiles)
78433965Sjdpif test `set . $formats ; shift ; echo $#` -gt 1 ; then
78533965Sjdp  for fmt in $formats ; do
78633965Sjdp    case $fmt in
78760517Sobrien      aout)	AC_DEFINE(OBJ_MAYBE_AOUT, 1,    [a.out support?])   ;;
78860517Sobrien      bout)	AC_DEFINE(OBJ_MAYBE_BOUT, 1,    [b.out support?])   ;;
78960517Sobrien      coff)	AC_DEFINE(OBJ_MAYBE_COFF, 1,    [COFF support?])    ;;
79060517Sobrien      ecoff)	AC_DEFINE(OBJ_MAYBE_ECOFF, 1,   [ECOFF support?])   ;;
79160517Sobrien      elf)	AC_DEFINE(OBJ_MAYBE_ELF, 1,     [ELF support?])     ;;
79260517Sobrien      generic)	AC_DEFINE(OBJ_MAYBE_GENERIC, 1, [generic support?]) ;;
79360517Sobrien      hp300)	AC_DEFINE(OBJ_MAYBE_HP300, 1,   [HP300 support?])   ;;
79460517Sobrien      ieee)	AC_DEFINE(OBJ_MAYBE_IEEE, 1,    [IEEE support?])    ;;
79560517Sobrien      som)	AC_DEFINE(OBJ_MAYBE_SOM, 1,     [SOM support?])     ;;
79660517Sobrien      vms)	AC_DEFINE(OBJ_MAYBE_VMS, 1,     [VMS support?])     ;;
79733965Sjdp    esac
79833965Sjdp    extra_objects="$extra_objects obj-$fmt.o"
79933965Sjdp  done
80033965Sjdp  obj_format=multi
80133965Sjdpfi
80233965Sjdpif test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
80333965Sjdp  DEFAULT_EMULATION=`set . $emulations ; echo $2`
80460517Sobrien  # e-mips* has more than one emulation per file, e-i386* has just one at the
80560517Sobrien  # moment.  If only one emulation is specified, then don't define
80660517Sobrien  # USE_EMULATIONS or include any of the e-files as they will only be bloat.
80760517Sobrien  case "${obj_format}${emfiles}" in
80860517Sobrien    multi* | *mips*)
80960517Sobrien      extra_objects="$extra_objects $emfiles"
81060517Sobrien      AC_DEFINE(USE_EMULATIONS, 1, [Use emulation support?]) ;;
81160517Sobrien  esac
81233965Sjdpfi
81333965SjdpAC_SUBST(extra_objects)
81460517SobrienAC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS, [Supported emulations.])
81560517SobrienAC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION",
81660517Sobrien		   [Default emulation.])
81733965Sjdp
81833965Sjdpcase ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
81933965Sjdp  yes-*-coff)	need_bfd=yes ;;
82033965Sjdp  no-*-coff)	need_bfd=yes
82160517Sobrien		AC_DEFINE(MANY_SEGMENTS, 1, [old COFF support?]) ;;
82233965Sjdpesac
82333965Sjdp
82433965Sjdpreject_dev_configs=yes
82533965Sjdp
82633965Sjdpcase ${reject_dev_configs}-${dev} in
82733965Sjdp  yes-yes) # Oops.
82833965Sjdp    AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
82933965Sjdp    ;;
83033965Sjdpesac
83133965Sjdp
83233965SjdpAC_SUBST(target_cpu_type)
83333965SjdpAC_SUBST(obj_format)
83433965SjdpAC_SUBST(te_file)
83560517SobrienAC_SUBST(install_tooldir)
83633965SjdpAC_SUBST(atof)
83733965Sjdpdnl AC_SUBST(emulation)
83833965Sjdp
83933965Sjdpcase "${primary_bfd_gas}" in
84060517Sobrien  yes)	AC_DEFINE(BFD_ASSEMBLER, 1, [Use BFD interface?])
84133965Sjdp	need_bfd=yes ;;
84233965Sjdpesac
84333965Sjdp
84433965Sjdp# do we need the opcodes library?
84533965Sjdpcase "${need_opcodes}" in
84633965Sjdpyes)
84738891Sjdp  OPCODES_LIB=../opcodes/libopcodes.la
84833965Sjdp  ;;
84933965Sjdpesac
85033965Sjdp
85133965Sjdpcase "${need_bfd}" in
85233965Sjdpyes)
85338891Sjdp  BFDLIB=../bfd/libbfd.la
85433965Sjdp  ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
85533965Sjdp  ;;
85633965Sjdpesac
85733965Sjdp
85833965SjdpAC_SUBST(BFDLIB)
85933965SjdpAC_SUBST(OPCODES_LIB)
86033965Sjdp
86133965SjdpAC_SUBST(ALL_OBJ_DEPS)
86233965Sjdp
86360517SobrienAC_DEFINE_UNQUOTED(TARGET_ALIAS,	"${target_alias}", [Target alias.])
86460517SobrienAC_DEFINE_UNQUOTED(TARGET_CANONICAL,	"${target}",       [Canonical target.])
86560517SobrienAC_DEFINE_UNQUOTED(TARGET_CPU,		"${target_cpu}",   [Target CPU.])
86660517SobrienAC_DEFINE_UNQUOTED(TARGET_VENDOR,	"${target_vendor}", [Target vendor.])
86760517SobrienAC_DEFINE_UNQUOTED(TARGET_OS,		"${target_os}",    [Target OS.])
86833965Sjdp
86933965SjdpAC_PROG_CC
87033965Sjdp
87138891SjdpAC_PROG_YACC
87260517SobrienAM_PROG_LEX
87338891Sjdp
87489866SobrienALL_LINGUAS="fr tr"
87560517SobrienCY_GNU_GETTEXT
87660517Sobrien
87738891SjdpAM_MAINTAINER_MODE
87860517SobrienAC_EXEEXT
87938891Sjdp
88033965SjdpAC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
88133965Sjdp
88233965Sjdp# Put this here so that autoconf's "cross-compiling" message doesn't confuse
88333965Sjdp# people who are not cross-compiling but are compiling cross-assemblers.
88433965SjdpAC_MSG_CHECKING(whether compiling a cross-assembler)
88533965Sjdpif test "${host}" = "${target}"; then
88633965Sjdp  cross_gas=no
88733965Sjdpelse
88833965Sjdp  cross_gas=yes
88960517Sobrien  AC_DEFINE(CROSS_COMPILE, 1, [Compiling cross-assembler?])
89033965Sjdpfi
89133965SjdpAC_MSG_RESULT($cross_gas)
89233965Sjdp
89333965Sjdpdnl ansidecl.h will deal with const
89433965Sjdpdnl AC_CONST
89533965SjdpAC_FUNC_ALLOCA
89633965SjdpAC_C_INLINE
89733965Sjdp
89833965Sjdp# VMS doesn't have unlink.
89933965SjdpAC_CHECK_FUNCS(unlink remove, break)
90033965Sjdp
90133965Sjdp# Some systems don't have sbrk().
90233965SjdpAC_CHECK_FUNCS(sbrk)
90333965Sjdp
90477310Sobrien# do we need the math library?
90577310Sobriencase "${need_libm}" in
90677310Sobrienyes) 
90777310Sobrien  AC_CHECK_LIBM
90877310Sobrien  AC_SUBST(LIBM)
90977310Sobrien  ;;
91077310Sobrienesac
91177310Sobrien
91233965Sjdp# Some non-ANSI preprocessors botch requoting inside strings.  That's bad
91333965Sjdp# enough, but on some of those systems, the assert macro relies on requoting
91433965Sjdp# working properly!
91533965SjdpGAS_WORKING_ASSERT
91633965Sjdp
91733965Sjdp# On some systems, the system header files may not declare malloc, realloc,
91833965Sjdp# and free.  There are places where gas needs these functions to have been
91933965Sjdp# declared -- such as when taking their addresses.
92033965Sjdpgas_test_headers="
92133965Sjdp#ifdef HAVE_MEMORY_H
92233965Sjdp#include <memory.h>
92333965Sjdp#endif
92433965Sjdp#ifdef HAVE_STRING_H
92533965Sjdp#include <string.h>
92633965Sjdp#else
92733965Sjdp#ifdef HAVE_STRINGS_H
92833965Sjdp#include <strings.h>
92933965Sjdp#endif
93033965Sjdp#endif
93133965Sjdp#ifdef HAVE_STDLIB_H
93233965Sjdp#include <stdlib.h>
93333965Sjdp#endif
93433965Sjdp#ifdef HAVE_UNISTD_H
93533965Sjdp#include <unistd.h>
93633965Sjdp#endif
93733965Sjdp"
93833965SjdpGAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
93933965SjdpGAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
94033965SjdpGAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
94133965SjdpGAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
94260517SobrienGAS_CHECK_DECL_NEEDED(environ, f, char **f, $gas_test_headers)
94333965Sjdp
94433965Sjdp# Does errno.h declare errno, or do we have to add a separate declaration
94533965Sjdp# for it?
94633965SjdpGAS_CHECK_DECL_NEEDED(errno, f, int f, [
94733965Sjdp#ifdef HAVE_ERRNO_H
94833965Sjdp#include <errno.h>
94933965Sjdp#endif
95033965Sjdp])
95133965Sjdp
95233965Sjdpdnl This must come last.
95333965Sjdp
95433965Sjdpdnl We used to make symlinks to files in the source directory, but now
95533965Sjdpdnl we just use the right name for .c files, and create .h files in
95633965Sjdpdnl the build directory which include the right .h file.  Make sure
95733965Sjdpdnl the old symlinks don't exist, so that a reconfigure in an existing
95833965Sjdpdnl directory behaves reasonably.
95933965Sjdp
96060517SobrienAC_OUTPUT(Makefile doc/Makefile ${GDBINIT}:gdbinit.in po/Makefile.in:po/Make-in,
96133965Sjdp[rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
96233965Sjdp echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
96333965Sjdp echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
96433965Sjdp echo '#include "te-'"${te_file}"'.h"' > targ-env.h
96533965Sjdp echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
96660517Sobrien if test "x$cgen_cpu_prefix" != x ; then
96760517Sobrien   echo '#include "opcodes/'"${cgen_cpu_prefix}"'-desc.h"' > cgen-desc.h
96860517Sobrien fi
96960517Sobrien
97060517Sobrien sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile],
97133965Sjdp[target_cpu_type=${target_cpu_type}
97260517Sobrien cgen_cpu_prefix=${cgen_cpu_prefix}
97333965Sjdp obj_format=${obj_format}
97433965Sjdp te_file=${te_file}])
975