configure.in revision 77310
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 77310 2001-05-28 06:08:54Z 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
1577310SobrienAM_INIT_AUTOMAKE(gas, 2.11)
1638891Sjdp
1738891SjdpAM_PROG_LIBTOOL
1838891Sjdp
1933965Sjdpuser_bfd_gas=
2033965SjdpAC_ARG_ENABLE(bfd-assembler,
2133965Sjdp[  --enable-bfd-assembler  use BFD back end for writing object files],
2233965Sjdp[case "${enableval}" in
2333965Sjdp  yes) need_bfd=yes user_bfd_gas=yes ;;
2433965Sjdp  no)  user_bfd_gas=no ;;
2533965Sjdp  *)   AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;;
2633965Sjdpesac])dnl
2733965SjdpAC_ARG_ENABLE(targets,
2833965Sjdp[    targets            alternative target configurations besides the primary],
2933965Sjdp[case "${enableval}" in
3033965Sjdp  yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
3133965Sjdp	    ;;
3233965Sjdp  no)	    enable_targets= ;;
3333965Sjdp  *)	    enable_targets=$enableval ;;
3433965Sjdpesac])dnl
3533965SjdpAC_ARG_ENABLE(commonbfdlib,
3633965Sjdp[  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
3733965Sjdp[case "${enableval}" in
3833965Sjdp  yes) commonbfdlib=true ;;
3933965Sjdp  no)  commonbfdlib=false ;;
4033965Sjdp  *)   AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
4133965Sjdpesac])dnl
4233965Sjdp
4360517Sobrienusing_cgen=no
4460517Sobrien
4577310Sobrienbuild_warnings="-W -Wall"
4677310SobrienAC_ARG_ENABLE(build-warnings,
4777310Sobrien[  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
4877310Sobrien[case "${enableval}" in
4977310Sobrien  yes)	;;
5077310Sobrien  no)	build_warnings="-w";;
5177310Sobrien  ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
5277310Sobrien        build_warnings="${build_warnings} ${t}";;
5377310Sobrien  *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
5477310Sobrien        build_warnings="${t} ${build_warnings}";;
5577310Sobrien  *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
5677310Sobrienesac
5777310Sobrienif test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
5877310Sobrien  echo "Setting warning flags = $build_warnings" 6>&1
5977310Sobrienfi])dnl
6077310SobrienWARN_CFLAGS=""
6177310Sobrienif test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
6277310Sobrien    WARN_CFLAGS="${build_warnings}"
6377310Sobrienfi
6477310SobrienAC_SUBST(WARN_CFLAGS)
6577310Sobrien
6638891Sjdp# Generate a header file
6738891SjdpAM_CONFIG_HEADER(config.h:config.in)
6833965Sjdp
6960517Sobrien# If we are on a DOS filesystem, we must use gdb.ini rather than
7060517Sobrien# .gdbinit.
7160517SobrienGDBINIT=".gdbinit"
7260517Sobriencase "${host}" in
7360517Sobrien  *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
7460517Sobrien    GDBINIT="gdb.ini"
7560517Sobrien    ;;
7660517Sobrienesac
7760517SobrienAC_SUBST(GDBINIT)
7860517Sobrien
7933965Sjdpte_file=generic
8033965Sjdp
8160517Sobrien# Makefile target for installing gas in $(tooldir)/bin.
8260517Sobrieninstall_tooldir=install-exec-tooldir
8360517Sobrien
8433965Sjdpcanon_targets=""
8560517Sobrienall_targets=no
8633965Sjdpif test -n "$enable_targets" ; then
8733965Sjdp  for t in `echo $enable_targets | sed 's/,/ /g'`; do
8860517Sobrien    if test $t = "all"; then
8960517Sobrien      all_targets=yes
9060517Sobrien      continue
9160517Sobrien    fi
9260517Sobrien    result=`$ac_config_sub $t 2>/dev/null`
9333965Sjdp    if test -n "$result" ; then
9433965Sjdp      canon_targets="$canon_targets $result"
9533965Sjdp#    else
9633965Sjdp#      # Permit "all", etc.  We don't support it yet though.
9733965Sjdp#      canon_targets="$canon_targets $t"
9833965Sjdp    fi
9933965Sjdp  done
10033965Sjdp  GAS_UNIQ(canon_targets)
10133965Sjdpfi
10233965Sjdp
10333965Sjdpemulations=""
10433965Sjdp
10533965Sjdpfor this_target in $target $canon_targets ; do
10633965Sjdp
10733965Sjdpchangequote(,)dnl
10833965Sjdp    eval `echo $this_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'`
10933965Sjdpchangequote([,])dnl
11033965Sjdp
11133965Sjdp    # check for architecture variants
11238891Sjdp    arch=
11338891Sjdp    endian=
11433965Sjdp    case ${cpu} in
11538891Sjdp      alpha*)		cpu_type=alpha ;;
11633965Sjdp      armeb)		cpu_type=arm endian=big ;;
11733965Sjdp      arm*)		cpu_type=arm endian=little ;;
11860517Sobrien      armb*)		cpu_type=arm endian=little ;;
11960517Sobrien      armv*l)		cpu_type=arm endian=little ;;
12060517Sobrien      armv*b)		cpu_type=arm endian=big ;;
12177310Sobrien      xscale*)		cpu_type=arm endian=little ;;
12260517Sobrien      strongarm*)	cpu_type=arm endian=little ;;
12338891Sjdp      thumb*)		cpu_type=arm endian=little ;;
12433965Sjdp      hppa*)		cpu_type=hppa ;;
12533965Sjdpchangequote(,)dnl
12677310Sobrien      i[3456]86)	cpu_type=i386 arch=i386;;
12777310Sobrien      x86_64)		cpu_type=i386 arch=x86_64;;
12877310Sobrien      ia64)		cpu_type=ia64 ;;
12977310Sobrien      m6811|m6812|m68hc12) cpu_type=m68hc11 ;;
13033965Sjdp      m680[012346]0)	cpu_type=m68k ;;
13160517Sobrienchangequote([,])dnl
13233965Sjdp      m68008)		cpu_type=m68k ;;
13333965Sjdp      m683??)		cpu_type=m68k ;;
13460517Sobrien      m5200)		cpu_type=m68k ;;
13533965Sjdp      m8*)		cpu_type=m88k ;;
13633965Sjdp      mips*el)		cpu_type=mips endian=little ;;
13733965Sjdp      mips*)		cpu_type=mips endian=big ;;
13860517Sobrien      pjl*)		cpu_type=pj endian=little ;;
13960517Sobrien      pj*)		cpu_type=pj endian=big ;;
14033965Sjdp      powerpcle*)	cpu_type=ppc endian=little ;;
14133965Sjdp      powerpc*)		cpu_type=ppc endian=big ;;
14233965Sjdp      rs6000*)		cpu_type=ppc ;;
14338891Sjdp      sparclite*)	cpu_type=sparc arch=sparclite ;;
14438891Sjdp      sparclet*)	cpu_type=sparc arch=sparclet ;;
14538891Sjdp      sparc64*)		cpu_type=sparc arch=v9-64 ;;
14660517Sobrien      sparc86x*)	cpu_type=sparc arch=sparc86x  ;;
14738891Sjdp      sparc*)		cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
14838891Sjdp      v850*)		cpu_type=v850 ;;
14933965Sjdp      *)		cpu_type=${cpu} ;;
15033965Sjdp    esac
15133965Sjdp
15233965Sjdp    if test ${this_target} = $target ; then
15333965Sjdp      target_cpu_type=${cpu_type}
15433965Sjdp    elif test ${target_cpu_type} != ${cpu_type} ; then
15533965Sjdp      continue
15633965Sjdp    fi
15733965Sjdp
15833965Sjdp    generic_target=${cpu_type}-$vendor-$os
15933965Sjdp    dev=no
16033965Sjdp    bfd_gas=no
16133965Sjdp    em=generic
16233965Sjdp
16333965Sjdp    # assign object format
16433965Sjdp    case ${generic_target} in
16538891Sjdp      a29k-*-coff)          fmt=coff ;;
16638891Sjdp      a29k-amd-udi)         fmt=coff ;;
16738891Sjdp      a29k-amd-ebmon)       fmt=coff ;;
16838891Sjdp      a29k-nyu-sym1)        fmt=coff ;;
16977310Sobrien      a29k-*-rtems*)        fmt=coff ;;
17033965Sjdp      a29k-*-vxworks*)      fmt=coff ;;
17133965Sjdp
17238891Sjdp      alpha*-*-*vms*)	    fmt=evax ;;
17338891Sjdp      alpha*-*-netware*)    fmt=ecoff ;;
17438891Sjdp      alpha*-*-openbsd*)    fmt=ecoff ;;
17538891Sjdp      alpha*-*-osf*)        fmt=ecoff ;;
17638891Sjdp      alpha*-*-linuxecoff*) fmt=ecoff ;;
17738891Sjdp      alpha*-*-linux-gnu*)  fmt=elf em=linux ;;
17838891Sjdp      alpha*-*-netbsd*)     fmt=elf em=nbsd ;;
17933965Sjdp
18038891Sjdp      arc-*-elf*)           fmt=elf bfd_gas=yes ;;
18133965Sjdp
18260517Sobrien      arm-*-aout)	                fmt=aout ;;
18360517Sobrien      arm-*-coff | thumb-*-coff)        fmt=coff ;;
18477310Sobrien      arm-*-rtems | thumb-*-rtems)      fmt=elf ;;
18560517Sobrien      arm-*-elf | thumb-*-elf)          fmt=elf ;;
18660517Sobrien      arm*-*-conix*)			fmt=elf ;;
18760517Sobrien      arm-*-linux*aout*)	        fmt=aout em=linux ;;
18877310Sobrien      arm*-*-linux-gnu* | arm*-*-uclinux*)	
18977310Sobrien					fmt=elf  em=linux ;;
19077310Sobrien      arm-*-netbsd*)	                fmt=aout em=nbsd ;;
19160517Sobrien      arm-*-oabi | thumb-*-oabi)        fmt=elf ;;
19260517Sobrien      arm-epoc-pe | thumb-epoc-pe)      fmt=coff em=epoc-pe ;;
19377310Sobrien      arm-*-wince)			fmt=coff em=wince-pe ;;
19460517Sobrien      arm-*-pe | thumb-*-pe)            fmt=coff em=pe ;;
19560517Sobrien      arm-*-riscix*)	                fmt=aout em=riscix ;;
19633965Sjdp
19760517Sobrien      avr-*-*)		    fmt=elf bfd_gas=yes ;;
19860517Sobrien
19977310Sobrien      cris-*-*)		    fmt=multi bfd_gas=yes ;;
20077310Sobrien
20133965Sjdp      d10v-*-*)		    fmt=elf bfd_gas=yes ;;
20260517Sobrien      d30v-*-*)		    fmt=elf bfd_gas=yes ;;
20333965Sjdp
20460517Sobrien
20560517Sobrien      fr30-*-*)		    fmt=elf bfd_gas=yes ;;
20660517Sobrien
20777310Sobrien      hppa-*-linux-gnu*)    case ${cpu} in
20877310Sobrien				hppa*64*)
20977310Sobrien					fmt=elf em=hppalinux64;;
21077310Sobrien				hppa*)
21177310Sobrien					fmt=elf em=linux;;
21277310Sobrien			    esac ;;
21333965Sjdp      hppa-*-*elf*)         fmt=elf em=hppa ;;
21433965Sjdp      hppa-*-lites*)        fmt=elf em=hppa ;;
21533965Sjdp      hppa-*-osf*)          fmt=som em=hppa ;;
21633965Sjdp      hppa-*-rtems*)        fmt=elf em=hppa ;;
21777310Sobrien      hppa-*-hpux11*)	    case ${cpu} in
21877310Sobrien				hppa*64*)
21977310Sobrien					fmt=elf em=hppa64 ;;
22077310Sobrien				hppa*)
22177310Sobrien					fmt=som em=hppa ;;
22277310Sobrien			    esac ;;
22333965Sjdp      hppa-*-hpux*)         fmt=som em=hppa ;;
22460517Sobrien      hppa-*-mpeix*)        fmt=som em=hppa ;;
22533965Sjdp      hppa-*-bsd*)          fmt=som em=hppa ;;
22633965Sjdp      hppa-*-hiux*)         fmt=som em=hppa ;;
22733965Sjdp
22877310Sobrien      h8300-*-rtems*)       fmt=coff ;;
22933965Sjdp      h8300-*-coff)         fmt=coff ;;
23033965Sjdp
23160517Sobrien      i370-*-elf* | i370-*-linux*) fmt=elf ;;
23238891Sjdp      i386-ibm-aix*)        fmt=coff em=i386aix ;;
23333965Sjdp      i386-sequent-bsd*)    fmt=aout em=dynix bfd_gas=yes ;;
23460517Sobrien      i386-*-beospe*)       fmt=coff em=pe bfd_gas=yes ;;
23560517Sobrien      i386-*-beoself* | i386-*-beos*) fmt=elf bfd_gas=yes ;;
23633965Sjdp      i386-*-bsd*)          fmt=aout em=386bsd ;;
23733965Sjdp      i386-*-netbsd0.8)     fmt=aout em=386bsd ;;
23833965Sjdp      i386-*-netbsd*)       fmt=aout em=nbsd bfd_gas=yes;;
23933965Sjdp      i386-*-openbsd*)      fmt=aout em=nbsd bfd_gas=yes;;
24033965Sjdp      i386-*-linux*aout* | i386-*-linuxoldld)   fmt=aout em=linux ;;
24138891Sjdp      i386-*-linux*coff*)   fmt=coff em=linux ;;
24260517Sobrien      i386-*-linux-gnu*)    fmt=elf em=linux bfd_gas=yes ;;
24377310Sobrien      x86_64-*-linux-gnu*)  fmt=elf em=linux bfd_gas=yes ;;
24438891Sjdp      i386-*-lynxos*)       fmt=coff em=lynx ;;
24577310Sobrienchangequote(,)dnl
24677310Sobrien      i386-*-sysv[45]* | i386-*-solaris* | i386-*-elf)
24760517Sobrien			    fmt=elf bfd_gas=yes ;;
24860517Sobrien      i386-*-freebsdaout* | i386-*-freebsd[12].* | i386-*-freebsd[12])
24960517Sobrien                            fmt=aout em=386bsd ;;
25061850Sobrienchangequote([,])dnl
25138891Sjdp      i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*)
25238891Sjdp                          fmt=coff ;;
25338891Sjdp      i386-*-sco3.2v5*)      fmt=elf
25438891Sjdp			    if test ${this_target} = $target; then
25560517Sobrien				AC_DEFINE(SCO_ELF, 1,
25660517Sobrien				    [Define if defaulting to ELF on SCO 5.])
25738891Sjdp			    fi
25838891Sjdp			    ;;
25938891Sjdp      i386-*-sco3.2*)       fmt=coff ;;
26033965Sjdp      i386-*-vsta)          fmt=aout ;;
26138891Sjdp      i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*)
26277310Sobrien			    fmt=coff em=go32 bfd_gas=yes
26377310Sobrien			    AC_DEFINE(STRICTCOFF, 1, [Using strict COFF?])
26477310Sobrien			    ;;
26560517Sobrien      i386-*-rtemself*)     fmt=elf ;;
26677310Sobrien      i386-*-rtems*)        fmt=coff ;;
26733965Sjdp      i386-*-gnu*)          fmt=elf ;;
26833965Sjdp      i386-*-mach*)
26933965Sjdp			    fmt=aout em=mach bfd_gas=yes ;;
27033965Sjdp      i386-*-msdos*)        fmt=aout ;;
27133965Sjdp      i386-*-moss*)	    fmt=elf ;;
27277310Sobrien      i386-*-pe)            fmt=coff em=pe bfd_gas=yes ;;
27360517Sobrien      i386-*-cygwin*)       fmt=coff em=pe bfd_gas=yes ;;
27460517Sobrien      i386-*-interix*)	    fmt=coff em=interix bfd_gas=yes ;;
27538891Sjdp      i386-*-mingw32*)      fmt=coff em=pe bfd_gas=yes ;;
27677310Sobrien      i386-*-*nt*)          fmt=coff em=pe bfd_gas=yes ;;
27760517Sobrien      i386-*-vxworks*)      fmt=aout ;;
27877310Sobrien      i386-*-chaos)         fmt=elf ;;
27977310Sobrien      i860-stardent-sysv4* | i860-stardent-elf*)
28077310Sobrien			    fmt=elf bfd_gas=yes endian=little
28177310Sobrien			    AC_MSG_WARN(GAS support for ${generic_target} is preliminary and a work in progress) ;;
28233965Sjdp      i960-*-bout)          fmt=bout ;;
28338891Sjdp      i960-*-coff)          fmt=coff em=ic960 ;;
28438891Sjdp      i960-*-rtems*)        fmt=coff em=ic960 ;;
28533965Sjdp      i960-*-nindy*)        fmt=bout ;;
28633965Sjdp      i960-*-vxworks4*)     fmt=bout ;;
28733965Sjdp      i960-*-vxworks5.0)    fmt=bout ;;
28838891Sjdp      i960-*-vxworks5.*)    fmt=coff em=ic960 ;;
28933965Sjdp      i960-*-vxworks*)      fmt=bout ;;
29060517Sobrien      i960-*-elf*)	    fmt=elf ;;
29133965Sjdp
29277310Sobrien      ia64-*-elf*)	    fmt=elf ;;
29377310Sobrien      ia64-*-linux-gnu*)    fmt=elf em=linux ;;
29477310Sobrien      ia64-*-hpux*)	    fmt=elf em=hpux ;;
29577310Sobrien
29633965Sjdp      m32r-*-*)		    fmt=elf bfd_gas=yes ;;
29733965Sjdp
29877310Sobrien      m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)fmt=elf bfd_gas=yes ;;
29977310Sobrien
30033965Sjdp      m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
30133965Sjdp			    fmt=aout em=sun3 ;;
30238891Sjdp      m68k-motorola-sysv*)  fmt=coff em=delta ;;
30338891Sjdp      m68k-bull-sysv3*)     fmt=coff em=dpx2 ;;
30438891Sjdp      m68k-apollo-*)        fmt=coff em=apollo ;;
30533965Sjdp      m68k-*-sysv4*) # must be before -sysv*
30633965Sjdp			    fmt=elf em=svr4 ;;
30733965Sjdp      m68k-*-elf*)	    fmt=elf ;;
30877310Sobrien      m68k-*-coff | m68k-*-sysv* | m68k-*-rtems*)
30938891Sjdp			    fmt=coff ;;
31033965Sjdp      m68k-*-hpux*)         fmt=hp300 em=hp300 ;;
31133965Sjdp      m68k-*-linux*aout*)   fmt=aout em=linux ;;
31238891Sjdp      m68k-*-linux-gnu*)    fmt=elf em=linux ;;
31360517Sobrien      m68k-*-gnu*)	    fmt=elf ;;
31438891Sjdp      m68k-*-lynxos*)       fmt=coff em=lynx ;;
31533965Sjdp      m68k-*-netbsd*)       fmt=aout em=nbsd bfd_gas=yes ;;
31633965Sjdp      m68k-*-openbsd*)      fmt=aout em=nbsd bfd_gas=yes ;;
31738891Sjdp      m68k-apple-aux*)      fmt=coff em=aux ;;
31833965Sjdp      m68k-*-psos*)         fmt=elf em=psos;;
31933965Sjdp
32038891Sjdp      m88k-motorola-sysv3*) fmt=coff em=delt88 ;;
32138891Sjdp      m88k-*-coff*)         fmt=coff ;;
32233965Sjdp
32360517Sobrien      mcore-*-elf)	    fmt=elf bfd_gas=yes ;;
32460517Sobrien      mcore-*-pe)	    fmt=coff em=pe bfd_gas=yes ;;
32560517Sobrien
32633965Sjdp      # don't change em like *-*-bsd does
32738891Sjdp      mips-dec-netbsd*)	    fmt=elf endian=little ;;
32838891Sjdp      mips-dec-openbsd*)    fmt=elf endian=little ;;
32960517Sobrien      mips-dec-bsd*)        fmt=aout endian=little ;;
33038891Sjdp      mips-sony-bsd*)       fmt=ecoff ;;
33133965Sjdp      mips-*-bsd*)          AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
33238891Sjdp      mips-*-ultrix*)       fmt=ecoff endian=little ;;
33338891Sjdp      mips-*-osf*)          fmt=ecoff endian=little ;;
33438891Sjdp      mips-*-ecoff*)        fmt=ecoff ;;
33538891Sjdp      mips-*-ecoff*)        fmt=ecoff ;;
33660517Sobrien      mips-*-pe*)           fmt=coff endian=little em=pe ;;
33738891Sjdp      mips-*-irix6*)	    fmt=elf ;;
33838891Sjdp      mips-*-irix5*)        fmt=elf ;;
33938891Sjdp      mips-*-irix*)         fmt=ecoff ;;
34038891Sjdp      mips-*-lnews*)        fmt=ecoff em=lnews ;;
34138891Sjdp      mips-*-riscos*)       fmt=ecoff ;;
34277310Sobrien      mips-*-sysv4*MP*)     fmt=elf em=tmips ;;
34338891Sjdp      mips-*-sysv*)         fmt=ecoff ;;
34438891Sjdp      mips-*-elf* | mips-*-rtems* | mips-*-linux-gnu* | mips-*-gnu* | mips-*-openbsd*)
34538891Sjdp			    fmt=elf ;;
34660517Sobrien      mips-*-vxworks*)      fmt=elf
34760517Sobrien			    AC_DEFINE(MIPS_STABS_ELF, 1,
34860517Sobrien				[Use ELF stabs for MIPS, not ECOFF stabs])
34960517Sobrien			    ;;
35033965Sjdp      mn10200-*-*)	    fmt=elf bfd_gas=yes ;;
35133965Sjdp      mn10300-*-*)	    fmt=elf bfd_gas=yes ;;
35260517Sobrien      pj*)		    fmt=elf ;;
35360517Sobrien      ppc-*-pe | ppc-*-cygwin* | ppc-*-winnt*)
35438891Sjdp		            fmt=coff em=pe ;;
35533965Sjdp      ppc-*-aix*)           fmt=coff ;;
35633965Sjdp      ppc-*-beos*)          fmt=coff ;;
35733965Sjdp      ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
35838891Sjdp			    fmt=elf ;;
35938891Sjdp      ppc-*-linux-gnu*)	    fmt=elf
36033965Sjdp			    case "$endian" in
36138891Sjdp			    big)  ;;
36238891Sjdp			    *)    AC_MSG_ERROR(GNU/Linux must be configured big endian) ;;
36333965Sjdp			    esac
36433965Sjdp			    ;;
36533965Sjdp      ppc-*-solaris*)	    fmt=elf
36638891Sjdp			    if test ${this_target} = $target; then
36760517Sobrien				AC_DEFINE(TARGET_SOLARIS_COMMENT, 1,
36860517Sobrien				[Define if default target is PowerPC Solaris.])
36938891Sjdp			    fi
37038891Sjdp			    if test x${endian} = xbig; then
37138891Sjdp				AC_MSG_ERROR(Solaris must be configured little endian)
37238891Sjdp			    fi
37333965Sjdp			    ;;
37438891Sjdp      ppc-*-rtems*)	    fmt=elf ;;
37533965Sjdp      ppc-*-macos* | ppc-*-mpw*)
37633965Sjdp			    fmt=coff em=macos ;;
37733965Sjdp      ppc-*-netware*)       fmt=elf em=ppcnw ;;
37860517Sobrien      ppc-*-vxworks*)       fmt=elf ;;
37933965Sjdp
38077310Sobrien      sh-*-linux*)	    fmt=elf em=linux ;;
38133965Sjdp      sh-*-elf*)	    fmt=elf ;;
38233965Sjdp      sh-*-coff*)           fmt=coff ;;
38360517Sobrien      sh-*-pe*)             fmt=coff em=pe bfd_gas=yes;;
38460517Sobrien      sh-*-rtemself*)       fmt=elf ;;
38577310Sobrien      sh-*-rtems*)	    fmt=coff ;;
38633965Sjdp
38733965Sjdp      ns32k-pc532-mach* | ns32k-pc532-ux*)    fmt=aout em=pc532mach ;;
38833965Sjdp      ns32k-pc532-netbsd* | ns32k-pc532-lites*)  fmt=aout em=nbsd532 ;;
38933965Sjdp      ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;
39033965Sjdp
39161850Sobrien      sparc-*-rtemsaout*)   fmt=aout ;;
39261850Sobrien      sparc-*-rtemself*)    fmt=elf ;;
39361850Sobrien      sparc-*-rtems*)       fmt=elf ;;
39433965Sjdp      sparc-*-sunos4*)      fmt=aout em=sun3 ;;
39533965Sjdp      sparc-*-aout | sparc*-*-vxworks*)
39633965Sjdp			    fmt=aout em=sparcaout ;;
39733965Sjdp      sparc-*-coff)         fmt=coff ;;
39833965Sjdp      sparc-*-linux*aout*)  fmt=aout em=linux ;;
39938891Sjdp      sparc-*-linux-gnu*)   fmt=elf em=linux ;;
40033965Sjdp      sparc-*-lynxos*)      fmt=coff em=lynx ;;
40133965Sjdp      sparc-fujitsu-none)   fmt=aout ;;
40233965Sjdp      sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*)
40333965Sjdp			    fmt=elf ;;
40468775Sobrien      sparc-*-netbsd*)      em=nbsd bfd_gas=yes
40568775Sobrien                            case ${cpu} in
40668775Sobrien                                sparc) case ${os} in
40768775Sobrien                                           *elf*) fmt=elf ;;
40868775Sobrien                                           *)     fmt=aout ;;
40968775Sobrien                                       esac ;;
41068775Sobrien                                sparc64) fmt=elf ;;
41168775Sobrien                            esac
41268775Sobrien                            ;;
41360517Sobrien      sparc-*-openbsd*)     fmt=aout em=nbsd ;;
41433965Sjdp
41560517Sobrien      strongarm-*-coff)     fmt=coff ;;
41660517Sobrien      strongarm-*-elf)      fmt=elf ;;
41777310Sobrien      xscale-*-coff)     fmt=coff ;;
41877310Sobrien      xscale-*-elf)      fmt=elf ;;
41960517Sobrien
42038891Sjdp      tic30-*-*aout*)	    fmt=aout bfd_gas=yes ;;
42138891Sjdp      tic30-*-*coff*)       fmt=coff bfd_gas=yes ;;
42277310Sobrien      tic54x-*-* | c54x*-*-*)
42377310Sobrien			    fmt=coff bfd_gas=yes need_libm=yes;;
42460517Sobrien      tic80-*-*)	    fmt=coff ;;
42538891Sjdp
42638891Sjdp      v850-*-*)		    fmt=elf bfd_gas=yes ;;
42760517Sobrien      v850e-*-*)	    fmt=elf bfd_gas=yes ;;
42860517Sobrien      v850ea-*-*)	    fmt=elf bfd_gas=yes ;;
42938891Sjdp
43033965Sjdp      vax-*-bsd* | vax-*-ultrix*)
43133965Sjdp			    fmt=aout ;;
43233965Sjdp      vax-*-vms)            fmt=vms ;;
43333965Sjdp
43460517Sobrien
43533965Sjdp      z8k-*-coff | z8k-*-sim)
43633965Sjdp			    fmt=coff ;;
43733965Sjdp
43833965Sjdp      w65-*-*)              fmt=coff ;;
43933965Sjdp
44077310Sobrien      *-*-freebsd*)	    fmt=elf em=freebsd bfd_gas=yes ;;
44133965Sjdp      *-*-aout | *-*-scout)
44233965Sjdp			    fmt=aout ;;
44333965Sjdp      *-*-nindy*)
44433965Sjdp			    fmt=bout ;;
44533965Sjdp      *-*-bsd*)
44633965Sjdp			    fmt=aout em=sun3 ;;
44733965Sjdp      *-*-generic)          fmt=generic ;;
44833965Sjdp      *-*-xray | *-*-hms)   fmt=coff ;;
44933965Sjdp      *-*-sim)              fmt=coff ;;
45033965Sjdp      *-*-elf | *-*-sysv4* | *-*-solaris*)
45133965Sjdp			    AC_MSG_WARN(GAS support for ${generic_target} is incomplete.)
45233965Sjdp			    fmt=elf dev=yes ;;
45333965Sjdp      *-*-vxworks)          fmt=aout ;;
45433965Sjdp      *-*-netware)          fmt=elf ;;
45533965Sjdp    esac
45633965Sjdp
45760517Sobrien    if test ${this_target} = $target ; then
45860517Sobrien      endian_def=
45960517Sobrien      if test x${endian} = xbig; then
46060517Sobrien	endian_def=1
46160517Sobrien      elif test x${endian} = xlittle; then
46260517Sobrien	endian_def=0
46360517Sobrien      fi
46460517Sobrien      if test x${endian_def} != x; then
46560517Sobrien	AC_DEFINE_UNQUOTED(TARGET_BYTES_BIG_ENDIAN, $endian_def,
46660517Sobrien			   [Define as 1 if big endian.])
46760517Sobrien      fi
46860517Sobrien    fi
46960517Sobrien
47033965Sjdp    case ${cpu_type}-${fmt} in
47138891Sjdp      alpha*-*)	bfd_gas=yes ;;
47233965Sjdp      arm-*)	bfd_gas=yes ;;
47333965Sjdp    # not yet
47433965Sjdp    # i386-aout)	bfd_gas=preferred ;;
47577310Sobrien      ia64*-*)	bfd_gas=yes ;;
47633965Sjdp      mips-*)	bfd_gas=yes ;;
47733965Sjdp      ns32k-*)	bfd_gas=yes ;;
47833965Sjdp      ppc-*)	bfd_gas=yes ;;
47933965Sjdp      sparc-*)	bfd_gas=yes ;;
48060517Sobrien      strongarm-*)	bfd_gas=yes ;;
48177310Sobrien      xscale-*)	bfd_gas=yes ;;
48233965Sjdp      *-elf)	bfd_gas=yes ;;
48333965Sjdp      *-ecoff)	bfd_gas=yes ;;
48433965Sjdp      *-som)	bfd_gas=yes ;;
48560517Sobrien    #enable bfd for coff and aout to allow testing if a bfd target is
48660517Sobrien    #the primary target, but not for coff or aout as the primary target
48760517Sobrien      i386-coff)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
48860517Sobrien      i386-aout)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
48933965Sjdp      *)		;;
49033965Sjdp    esac
49133965Sjdp
49233965Sjdp# Other random stuff.
49333965Sjdp
49460517Sobrien    # Do we need the opcodes library?
49533965Sjdp    case ${cpu_type} in
49638891Sjdp      vax | i386 | tic30)
49733965Sjdp	;;
49860517Sobrien
49933965Sjdp      *)
50033965Sjdp	need_opcodes=yes
50138891Sjdp
50238891Sjdp	case "${enable_shared}" in
50338891Sjdp	yes) shared_opcodes=true ;;
50438891Sjdp	*opcodes*) shared_opcodes=true ;;
50538891Sjdp	*) shared_opcodes=false ;;
50638891Sjdp	esac
50733965Sjdp	if test "${shared_opcodes}" = "true"; then
50833965Sjdp	  # A shared libopcodes must be linked against libbfd.
50933965Sjdp	  need_bfd=yes
51033965Sjdp	fi
51133965Sjdp	;;
51233965Sjdp    esac
51333965Sjdp
51460517Sobrien    # Any other special object files needed ?
51533965Sjdp    case ${cpu_type} in
51660517Sobrien      fr30 | m32r)
51760517Sobrien	using_cgen=yes
51833965Sjdp	;;
51933965Sjdp
52033965Sjdp      m68k)
52133965Sjdp	case ${extra_objects} in
52233965Sjdp	*m68k-parse.o*) ;;
52333965Sjdp	*) extra_objects="$extra_objects m68k-parse.o" ;;
52433965Sjdp	esac
52533965Sjdp	;;
52633965Sjdp
52733965Sjdp      mips)
52833965Sjdp	echo ${extra_objects} | grep -s "itbl-parse.o" 
52933965Sjdp	if test $? -ne 0 ; then
53033965Sjdp	  extra_objects="$extra_objects itbl-parse.o"
53133965Sjdp	fi
53233965Sjdp
53333965Sjdp	echo ${extra_objects} | grep -s "itbl-lex.o" 
53433965Sjdp	if test $? -ne 0 ; then
53533965Sjdp	  extra_objects="$extra_objects itbl-lex.o"
53633965Sjdp	fi
53733965Sjdp
53833965Sjdp	echo ${extra_objects} | grep -s "itbl-ops.o" 
53933965Sjdp	if test $? -ne 0 ; then
54033965Sjdp	  extra_objects="$extra_objects itbl-ops.o"
54133965Sjdp	fi
54233965Sjdp	;;
54333965Sjdp
54477310Sobrien      i386)
54577310Sobrien	if test $this_target = $target ; then
54677310Sobrien	  AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
54777310Sobrien	fi
54877310Sobrien	;;
54938891Sjdp      sparc)
55038891Sjdp	if test $this_target = $target ; then
55160517Sobrien	  AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
55238891Sjdp	fi
55338891Sjdp	;;
55433965Sjdp      *)
55533965Sjdp	;;
55633965Sjdp    esac
55733965Sjdp
55860517Sobrien    if test $using_cgen = yes ; then
55960517Sobrien	case "x${extra_objects}" in
56060517Sobrien	*cgen.o*) ;;
56160517Sobrien	*) extra_objects="$extra_objects cgen.o" ;;
56260517Sobrien	esac
56360517Sobrien    fi
56460517Sobrien
56533965Sjdp# See if we really can support this configuration with the emulation code.
56633965Sjdp
56733965Sjdp    if test $this_target = $target ; then
56833965Sjdp      primary_bfd_gas=$bfd_gas
56933965Sjdp      obj_format=$fmt
57033965Sjdp      te_file=$em
57133965Sjdp
57233965Sjdp      if test $bfd_gas = no ; then
57333965Sjdp	# Can't support other configurations this way.
57433965Sjdp	break
57533965Sjdp      fi
57633965Sjdp    elif test $bfd_gas = no ; then
57733965Sjdp      # Can't support this configuration.
57833965Sjdp      break
57933965Sjdp    fi
58033965Sjdp
58133965Sjdp# From target name and format, produce a list of supported emulations.
58233965Sjdp
58333965Sjdp    case ${generic_target}-${fmt} in
58433965Sjdp      mips-*-irix5*-*)	emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
58538891Sjdp      mips-*-linux-gnu*-*) case "$endian" in
58633965Sjdp			big)	emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
58733965Sjdp			*)	emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;;
58833965Sjdp			esac ;;
58933965Sjdp      mips-*-lnews*-ecoff) ;;
59033965Sjdp      mips-*-*-ecoff)	case "$endian" in
59133965Sjdp			big)	emulation="mipsbecoff mipslecoff mipsecoff" ;;
59233965Sjdp			*)	emulation="mipslecoff mipsbecoff mipsecoff" ;;
59333965Sjdp			esac ;;
59433965Sjdp      mips-*-*-elf)	case "$endian" in
59533965Sjdp			big)	emulation="mipsbelf mipslelf mipself" ;;
59633965Sjdp			*)	emulation="mipslelf mipsbelf mipself" ;;
59733965Sjdp			esac ;;
59877310Sobrien      mips-*-sysv4*MP*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
59977310Sobrien      # i386-pc-pe-coff != i386-pc-coff.
60077310Sobrien      i386-*-pe-coff)	;;
60160517Sobrien      # Uncommenting the next line will turn on support for i386 AOUT
60260517Sobrien      # for the default linux configuration
60360517Sobrien      # i386-*-linux*-elf) emulation="i386elf i386aout" ;;
60460517Sobrien      #
60560517Sobrien      i386-*-aout)	emulation="i386aout" ;;
60660517Sobrien      i386-*-coff)	emulation="i386coff" ;;
60760517Sobrien      i386-*-elf)	emulation="i386elf" ;;
60877310Sobrien
60977310Sobrien      # Always all formats.  The first stated emulation becomes the default.
61077310Sobrien      cris-*-*aout*)	emulation="crisaout criself" ;;
61177310Sobrien      cris-*-*)		emulation="criself crisaout" ;;
61233965Sjdp    esac
61333965Sjdp
61433965Sjdp    emulations="$emulations $emulation"
61533965Sjdp
61633965Sjdpdone
61733965Sjdp
61860517Sobrien# Turn on all targets if possible
61960517Sobrienif test ${all_targets} = "yes"; then
62060517Sobrien  case ${target_cpu_type} in
62160517Sobrien  i386)
62260517Sobrien    case ${obj_format} in
62360517Sobrien    aout)
62460517Sobrien      emulations="$emulations i386coff i386elf"
62560517Sobrien      ;;
62660517Sobrien    coff)
62760517Sobrien      emulations="$emulations i386aout i386elf"
62860517Sobrien    ;;
62960517Sobrien    elf)
63060517Sobrien      emulations="$emulations i386aout i386coff"
63160517Sobrien      ;;
63260517Sobrien    esac
63360517Sobrien  ;;
63460517Sobrien  esac
63560517Sobrienfi
63660517Sobrien
63733965Sjdp# Assign floating point type.  Most processors with FP support
63833965Sjdp# IEEE FP.  On those that don't support FP at all, usually IEEE
63933965Sjdp# is emulated.
64033965Sjdpcase ${target_cpu} in
64133965Sjdp  vax | tahoe )	atof=${target_cpu} ;;
64233965Sjdp  *)		atof=ieee ;;
64333965Sjdpesac
64433965Sjdp
64533965Sjdpcase "${obj_format}" in
64633965Sjdp  "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
64733965Sjdpesac
64833965Sjdp
64960517Sobrien# Unfortunately the cpu in cpu-opc.h file isn't always $(TARGET_CPU).
65060517Sobriencgen_cpu_prefix=""
65160517Sobrienif test $using_cgen = yes ; then
65260517Sobrien  case ${target_cpu} in
65360517Sobrien    *) cgen_cpu_prefix=${target_cpu} ;;
65460517Sobrien  esac
65560517Sobrien  AC_SUBST(cgen_cpu_prefix)
65660517Sobrien  AC_DEFINE(USING_CGEN, 1, [Using cgen code?])
65760517Sobrienfi
65860517Sobrien
65933965Sjdpdnl
66033965Sjdpdnl Make sure the desired support files exist.
66133965Sjdpdnl
66233965Sjdp
66333965Sjdpif test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
66433965Sjdp  AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
66533965Sjdpfi
66633965Sjdp
66733965Sjdpif test ! -r ${srcdir}/config/obj-${obj_format}.c; then
66833965Sjdp  AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
66933965Sjdpfi
67033965Sjdp
67133965Sjdpcase ${user_bfd_gas}-${primary_bfd_gas} in
67233965Sjdp  yes-yes | no-no)
67333965Sjdp    # We didn't override user's choice.
67433965Sjdp    ;;
67533965Sjdp  no-yes)
67633965Sjdp    AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
67733965Sjdp    ;;
67833965Sjdp  no-preferred)
67933965Sjdp    primary_bfd_gas=no
68033965Sjdp    ;;
68133965Sjdp  *-preferred)
68233965Sjdp    primary_bfd_gas=yes
68333965Sjdp    ;;
68433965Sjdp  yes-*)
68533965Sjdp    primary_bfd_gas=yes
68633965Sjdp    ;;
68733965Sjdp  -*)
68833965Sjdp    # User specified nothing.
68933965Sjdp    ;;
69033965Sjdpesac
69133965Sjdp
69233965Sjdp# Some COFF configurations want these random other flags set.
69333965Sjdpcase ${obj_format} in
69433965Sjdp  coff)
69533965Sjdp    case ${target_cpu_type} in
69660517Sobrien      i386) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;;
69760517Sobrien      m68k) AC_DEFINE(M68KCOFF, 1, [Using m68k COFF?]) ;;
69860517Sobrien      m88k) AC_DEFINE(M88KCOFF, 1, [Using m88k COFF?]) ;;
69933965Sjdp    esac
70033965Sjdp    ;;
70133965Sjdpesac
70233965Sjdp
70333965Sjdp# Getting this done right is going to be a bitch.  Each configuration specified
70433965Sjdp# with --enable-targets=... should be checked for environment, format, cpu, and
70533965Sjdp# bfd_gas setting.
70633965Sjdp#
70733965Sjdp# For each configuration, the necessary object file support code must be linked
70833965Sjdp# in.  This might be only one, it might be up to four.  The necessary emulation
70933965Sjdp# code needs to be provided, too.
71033965Sjdp#
71133965Sjdp# And then there's "--enable-targets=all"....
71233965Sjdp#
71333965Sjdp# For now, just always do it for MIPS ELF or ECOFF configurations.  Sigh.
71433965Sjdp
71533965Sjdpformats="${obj_format}"
71633965Sjdpemfiles=""
71733965SjdpEMULATIONS=""
71833965SjdpGAS_UNIQ(emulations)
71933965Sjdpfor em in . $emulations ; do
72033965Sjdp  case $em in
72133965Sjdp    .)	continue ;;
72233965Sjdp    mipsbelf | mipslelf)
72333965Sjdp	fmt=elf   file=mipself ;;
72433965Sjdp    mipsbecoff | mipslecoff)
72533965Sjdp	fmt=ecoff file=mipsecoff ;;
72677310Sobrien    *coff)
72777310Sobrien	fmt=coff  file=$em ;;
72877310Sobrien    *aout)
72977310Sobrien	fmt=aout file=$em ;;
73077310Sobrien    *elf)
73177310Sobrien	fmt=elf file=$em ;;
73233965Sjdp  esac
73333965Sjdp  formats="$formats $fmt"
73433965Sjdp  emfiles="$emfiles e-$file.o"
73533965Sjdp  EMULATIONS="$EMULATIONS &$em,"
73633965Sjdpdone
73733965SjdpGAS_UNIQ(formats)
73833965SjdpGAS_UNIQ(emfiles)
73933965Sjdpif test `set . $formats ; shift ; echo $#` -gt 1 ; then
74033965Sjdp  for fmt in $formats ; do
74133965Sjdp    case $fmt in
74260517Sobrien      aout)	AC_DEFINE(OBJ_MAYBE_AOUT, 1,    [a.out support?])   ;;
74360517Sobrien      bout)	AC_DEFINE(OBJ_MAYBE_BOUT, 1,    [b.out support?])   ;;
74460517Sobrien      coff)	AC_DEFINE(OBJ_MAYBE_COFF, 1,    [COFF support?])    ;;
74560517Sobrien      ecoff)	AC_DEFINE(OBJ_MAYBE_ECOFF, 1,   [ECOFF support?])   ;;
74660517Sobrien      elf)	AC_DEFINE(OBJ_MAYBE_ELF, 1,     [ELF support?])     ;;
74760517Sobrien      generic)	AC_DEFINE(OBJ_MAYBE_GENERIC, 1, [generic support?]) ;;
74860517Sobrien      hp300)	AC_DEFINE(OBJ_MAYBE_HP300, 1,   [HP300 support?])   ;;
74960517Sobrien      ieee)	AC_DEFINE(OBJ_MAYBE_IEEE, 1,    [IEEE support?])    ;;
75060517Sobrien      som)	AC_DEFINE(OBJ_MAYBE_SOM, 1,     [SOM support?])     ;;
75160517Sobrien      vms)	AC_DEFINE(OBJ_MAYBE_VMS, 1,     [VMS support?])     ;;
75233965Sjdp    esac
75333965Sjdp    extra_objects="$extra_objects obj-$fmt.o"
75433965Sjdp  done
75533965Sjdp  obj_format=multi
75633965Sjdpfi
75733965Sjdpif test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
75833965Sjdp  DEFAULT_EMULATION=`set . $emulations ; echo $2`
75960517Sobrien  # e-mips* has more than one emulation per file, e-i386* has just one at the
76060517Sobrien  # moment.  If only one emulation is specified, then don't define
76160517Sobrien  # USE_EMULATIONS or include any of the e-files as they will only be bloat.
76260517Sobrien  case "${obj_format}${emfiles}" in
76360517Sobrien    multi* | *mips*)
76460517Sobrien      extra_objects="$extra_objects $emfiles"
76560517Sobrien      AC_DEFINE(USE_EMULATIONS, 1, [Use emulation support?]) ;;
76660517Sobrien  esac
76733965Sjdpfi
76833965SjdpAC_SUBST(extra_objects)
76960517SobrienAC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS, [Supported emulations.])
77060517SobrienAC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION",
77160517Sobrien		   [Default emulation.])
77233965Sjdp
77333965Sjdpcase ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
77433965Sjdp  yes-*-coff)	need_bfd=yes ;;
77533965Sjdp  no-*-coff)	need_bfd=yes
77660517Sobrien		AC_DEFINE(MANY_SEGMENTS, 1, [old COFF support?]) ;;
77733965Sjdpesac
77833965Sjdp
77933965Sjdpreject_dev_configs=yes
78033965Sjdp
78133965Sjdpcase ${reject_dev_configs}-${dev} in
78233965Sjdp  yes-yes) # Oops.
78333965Sjdp    AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
78433965Sjdp    ;;
78533965Sjdpesac
78633965Sjdp
78733965SjdpAC_SUBST(target_cpu_type)
78833965SjdpAC_SUBST(obj_format)
78933965SjdpAC_SUBST(te_file)
79060517SobrienAC_SUBST(install_tooldir)
79133965SjdpAC_SUBST(atof)
79233965Sjdpdnl AC_SUBST(emulation)
79333965Sjdp
79433965Sjdpcase "${primary_bfd_gas}" in
79560517Sobrien  yes)	AC_DEFINE(BFD_ASSEMBLER, 1, [Use BFD interface?])
79633965Sjdp	need_bfd=yes ;;
79733965Sjdpesac
79833965Sjdp
79933965Sjdp# do we need the opcodes library?
80033965Sjdpcase "${need_opcodes}" in
80133965Sjdpyes)
80238891Sjdp  OPCODES_LIB=../opcodes/libopcodes.la
80333965Sjdp  ;;
80433965Sjdpesac
80533965Sjdp
80633965Sjdpcase "${need_bfd}" in
80733965Sjdpyes)
80838891Sjdp  BFDLIB=../bfd/libbfd.la
80933965Sjdp  ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
81033965Sjdp  ;;
81133965Sjdpesac
81233965Sjdp
81333965SjdpAC_SUBST(BFDLIB)
81433965SjdpAC_SUBST(OPCODES_LIB)
81533965Sjdp
81633965SjdpAC_SUBST(ALL_OBJ_DEPS)
81733965Sjdp
81860517SobrienAC_DEFINE_UNQUOTED(TARGET_ALIAS,	"${target_alias}", [Target alias.])
81960517SobrienAC_DEFINE_UNQUOTED(TARGET_CANONICAL,	"${target}",       [Canonical target.])
82060517SobrienAC_DEFINE_UNQUOTED(TARGET_CPU,		"${target_cpu}",   [Target CPU.])
82160517SobrienAC_DEFINE_UNQUOTED(TARGET_VENDOR,	"${target_vendor}", [Target vendor.])
82260517SobrienAC_DEFINE_UNQUOTED(TARGET_OS,		"${target_os}",    [Target OS.])
82333965Sjdp
82433965SjdpAC_PROG_CC
82533965Sjdp
82638891SjdpAC_PROG_YACC
82760517SobrienAM_PROG_LEX
82838891Sjdp
82960517SobrienALL_LINGUAS=
83060517SobrienCY_GNU_GETTEXT
83160517Sobrien
83238891SjdpAM_MAINTAINER_MODE
83360517SobrienAC_EXEEXT
83438891Sjdp
83533965SjdpAC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
83633965Sjdp
83733965Sjdp# Put this here so that autoconf's "cross-compiling" message doesn't confuse
83833965Sjdp# people who are not cross-compiling but are compiling cross-assemblers.
83933965SjdpAC_MSG_CHECKING(whether compiling a cross-assembler)
84033965Sjdpif test "${host}" = "${target}"; then
84133965Sjdp  cross_gas=no
84233965Sjdpelse
84333965Sjdp  cross_gas=yes
84460517Sobrien  AC_DEFINE(CROSS_COMPILE, 1, [Compiling cross-assembler?])
84533965Sjdpfi
84633965SjdpAC_MSG_RESULT($cross_gas)
84733965Sjdp
84833965Sjdpdnl ansidecl.h will deal with const
84933965Sjdpdnl AC_CONST
85033965SjdpAC_FUNC_ALLOCA
85133965SjdpAC_C_INLINE
85233965Sjdp
85333965Sjdp# VMS doesn't have unlink.
85433965SjdpAC_CHECK_FUNCS(unlink remove, break)
85533965Sjdp
85633965Sjdp# Some systems don't have sbrk().
85733965SjdpAC_CHECK_FUNCS(sbrk)
85833965Sjdp
85977310Sobrien# do we need the math library?
86077310Sobriencase "${need_libm}" in
86177310Sobrienyes) 
86277310Sobrien  AC_CHECK_LIBM
86377310Sobrien  AC_SUBST(LIBM)
86477310Sobrien  ;;
86577310Sobrienesac
86677310Sobrien
86733965Sjdp# Some non-ANSI preprocessors botch requoting inside strings.  That's bad
86833965Sjdp# enough, but on some of those systems, the assert macro relies on requoting
86933965Sjdp# working properly!
87033965SjdpGAS_WORKING_ASSERT
87133965Sjdp
87233965Sjdp# On some systems, the system header files may not declare malloc, realloc,
87333965Sjdp# and free.  There are places where gas needs these functions to have been
87433965Sjdp# declared -- such as when taking their addresses.
87533965Sjdpgas_test_headers="
87633965Sjdp#ifdef HAVE_MEMORY_H
87733965Sjdp#include <memory.h>
87833965Sjdp#endif
87933965Sjdp#ifdef HAVE_STRING_H
88033965Sjdp#include <string.h>
88133965Sjdp#else
88233965Sjdp#ifdef HAVE_STRINGS_H
88333965Sjdp#include <strings.h>
88433965Sjdp#endif
88533965Sjdp#endif
88633965Sjdp#ifdef HAVE_STDLIB_H
88733965Sjdp#include <stdlib.h>
88833965Sjdp#endif
88933965Sjdp#ifdef HAVE_UNISTD_H
89033965Sjdp#include <unistd.h>
89133965Sjdp#endif
89233965Sjdp"
89333965SjdpGAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
89433965SjdpGAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
89533965SjdpGAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
89633965SjdpGAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
89760517SobrienGAS_CHECK_DECL_NEEDED(environ, f, char **f, $gas_test_headers)
89833965Sjdp
89933965Sjdp# Does errno.h declare errno, or do we have to add a separate declaration
90033965Sjdp# for it?
90133965SjdpGAS_CHECK_DECL_NEEDED(errno, f, int f, [
90233965Sjdp#ifdef HAVE_ERRNO_H
90333965Sjdp#include <errno.h>
90433965Sjdp#endif
90533965Sjdp])
90633965Sjdp
90733965Sjdpdnl This must come last.
90833965Sjdp
90933965Sjdpdnl We used to make symlinks to files in the source directory, but now
91033965Sjdpdnl we just use the right name for .c files, and create .h files in
91133965Sjdpdnl the build directory which include the right .h file.  Make sure
91233965Sjdpdnl the old symlinks don't exist, so that a reconfigure in an existing
91333965Sjdpdnl directory behaves reasonably.
91433965Sjdp
91560517SobrienAC_OUTPUT(Makefile doc/Makefile ${GDBINIT}:gdbinit.in po/Makefile.in:po/Make-in,
91633965Sjdp[rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
91733965Sjdp echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
91833965Sjdp echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
91933965Sjdp echo '#include "te-'"${te_file}"'.h"' > targ-env.h
92033965Sjdp echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
92160517Sobrien if test "x$cgen_cpu_prefix" != x ; then
92260517Sobrien   echo '#include "opcodes/'"${cgen_cpu_prefix}"'-desc.h"' > cgen-desc.h
92360517Sobrien fi
92460517Sobrien
92560517Sobrien sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile],
92633965Sjdp[target_cpu_type=${target_cpu_type}
92760517Sobrien cgen_cpu_prefix=${cgen_cpu_prefix}
92833965Sjdp obj_format=${obj_format}
92933965Sjdp te_file=${te_file}])
930