configure.in revision 38891
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
633965Sjdpdnl
738891Sjdpdnl v2.5 needed for --bindir et al
838891SjdpAC_PREREQ(2.5)
938891SjdpAC_INIT(as.h)
1038891Sjdp
1138891SjdpAC_CANONICAL_SYSTEM
1238891Sjdp
1338891SjdpAM_INIT_AUTOMAKE(gas, 2.9.1)
1438891Sjdp
1538891SjdpAM_PROG_LIBTOOL
1638891Sjdp
1733965Sjdpuser_bfd_gas=
1833965SjdpAC_ARG_ENABLE(bfd-assembler,
1933965Sjdp[  --enable-bfd-assembler  use BFD back end for writing object files],
2033965Sjdp[case "${enableval}" in
2133965Sjdp  yes) need_bfd=yes user_bfd_gas=yes ;;
2233965Sjdp  no)  user_bfd_gas=no ;;
2333965Sjdp  *)   AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;;
2433965Sjdpesac])dnl
2533965SjdpAC_ARG_ENABLE(targets,
2633965Sjdp[    targets            alternative target configurations besides the primary],
2733965Sjdp[case "${enableval}" in
2833965Sjdp  yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
2933965Sjdp	    ;;
3033965Sjdp  no)	    enable_targets= ;;
3133965Sjdp  *)	    enable_targets=$enableval ;;
3233965Sjdpesac])dnl
3333965SjdpAC_ARG_ENABLE(commonbfdlib,
3433965Sjdp[  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
3533965Sjdp[case "${enableval}" in
3633965Sjdp  yes) commonbfdlib=true ;;
3733965Sjdp  no)  commonbfdlib=false ;;
3833965Sjdp  *)   AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
3933965Sjdpesac])dnl
4033965Sjdp
4138891Sjdp# Generate a header file
4238891SjdpAM_CONFIG_HEADER(config.h:config.in)
4333965Sjdp
4433965Sjdpte_file=generic
4533965Sjdp
4633965Sjdpcanon_targets=""
4733965Sjdpif test -n "$enable_targets" ; then
4833965Sjdp  for t in `echo $enable_targets | sed 's/,/ /g'`; do
4933965Sjdp    result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $t 2>/dev/null`
5033965Sjdp    if test -n "$result" ; then
5133965Sjdp      canon_targets="$canon_targets $result"
5233965Sjdp#    else
5333965Sjdp#      # Permit "all", etc.  We don't support it yet though.
5433965Sjdp#      canon_targets="$canon_targets $t"
5533965Sjdp    fi
5633965Sjdp  done
5733965Sjdp  GAS_UNIQ(canon_targets)
5833965Sjdpfi
5933965Sjdp
6033965Sjdpemulations=""
6133965Sjdp
6233965Sjdpfor this_target in $target $canon_targets ; do
6333965Sjdp
6433965Sjdpchangequote(,)dnl
6533965Sjdp    eval `echo $this_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'`
6633965Sjdpchangequote([,])dnl
6733965Sjdp
6833965Sjdp    # check for architecture variants
6938891Sjdp    arch=
7038891Sjdp    endian=
7133965Sjdp    case ${cpu} in
7238891Sjdp      alpha*)		cpu_type=alpha ;;
7333965Sjdp      armeb)		cpu_type=arm endian=big ;;
7433965Sjdp      arm*)		cpu_type=arm endian=little ;;
7538891Sjdp      thumb*)		cpu_type=arm endian=little ;;
7633965Sjdp      hppa*)		cpu_type=hppa ;;
7733965Sjdpchangequote(,)dnl
7833965Sjdp      i[456]86)		cpu_type=i386 ;;
7933965Sjdp      m680[012346]0)	cpu_type=m68k ;;
8033965Sjdp      m68008)		cpu_type=m68k ;;
8133965Sjdp      m683??)		cpu_type=m68k ;;
8233965Sjdpchangequote([,])dnl
8333965Sjdp      m8*)		cpu_type=m88k ;;
8433965Sjdp      mips*el)		cpu_type=mips endian=little ;;
8533965Sjdp      mips*)		cpu_type=mips endian=big ;;
8633965Sjdp      powerpcle*)	cpu_type=ppc endian=little ;;
8733965Sjdp      powerpc*)		cpu_type=ppc endian=big ;;
8833965Sjdp      rs6000*)		cpu_type=ppc ;;
8938891Sjdp      sparclite*)	cpu_type=sparc arch=sparclite ;;
9038891Sjdp      sparclet*)	cpu_type=sparc arch=sparclet ;;
9138891Sjdp      sparc64*)		cpu_type=sparc arch=v9-64 ;;
9238891Sjdp      sparc*)		cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
9338891Sjdp      v850*)		cpu_type=v850 ;;
9433965Sjdp      *)		cpu_type=${cpu} ;;
9533965Sjdp    esac
9633965Sjdp
9733965Sjdp    if test ${this_target} = $target ; then
9833965Sjdp      target_cpu_type=${cpu_type}
9938891Sjdp      if test x${endian} = xbig; then
10038891Sjdp	AC_DEFINE(TARGET_BYTES_BIG_ENDIAN, 1)
10138891Sjdp      elif test x${endian} = xlittle; then
10238891Sjdp	AC_DEFINE(TARGET_BYTES_BIG_ENDIAN, 0)
10338891Sjdp      fi
10433965Sjdp    elif test ${target_cpu_type} != ${cpu_type} ; then
10533965Sjdp      continue
10633965Sjdp    fi
10733965Sjdp
10833965Sjdp    generic_target=${cpu_type}-$vendor-$os
10933965Sjdp    dev=no
11033965Sjdp    bfd_gas=no
11133965Sjdp    em=generic
11233965Sjdp
11333965Sjdp    # assign object format
11433965Sjdp    case ${generic_target} in
11538891Sjdp      a29k-*-coff)          fmt=coff ;;
11638891Sjdp      a29k-amd-udi)         fmt=coff ;;
11738891Sjdp      a29k-amd-ebmon)       fmt=coff ;;
11838891Sjdp      a29k-nyu-sym1)        fmt=coff ;;
11933965Sjdp      a29k-*-vxworks*)      fmt=coff ;;
12033965Sjdp
12138891Sjdp      alpha*-*-*vms*)	    fmt=evax ;;
12238891Sjdp      alpha*-*-netware*)    fmt=ecoff ;;
12338891Sjdp      alpha*-*-openbsd*)    fmt=ecoff ;;
12438891Sjdp      alpha*-*-osf*)        fmt=ecoff ;;
12538891Sjdp      alpha*-*-linuxecoff*) fmt=ecoff ;;
12638891Sjdp      alpha*-*-linux-gnu*)  fmt=elf em=linux ;;
12738891Sjdp      alpha*-*-netbsd*)     fmt=elf em=nbsd ;;
12833965Sjdp
12938891Sjdp      arc-*-elf*)           fmt=elf bfd_gas=yes ;;
13033965Sjdp
13138891Sjdp      arm-*-riscix*)	    fmt=aout em=riscix ;;
13238891Sjdp      arm-*-aout)	    fmt=aout ;;
13338891Sjdp      arm-*-coff | thumb-*-coff)           fmt=coff ;;
13433965Sjdp      arm-*-riscix*)        fmt=aout ;;
13538891Sjdp      arm-*-pe | thumb-*-pe)               fmt=coff em=pe ;;
13633965Sjdp
13733965Sjdp      d10v-*-*)		    fmt=elf bfd_gas=yes ;;
13833965Sjdp
13933965Sjdp      hppa-*-*elf*)         fmt=elf em=hppa ;;
14033965Sjdp      hppa-*-lites*)        fmt=elf em=hppa ;;
14133965Sjdp      hppa-*-osf*)          fmt=som em=hppa ;;
14233965Sjdp      hppa-*-rtems*)        fmt=elf em=hppa ;;
14333965Sjdp      hppa-*-hpux*)         fmt=som em=hppa ;;
14433965Sjdp      hppa-*-bsd*)          fmt=som em=hppa ;;
14533965Sjdp      hppa-*-hiux*)         fmt=som em=hppa ;;
14633965Sjdp
14733965Sjdp      h8300-*-coff)         fmt=coff ;;
14833965Sjdp
14938891Sjdp      i386-ibm-aix*)        fmt=coff em=i386aix ;;
15033965Sjdp      i386-sequent-bsd*)    fmt=aout em=dynix bfd_gas=yes ;;
15133965Sjdp      i386-*-bsd*)          fmt=aout em=386bsd ;;
15233965Sjdp      i386-*-netbsd0.8)     fmt=aout em=386bsd ;;
15333965Sjdp      i386-*-netbsd*)       fmt=aout em=nbsd bfd_gas=yes;;
15433965Sjdp      i386-*-openbsd*)      fmt=aout em=nbsd bfd_gas=yes;;
15533965Sjdp      i386-*-linux*aout* | i386-*-linuxoldld)   fmt=aout em=linux ;;
15638891Sjdp      i386-*-linux*coff*)   fmt=coff em=linux ;;
15738891Sjdp      i386-*-linux-gnu*)    fmt=elf em=linux ;;
15838891Sjdp      i386-*-lynxos*)       fmt=coff em=lynx ;;
15933973Sjdp      i386-*-sysv4* | i386-*-solaris* | i386-*-elf)
16033965Sjdp			    fmt=elf ;;
16138891Sjdp      i386-*-freebsdelf*)   fmt=elf em=freebsd;;
16233973Sjdp      i386-*-freebsd*)      fmt=aout em=freebsd bfd_gas=yes ;;
16338891Sjdp      i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*)
16438891Sjdp                          fmt=coff ;;
16538891Sjdp      i386-*-sco3.2v5*)      fmt=elf
16638891Sjdp			    if test ${this_target} = $target; then
16738891Sjdp				AC_DEFINE(SCO_ELF)
16838891Sjdp			    fi
16938891Sjdp			    ;;
17038891Sjdp      i386-*-sco3.2*)       fmt=coff ;;
17133965Sjdp      i386-*-vsta)          fmt=aout ;;
17238891Sjdp      i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*)
17338891Sjdp			    fmt=coff em=go32;;
17438891Sjdp      i386-*-rtems*)        fmt=coff ;;
17533965Sjdp      i386-*-gnu*)          fmt=elf ;;
17633965Sjdp      i386-*-mach*)
17733965Sjdp			    fmt=aout em=mach bfd_gas=yes ;;
17833965Sjdp      i386-*-msdos*)        fmt=aout ;;
17933965Sjdp      i386-*-moss*)	    fmt=elf ;;
18038891Sjdp      i386-*-pe)            fmt=coff em=pe ;;
18138891Sjdp      i386-*-cygwin32*)     fmt=coff em=pe bfd_gas=yes ;;
18238891Sjdp      i386-*-mingw32*)      fmt=coff em=pe bfd_gas=yes ;;
18338891Sjdp      i386-*-*nt*)          fmt=coff em=pe ;;
18433965Sjdp      i960-*-bout)          fmt=bout ;;
18538891Sjdp      i960-*-coff)          fmt=coff em=ic960 ;;
18638891Sjdp      i960-*-rtems*)        fmt=coff em=ic960 ;;
18733965Sjdp      i960-*-nindy*)        fmt=bout ;;
18833965Sjdp      i960-*-vxworks4*)     fmt=bout ;;
18933965Sjdp      i960-*-vxworks5.0)    fmt=bout ;;
19038891Sjdp      i960-*-vxworks5.*)    fmt=coff em=ic960 ;;
19133965Sjdp      i960-*-vxworks*)      fmt=bout ;;
19233965Sjdp
19333965Sjdp      m32r-*-*)		    fmt=elf bfd_gas=yes ;;
19433965Sjdp
19533965Sjdp      m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
19633965Sjdp			    fmt=aout em=sun3 ;;
19738891Sjdp      m68k-motorola-sysv*)  fmt=coff em=delta ;;
19838891Sjdp      m68k-bull-sysv3*)     fmt=coff em=dpx2 ;;
19938891Sjdp      m68k-apollo-*)        fmt=coff em=apollo ;;
20033965Sjdp      m68k-*-sysv4*) # must be before -sysv*
20133965Sjdp			    fmt=elf em=svr4 ;;
20233965Sjdp      m68k-*-elf*)	    fmt=elf ;;
20333965Sjdp      m68k-*-coff | m68k-*-sysv* | m68k-*-rtems*)
20438891Sjdp			    fmt=coff ;;
20533965Sjdp      m68k-*-hpux*)         fmt=hp300 em=hp300 ;;
20633965Sjdp      m68k-*-linux*aout*)   fmt=aout em=linux ;;
20738891Sjdp      m68k-*-linux-gnu*)    fmt=elf em=linux ;;
20838891Sjdp      m68k-*-lynxos*)       fmt=coff em=lynx ;;
20933965Sjdp      m68k-*-netbsd*)       fmt=aout em=nbsd bfd_gas=yes ;;
21033965Sjdp      m68k-*-openbsd*)      fmt=aout em=nbsd bfd_gas=yes ;;
21138891Sjdp      m68k-apple-aux*)      fmt=coff em=aux ;;
21233965Sjdp      m68k-*-psos*)         fmt=elf em=psos;;
21333965Sjdp
21438891Sjdp      m88k-motorola-sysv3*) fmt=coff em=delt88 ;;
21538891Sjdp      m88k-*-coff*)         fmt=coff ;;
21633965Sjdp
21733965Sjdp      # don't change em like *-*-bsd does
21838891Sjdp      mips-dec-netbsd*)	    fmt=elf endian=little ;;
21938891Sjdp      mips-dec-openbsd*)    fmt=elf endian=little ;;
22038891Sjdp      mips-dec-bsd*)        fmt=aout ;;
22138891Sjdp      mips-sony-bsd*)       fmt=ecoff ;;
22233965Sjdp      mips-*-bsd*)          AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
22338891Sjdp      mips-*-ultrix*)       fmt=ecoff endian=little ;;
22438891Sjdp      mips-*-osf*)          fmt=ecoff endian=little ;;
22538891Sjdp      mips-*-ecoff*)        fmt=ecoff ;;
22638891Sjdp      mips-*-ecoff*)        fmt=ecoff ;;
22738891Sjdp      mips-*-irix6*)	    fmt=elf ;;
22838891Sjdp      mips-*-irix5*)        fmt=elf ;;
22938891Sjdp      mips-*-irix*)         fmt=ecoff ;;
23038891Sjdp      mips-*-lnews*)        fmt=ecoff em=lnews ;;
23138891Sjdp      mips-*-riscos*)       fmt=ecoff ;;
23238891Sjdp      mips-*-sysv*)         fmt=ecoff ;;
23338891Sjdp      mips-*-elf* | mips-*-rtems* | mips-*-linux-gnu* | mips-*-gnu* | mips-*-openbsd*)
23438891Sjdp			    fmt=elf ;;
23533965Sjdp      mn10200-*-*)	    fmt=elf bfd_gas=yes ;;
23633965Sjdp      mn10300-*-*)	    fmt=elf bfd_gas=yes ;;
23733965Sjdp      ppc-*-pe | ppc-*-cygwin32 | ppc-*-winnt*)
23838891Sjdp		            fmt=coff em=pe ;;
23933965Sjdp      ppc-*-aix*)           fmt=coff ;;
24033965Sjdp      ppc-*-beos*)          fmt=coff ;;
24133965Sjdp      ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
24238891Sjdp			    fmt=elf ;;
24338891Sjdp      ppc-*-linux-gnu*)	    fmt=elf
24433965Sjdp			    case "$endian" in
24538891Sjdp			    big)  ;;
24638891Sjdp			    *)    AC_MSG_ERROR(GNU/Linux must be configured big endian) ;;
24733965Sjdp			    esac
24833965Sjdp			    ;;
24933965Sjdp      ppc-*-solaris*)	    fmt=elf
25038891Sjdp			    if test ${this_target} = $target; then
25138891Sjdp				AC_DEFINE(TARGET_SOLARIS_COMMENT)
25238891Sjdp			    fi
25338891Sjdp			    if test x${endian} = xbig; then
25438891Sjdp				AC_MSG_ERROR(Solaris must be configured little endian)
25538891Sjdp			    fi
25633965Sjdp			    ;;
25738891Sjdp      ppc-*-rtems*)	    fmt=elf ;;
25833965Sjdp      ppc-*-macos* | ppc-*-mpw*)
25933965Sjdp			    fmt=coff em=macos ;;
26033965Sjdp      ppc-*-netware*)       fmt=elf em=ppcnw ;;
26133965Sjdp
26233965Sjdp      sh-*-elf*)	    fmt=elf ;;
26333965Sjdp      sh-*-coff*)           fmt=coff ;;
26438891Sjdp      sh-*-rtems*)	    fmt=coff ;;
26533965Sjdp
26633965Sjdp      ns32k-pc532-mach* | ns32k-pc532-ux*)    fmt=aout em=pc532mach ;;
26733965Sjdp      ns32k-pc532-netbsd* | ns32k-pc532-lites*)  fmt=aout em=nbsd532 ;;
26833965Sjdp      ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;
26933965Sjdp
27033965Sjdp      sparc-*-rtems*)       fmt=aout ;;
27133965Sjdp      sparc-*-sunos4*)      fmt=aout em=sun3 ;;
27233965Sjdp      sparc-*-aout | sparc*-*-vxworks*)
27333965Sjdp			    fmt=aout em=sparcaout ;;
27433965Sjdp      sparc-*-coff)         fmt=coff ;;
27533965Sjdp      sparc-*-linux*aout*)  fmt=aout em=linux ;;
27638891Sjdp      sparc-*-linux-gnu*)   fmt=elf em=linux ;;
27733965Sjdp      sparc-*-lynxos*)      fmt=coff em=lynx ;;
27833965Sjdp      sparc-fujitsu-none)   fmt=aout ;;
27933965Sjdp      sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*)
28033965Sjdp			    fmt=elf ;;
28133965Sjdp      sparc-*-netbsd*)      fmt=aout em=nbsd bfd_gas=yes ;;
28233965Sjdp      sparc-*-openbsd*)     fmt=aout em=nbsd bfd_gas=yes ;;
28333965Sjdp
28438891Sjdp      tic30-*-*aout*)	    fmt=aout bfd_gas=yes ;;
28538891Sjdp      tic30-*-*coff*)       fmt=coff bfd_gas=yes ;;
28638891Sjdp
28738891Sjdp
28838891Sjdp      v850-*-*)		    fmt=elf bfd_gas=yes ;;
28938891Sjdp
29033965Sjdp      vax-*-bsd* | vax-*-ultrix*)
29133965Sjdp			    fmt=aout ;;
29233965Sjdp      vax-*-vms)            fmt=vms ;;
29333965Sjdp
29433965Sjdp      z8k-*-coff | z8k-*-sim)
29533965Sjdp			    fmt=coff ;;
29633965Sjdp
29733965Sjdp      w65-*-*)              fmt=coff ;;
29833965Sjdp
29933965Sjdp      *-*-aout | *-*-scout)
30033965Sjdp			    fmt=aout ;;
30133965Sjdp      *-*-nindy*)
30233965Sjdp			    fmt=bout ;;
30333965Sjdp      *-*-bsd*)
30433965Sjdp			    fmt=aout em=sun3 ;;
30533965Sjdp      *-*-generic)          fmt=generic ;;
30633965Sjdp      *-*-xray | *-*-hms)   fmt=coff ;;
30733965Sjdp      *-*-sim)              fmt=coff ;;
30833965Sjdp      *-*-elf | *-*-sysv4* | *-*-solaris*)
30933965Sjdp			    AC_MSG_WARN(GAS support for ${generic_target} is incomplete.)
31033965Sjdp			    fmt=elf dev=yes ;;
31133965Sjdp      *-*-vxworks)          fmt=aout ;;
31233965Sjdp      *-*-netware)          fmt=elf ;;
31333965Sjdp    esac
31433965Sjdp
31533965Sjdp    case ${cpu_type}-${fmt} in
31638891Sjdp      alpha*-*)	bfd_gas=yes ;;
31733965Sjdp      arm-*)	bfd_gas=yes ;;
31833965Sjdp    # not yet
31933965Sjdp    # i386-aout)	bfd_gas=preferred ;;
32033965Sjdp      mips-*)	bfd_gas=yes ;;
32133965Sjdp      ns32k-*)	bfd_gas=yes ;;
32233965Sjdp      ppc-*)	bfd_gas=yes ;;
32333965Sjdp      sparc-*)	bfd_gas=yes ;;
32433965Sjdp      *-elf)	bfd_gas=yes ;;
32533965Sjdp      *-ecoff)	bfd_gas=yes ;;
32633965Sjdp      *-som)	bfd_gas=yes ;;
32733965Sjdp      *)		;;
32833965Sjdp    esac
32933965Sjdp
33033965Sjdp# Other random stuff.
33133965Sjdp
33233965Sjdp    # do we need the opcodes library?
33333965Sjdp    case ${cpu_type} in
33438891Sjdp      vax | i386 | tic30)
33533965Sjdp	;;
33633965Sjdp      *)
33733965Sjdp	need_opcodes=yes
33838891Sjdp
33938891Sjdp	case "${enable_shared}" in
34038891Sjdp	yes) shared_opcodes=true ;;
34138891Sjdp	*opcodes*) shared_opcodes=true ;;
34238891Sjdp	*) shared_opcodes=false ;;
34338891Sjdp	esac
34433965Sjdp	if test "${shared_opcodes}" = "true"; then
34533965Sjdp	  # A shared libopcodes must be linked against libbfd.
34633965Sjdp	  need_bfd=yes
34733965Sjdp	fi
34833965Sjdp	;;
34933965Sjdp    esac
35033965Sjdp
35133965Sjdp    case ${cpu_type} in
35233965Sjdp      m32r)
35333965Sjdp	case ${extra_objects} in
35433965Sjdp	*cgen.o*) ;;
35533965Sjdp	*) extra_objects="$extra_objects cgen.o"
35633965Sjdp	   AC_DEFINE(USING_CGEN)
35733965Sjdp	   ;;
35833965Sjdp	esac
35933965Sjdp	;;
36033965Sjdp
36133965Sjdp      m68k)
36233965Sjdp	case ${extra_objects} in
36333965Sjdp	*m68k-parse.o*) ;;
36433965Sjdp	*) extra_objects="$extra_objects m68k-parse.o" ;;
36533965Sjdp	esac
36633965Sjdp	;;
36733965Sjdp
36833965Sjdp      mips)
36933965Sjdp	echo ${extra_objects} | grep -s "itbl-parse.o" 
37033965Sjdp	if test $? -ne 0 ; then
37133965Sjdp	  extra_objects="$extra_objects itbl-parse.o"
37233965Sjdp	fi
37333965Sjdp
37433965Sjdp	echo ${extra_objects} | grep -s "itbl-lex.o" 
37533965Sjdp	if test $? -ne 0 ; then
37633965Sjdp	  extra_objects="$extra_objects itbl-lex.o"
37733965Sjdp	fi
37833965Sjdp
37933965Sjdp	echo ${extra_objects} | grep -s "itbl-ops.o" 
38033965Sjdp	if test $? -ne 0 ; then
38133965Sjdp	  extra_objects="$extra_objects itbl-ops.o"
38233965Sjdp	fi
38333965Sjdp	;;
38433965Sjdp
38538891Sjdp      sparc)
38638891Sjdp	if test $this_target = $target ; then
38738891Sjdp	  AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}")
38838891Sjdp	fi
38938891Sjdp	;;
39038891Sjdp
39133965Sjdp      *)
39233965Sjdp	;;
39333965Sjdp    esac
39433965Sjdp
39533965Sjdp# See if we really can support this configuration with the emulation code.
39633965Sjdp
39733965Sjdp    if test $this_target = $target ; then
39833965Sjdp      primary_bfd_gas=$bfd_gas
39933965Sjdp      obj_format=$fmt
40033965Sjdp      te_file=$em
40133965Sjdp
40233965Sjdp      if test $bfd_gas = no ; then
40333965Sjdp	# Can't support other configurations this way.
40433965Sjdp	break
40533965Sjdp      fi
40633965Sjdp    elif test $bfd_gas = no ; then
40733965Sjdp      # Can't support this configuration.
40833965Sjdp      break
40933965Sjdp    fi
41033965Sjdp
41133965Sjdp# From target name and format, produce a list of supported emulations.
41233965Sjdp
41333965Sjdp    case ${generic_target}-${fmt} in
41433965Sjdp      mips-*-irix5*-*)	emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
41538891Sjdp      mips-*-linux-gnu*-*) case "$endian" in
41633965Sjdp			big)	emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
41733965Sjdp			*)	emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;;
41833965Sjdp			esac ;;
41933965Sjdp      mips-*-lnews*-ecoff) ;;
42033965Sjdp      mips-*-*-ecoff)	case "$endian" in
42133965Sjdp			big)	emulation="mipsbecoff mipslecoff mipsecoff" ;;
42233965Sjdp			*)	emulation="mipslecoff mipsbecoff mipsecoff" ;;
42333965Sjdp			esac ;;
42433965Sjdp      mips-*-*-elf)	case "$endian" in
42533965Sjdp			big)	emulation="mipsbelf mipslelf mipself" ;;
42633965Sjdp			*)	emulation="mipslelf mipsbelf mipself" ;;
42733965Sjdp      # Uncommenting the next line will turn on support for i386 COFF
42833965Sjdp      # in any i386 ELF configuration.  This probably doesn't work
42933965Sjdp      # correctly.
43033965Sjdp      # i386-*-*-elf)	emulation="i386coff i386elf" ;;
43133965Sjdp			esac ;;
43233965Sjdp    esac
43333965Sjdp
43433965Sjdp    emulations="$emulations $emulation"
43533965Sjdp
43633965Sjdpdone
43733965Sjdp
43833965Sjdp# Assign floating point type.  Most processors with FP support
43933965Sjdp# IEEE FP.  On those that don't support FP at all, usually IEEE
44033965Sjdp# is emulated.
44133965Sjdpcase ${target_cpu} in
44233965Sjdp  vax | tahoe )	atof=${target_cpu} ;;
44333965Sjdp  *)		atof=ieee ;;
44433965Sjdpesac
44533965Sjdp
44633965Sjdpcase "${obj_format}" in
44733965Sjdp  "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
44833965Sjdpesac
44933965Sjdp
45033965Sjdpdnl
45133965Sjdpdnl Make sure the desired support files exist.
45233965Sjdpdnl
45333965Sjdp
45433965Sjdpif test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
45533965Sjdp  AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
45633965Sjdpfi
45733965Sjdp
45833965Sjdpif test ! -r ${srcdir}/config/obj-${obj_format}.c; then
45933965Sjdp  AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
46033965Sjdpfi
46133965Sjdp
46233965Sjdpcase ${user_bfd_gas}-${primary_bfd_gas} in
46333965Sjdp  yes-yes | no-no)
46433965Sjdp    # We didn't override user's choice.
46533965Sjdp    ;;
46633965Sjdp  no-yes)
46733965Sjdp    AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
46833965Sjdp    ;;
46933965Sjdp  no-preferred)
47033965Sjdp    primary_bfd_gas=no
47133965Sjdp    ;;
47233965Sjdp  *-preferred)
47333965Sjdp    primary_bfd_gas=yes
47433965Sjdp    ;;
47533965Sjdp  yes-*)
47633965Sjdp    primary_bfd_gas=yes
47733965Sjdp    ;;
47833965Sjdp  -*)
47933965Sjdp    # User specified nothing.
48033965Sjdp    ;;
48133965Sjdpesac
48233965Sjdp
48333965Sjdp# Some COFF configurations want these random other flags set.
48433965Sjdpcase ${obj_format} in
48533965Sjdp  coff)
48633965Sjdp    case ${target_cpu_type} in
48733965Sjdp      i386) AC_DEFINE(I386COFF) ;;
48833965Sjdp      m68k) AC_DEFINE(M68KCOFF) ;;
48933965Sjdp      m88k) AC_DEFINE(M88KCOFF) ;;
49033965Sjdp    esac
49133965Sjdp    ;;
49233965Sjdpesac
49333965Sjdp
49433965Sjdp# Getting this done right is going to be a bitch.  Each configuration specified
49533965Sjdp# with --enable-targets=... should be checked for environment, format, cpu, and
49633965Sjdp# bfd_gas setting.
49733965Sjdp#
49833965Sjdp# For each configuration, the necessary object file support code must be linked
49933965Sjdp# in.  This might be only one, it might be up to four.  The necessary emulation
50033965Sjdp# code needs to be provided, too.
50133965Sjdp#
50233965Sjdp# And then there's "--enable-targets=all"....
50333965Sjdp#
50433965Sjdp# For now, just always do it for MIPS ELF or ECOFF configurations.  Sigh.
50533965Sjdp
50633965Sjdpformats="${obj_format}"
50733965Sjdpemfiles=""
50833965SjdpEMULATIONS=""
50933965SjdpGAS_UNIQ(emulations)
51033965Sjdpfor em in . $emulations ; do
51133965Sjdp  case $em in
51233965Sjdp    .)	continue ;;
51333965Sjdp    mipsbelf | mipslelf)
51433965Sjdp	fmt=elf   file=mipself ;;
51533965Sjdp    mipsbecoff | mipslecoff)
51633965Sjdp	fmt=ecoff file=mipsecoff ;;
51733965Sjdp    i386coff)
51833965Sjdp	fmt=coff  file=i386coff ;;
51933965Sjdp    i386elf)
52033965Sjdp	fmt=elf   file=i386elf ;;
52133965Sjdp  esac
52233965Sjdp  formats="$formats $fmt"
52333965Sjdp  emfiles="$emfiles e-$file.o"
52433965Sjdp  EMULATIONS="$EMULATIONS &$em,"
52533965Sjdpdone
52633965SjdpGAS_UNIQ(formats)
52733965SjdpGAS_UNIQ(emfiles)
52833965Sjdpif test `set . $formats ; shift ; echo $#` -gt 1 ; then
52933965Sjdp  for fmt in $formats ; do
53033965Sjdp    case $fmt in
53133965Sjdp      aout)	AC_DEFINE(OBJ_MAYBE_AOUT)    ;;
53233965Sjdp      bout)	AC_DEFINE(OBJ_MAYBE_BOUT)    ;;
53333965Sjdp      coff)	AC_DEFINE(OBJ_MAYBE_COFF)    ;;
53433965Sjdp      ecoff)	AC_DEFINE(OBJ_MAYBE_ECOFF)   ;;
53533965Sjdp      elf)	AC_DEFINE(OBJ_MAYBE_ELF)     ;;
53633965Sjdp      generic)	AC_DEFINE(OBJ_MAYBE_GENERIC) ;;
53733965Sjdp      hp300)	AC_DEFINE(OBJ_MAYBE_HP300)   ;;
53833965Sjdp      ieee)	AC_DEFINE(OBJ_MAYBE_IEEE)    ;;
53933965Sjdp      som)	AC_DEFINE(OBJ_MAYBE_SOM)     ;;
54033965Sjdp      vms)	AC_DEFINE(OBJ_MAYBE_VMS)     ;;
54133965Sjdp    esac
54233965Sjdp    extra_objects="$extra_objects obj-$fmt.o"
54333965Sjdp  done
54433965Sjdp  obj_format=multi
54533965Sjdpfi
54633965Sjdpif test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
54733965Sjdp  te_file=multi
54833965Sjdp  extra_objects="$extra_objects $emfiles"
54933965Sjdp  DEFAULT_EMULATION=`set . $emulations ; echo $2`
55033965Sjdp  AC_DEFINE(USE_EMULATIONS)
55133965Sjdpfi
55233965SjdpAC_SUBST(extra_objects)
55333965SjdpAC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS)
55433965SjdpAC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION")
55533965Sjdp
55633965Sjdpcase ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
55733965Sjdp  yes-*-coff)	need_bfd=yes ;;
55833965Sjdp  no-*-coff)	need_bfd=yes
55933965Sjdp		AC_DEFINE(MANY_SEGMENTS) ;;
56033965Sjdpesac
56133965Sjdp
56233965Sjdpreject_dev_configs=yes
56333965Sjdp
56433965Sjdpcase ${reject_dev_configs}-${dev} in
56533965Sjdp  yes-yes) # Oops.
56633965Sjdp    AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
56733965Sjdp    ;;
56833965Sjdpesac
56933965Sjdp
57033965SjdpAC_SUBST(target_cpu_type)
57133965SjdpAC_SUBST(obj_format)
57233965SjdpAC_SUBST(te_file)
57333965SjdpAC_SUBST(atof)
57433965Sjdpdnl AC_SUBST(emulation)
57533965Sjdp
57633965Sjdpcase "${primary_bfd_gas}" in
57733965Sjdp  yes)	AC_DEFINE(BFD_ASSEMBLER)
57833965Sjdp	need_bfd=yes ;;
57933965Sjdpesac
58033965Sjdp
58133965Sjdp# do we need the opcodes library?
58233965Sjdpcase "${need_opcodes}" in
58333965Sjdpyes)
58438891Sjdp  OPCODES_LIB=../opcodes/libopcodes.la
58533965Sjdp  ;;
58633965Sjdpesac
58733965Sjdp
58833965Sjdpcase "${need_bfd}" in
58933965Sjdpyes)
59038891Sjdp  BFDLIB=../bfd/libbfd.la
59133965Sjdp  ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
59233965Sjdp  ;;
59333965Sjdpesac
59433965Sjdp
59533965SjdpAC_SUBST(BFDLIB)
59633965SjdpAC_SUBST(OPCODES_LIB)
59733965Sjdp
59833965SjdpAC_SUBST(ALL_OBJ_DEPS)
59933965Sjdp
60033965SjdpAC_DEFINE_UNQUOTED(TARGET_ALIAS,	"${target_alias}")
60133965SjdpAC_DEFINE_UNQUOTED(TARGET_CANONICAL,	"${target}")
60233965SjdpAC_DEFINE_UNQUOTED(TARGET_CPU,		"${target_cpu}")
60333965SjdpAC_DEFINE_UNQUOTED(TARGET_VENDOR,	"${target_vendor}")
60433965SjdpAC_DEFINE_UNQUOTED(TARGET_OS,		"${target_os}")
60533965Sjdp
60633965SjdpAC_PROG_CC
60733965Sjdp
60838891SjdpAC_PROG_YACC
60938891SjdpAC_PROG_LEX
61038891SjdpAC_DECL_YYTEXT
61138891Sjdp
61238891SjdpAM_MAINTAINER_MODE
61338891SjdpAM_CYGWIN32
61438891SjdpAM_EXEEXT
61538891Sjdp
61633965SjdpAC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
61733965Sjdp
61833965Sjdp# Put this here so that autoconf's "cross-compiling" message doesn't confuse
61933965Sjdp# people who are not cross-compiling but are compiling cross-assemblers.
62033965SjdpAC_MSG_CHECKING(whether compiling a cross-assembler)
62133965Sjdpif test "${host}" = "${target}"; then
62233965Sjdp  cross_gas=no
62333965Sjdpelse
62433965Sjdp  cross_gas=yes
62533965Sjdp  AC_DEFINE(CROSS_COMPILE)
62633965Sjdpfi
62733965SjdpAC_MSG_RESULT($cross_gas)
62833965Sjdp
62933965Sjdpdnl ansidecl.h will deal with const
63033965Sjdpdnl AC_CONST
63133965SjdpAC_FUNC_ALLOCA
63233965SjdpAC_C_INLINE
63333965Sjdp
63433965Sjdp# VMS doesn't have unlink.
63533965SjdpAC_CHECK_FUNCS(unlink remove, break)
63633965Sjdp
63733965Sjdp# Some systems don't have sbrk().
63833965SjdpAC_CHECK_FUNCS(sbrk)
63933965Sjdp
64033965Sjdp# Some non-ANSI preprocessors botch requoting inside strings.  That's bad
64133965Sjdp# enough, but on some of those systems, the assert macro relies on requoting
64233965Sjdp# working properly!
64333965SjdpGAS_WORKING_ASSERT
64433965Sjdp
64533965Sjdp# On some systems, the system header files may not declare malloc, realloc,
64633965Sjdp# and free.  There are places where gas needs these functions to have been
64733965Sjdp# declared -- such as when taking their addresses.
64833965Sjdpgas_test_headers="
64933965Sjdp#ifdef HAVE_MEMORY_H
65033965Sjdp#include <memory.h>
65133965Sjdp#endif
65233965Sjdp#ifdef HAVE_STRING_H
65333965Sjdp#include <string.h>
65433965Sjdp#else
65533965Sjdp#ifdef HAVE_STRINGS_H
65633965Sjdp#include <strings.h>
65733965Sjdp#endif
65833965Sjdp#endif
65933965Sjdp#ifdef HAVE_STDLIB_H
66033965Sjdp#include <stdlib.h>
66133965Sjdp#endif
66233965Sjdp#ifdef HAVE_UNISTD_H
66333965Sjdp#include <unistd.h>
66433965Sjdp#endif
66533965Sjdp"
66633965SjdpGAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
66733965SjdpGAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
66833965SjdpGAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
66933965SjdpGAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
67033965Sjdp
67133965Sjdp# Does errno.h declare errno, or do we have to add a separate declaration
67233965Sjdp# for it?
67333965SjdpGAS_CHECK_DECL_NEEDED(errno, f, int f, [
67433965Sjdp#ifdef HAVE_ERRNO_H
67533965Sjdp#include <errno.h>
67633965Sjdp#endif
67733965Sjdp])
67833965Sjdp
67933965Sjdpdnl This must come last.
68033965Sjdp
68133965Sjdpdnl We used to make symlinks to files in the source directory, but now
68233965Sjdpdnl we just use the right name for .c files, and create .h files in
68333965Sjdpdnl the build directory which include the right .h file.  Make sure
68433965Sjdpdnl the old symlinks don't exist, so that a reconfigure in an existing
68533965Sjdpdnl directory behaves reasonably.
68633965Sjdp
68733965SjdpAC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in,
68833965Sjdp[rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
68933965Sjdp echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
69033965Sjdp echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
69133965Sjdp echo '#include "te-'"${te_file}"'.h"' > targ-env.h
69233965Sjdp echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
69333965Sjdp case ${target_cpu_type} in
69433965Sjdp m32r) echo '#include "opcodes/'"${target_cpu_type}"'-opc.h"' > cgen-opc.h ;;
69533965Sjdp esac],
69633965Sjdp[target_cpu_type=${target_cpu_type}
69733965Sjdp obj_format=${obj_format}
69833965Sjdp te_file=${te_file}])
699