configure.in revision 60517
1145522Sdarrenrdnl Process this file with autoconf to produce a configure script.
2145522Sdarrenrdnl
353642Sguidodnl And be careful when changing it!  If you must add tests with square
4255332Scydnl brackets, be sure changequote invocations surround it.
5145522Sdarrenrdnl
6145522Sdarrenrdnl $FreeBSD: head/contrib/binutils/gas/configure.in 60517 2000-05-13 17:12:52Z obrien $
7145522Sdarrenrdnl
8255332Scydnl v2.5 needed for --bindir et al
9145522SdarrenrAC_PREREQ(2.13)
1053642SguidoAC_INIT(as.h)
1153642Sguido
1257126SguidoAC_CANONICAL_SYSTEM
1353642Sguido
1453642SguidoAM_INIT_AUTOMAKE(gas, 2.9.5)
1553642Sguido
1653642SguidoAM_PROG_LIBTOOL
17255332Scy
18255332Scyuser_bfd_gas=
19255332ScyAC_ARG_ENABLE(bfd-assembler,
20255332Scy[  --enable-bfd-assembler  use BFD back end for writing object files],
21255332Scy[case "${enableval}" in
2253642Sguido  yes) need_bfd=yes user_bfd_gas=yes ;;
23255332Scy  no)  user_bfd_gas=no ;;
24255332Scy  *)   AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;;
25255332Scyesac])dnl
26255332ScyAC_ARG_ENABLE(targets,
27255332Scy[    targets            alternative target configurations besides the primary],
28255332Scy[case "${enableval}" in
29255332Scy  yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
30255332Scy	    ;;
31255332Scy  no)	    enable_targets= ;;
3253642Sguido  *)	    enable_targets=$enableval ;;
33255332Scyesac])dnl
3453642SguidoAC_ARG_ENABLE(commonbfdlib,
3553642Sguido[  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
3653642Sguido[case "${enableval}" in
37255332Scy  yes) commonbfdlib=true ;;
3853642Sguido  no)  commonbfdlib=false ;;
39145522Sdarrenr  *)   AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
4053642Sguidoesac])dnl
4153642Sguido
4253642Sguidousing_cgen=no
43255332Scy
44255332Scy# Generate a header file
4553642SguidoAM_CONFIG_HEADER(config.h:config.in)
4653642Sguido
4753642Sguido# If we are on a DOS filesystem, we must use gdb.ini rather than
4853642Sguido# .gdbinit.
49145522SdarrenrGDBINIT=".gdbinit"
50145522Sdarrenrcase "${host}" in
5153642Sguido  *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
5253642Sguido    GDBINIT="gdb.ini"
5353642Sguido    ;;
54255332Scyesac
55255332ScyAC_SUBST(GDBINIT)
56145522Sdarrenr
57145522Sdarrenrte_file=generic
58145522Sdarrenr
59145522Sdarrenr# Makefile target for installing gas in $(tooldir)/bin.
60145522Sdarrenrinstall_tooldir=install-exec-tooldir
61145522Sdarrenr
62145522Sdarrenrcanon_targets=""
63145522Sdarrenrall_targets=no
6453642Sguidoif test -n "$enable_targets" ; then
6553642Sguido  for t in `echo $enable_targets | sed 's/,/ /g'`; do
6653642Sguido    if test $t = "all"; then
67255332Scy      all_targets=yes
68255332Scy      continue
69255332Scy    fi
70255332Scy    result=`$ac_config_sub $t 2>/dev/null`
71255332Scy    if test -n "$result" ; then
72255332Scy      canon_targets="$canon_targets $result"
7353642Sguido#    else
7453642Sguido#      # Permit "all", etc.  We don't support it yet though.
75255332Scy#      canon_targets="$canon_targets $t"
76255332Scy    fi
77255332Scy  done
78255332Scy  GAS_UNIQ(canon_targets)
7953642Sguidofi
80145522Sdarrenr
81145522Sdarrenremulations=""
82255332Scy
83255332Scyfor this_target in $target $canon_targets ; do
84255332Scy
85255332Scychangequote(,)dnl
86145522Sdarrenr    eval `echo $this_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'`
87255332Scychangequote([,])dnl
88145522Sdarrenr
8953642Sguido    # check for architecture variants
90145522Sdarrenr    arch=
9153642Sguido    endian=
9253642Sguido    case ${cpu} in
93255332Scy      alpha*)		cpu_type=alpha ;;
94255332Scy      armeb)		cpu_type=arm endian=big ;;
95255332Scy      arm*)		cpu_type=arm endian=little ;;
96255332Scy      armb*)		cpu_type=arm endian=little ;;
97255332Scy      armv*l)		cpu_type=arm endian=little ;;
98255332Scy      armv*b)		cpu_type=arm endian=big ;;
99255332Scy      strongarm*)	cpu_type=arm endian=little ;;
100255332Scy      thumb*)		cpu_type=arm endian=little ;;
101255332Scy      hppa*)		cpu_type=hppa ;;
102255332Scychangequote(,)dnl
103255332Scy      i[456]86)		cpu_type=i386 ;;
104255332Scy      m680[012346]0)	cpu_type=m68k ;;
105255332Scychangequote([,])dnl
10653642Sguido      m68008)		cpu_type=m68k ;;
10753642Sguido      m683??)		cpu_type=m68k ;;
10853642Sguido      m5200)		cpu_type=m68k ;;
10953642Sguido      m8*)		cpu_type=m88k ;;
110255332Scy      mips*el)		cpu_type=mips endian=little ;;
111255332Scy      mips*)		cpu_type=mips endian=big ;;
112255332Scy      pjl*)		cpu_type=pj endian=little ;;
113255332Scy      pj*)		cpu_type=pj endian=big ;;
114255332Scy      powerpcle*)	cpu_type=ppc endian=little ;;
115255332Scy      powerpc*)		cpu_type=ppc endian=big ;;
116255332Scy      rs6000*)		cpu_type=ppc ;;
117255332Scy      sparclite*)	cpu_type=sparc arch=sparclite ;;
118255332Scy      sparclet*)	cpu_type=sparc arch=sparclet ;;
119255332Scy      sparc64*)		cpu_type=sparc arch=v9-64 ;;
120255332Scy      sparc86x*)	cpu_type=sparc arch=sparc86x  ;;
121255332Scy      sparc*)		cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
122255332Scy      v850*)		cpu_type=v850 ;;
123255332Scy      *)		cpu_type=${cpu} ;;
124255332Scy    esac
12553642Sguido
12653642Sguido    if test ${this_target} = $target ; then
12753642Sguido      target_cpu_type=${cpu_type}
128255332Scy    elif test ${target_cpu_type} != ${cpu_type} ; then
129255332Scy      continue
130255332Scy    fi
13153642Sguido
13253642Sguido    generic_target=${cpu_type}-$vendor-$os
13353642Sguido    dev=no
13453642Sguido    bfd_gas=no
135145522Sdarrenr    em=generic
13653642Sguido
13753642Sguido    # assign object format
13853642Sguido    case ${generic_target} in
13953642Sguido      a29k-*-coff)          fmt=coff ;;
14053642Sguido      a29k-amd-udi)         fmt=coff ;;
14153642Sguido      a29k-amd-ebmon)       fmt=coff ;;
14253642Sguido      a29k-nyu-sym1)        fmt=coff ;;
143255332Scy      a29k-*-vxworks*)      fmt=coff ;;
144255332Scy
145255332Scy      alpha*-*-*vms*)	    fmt=evax ;;
146255332Scy      alpha*-*-netware*)    fmt=ecoff ;;
147255332Scy      alpha*-*-openbsd*)    fmt=ecoff ;;
14853642Sguido      alpha*-*-osf*)        fmt=ecoff ;;
149145522Sdarrenr      alpha*-*-linuxecoff*) fmt=ecoff ;;
150255332Scy      alpha*-*-linux-gnu*)  fmt=elf em=linux ;;
151255332Scy      alpha*-*-freebsd*)    fmt=elf em=freebsd ;;
152255332Scy      alpha*-*-netbsd*)     fmt=elf em=nbsd ;;
15353642Sguido
154255332Scy      arc-*-elf*)           fmt=elf bfd_gas=yes ;;
15553642Sguido
15692685Sdarrenr      arm-*-aout)	                fmt=aout ;;
157145522Sdarrenr      arm-*-coff | thumb-*-coff)        fmt=coff ;;
158255332Scy      arm-*-elf | thumb-*-elf)          fmt=elf ;;
159255332Scy      arm*-*-conix*)			fmt=elf ;;
160255332Scy      arm*-*-freebsd)			fmt=elf  em=freebsd ;;
161255332Scy      arm-*-linux*aout*)	        fmt=aout em=linux ;;
162256199Sdim      arm*-*-linux-gnu*)		fmt=elf  em=linux ;;
163145522Sdarrenr      arm-*-netbsd*)	                fmt=aout em=nbsd bfd_gas=yes ;;
16453642Sguido      arm-*-oabi | thumb-*-oabi)        fmt=elf ;;
16553642Sguido      arm-epoc-pe | thumb-epoc-pe)      fmt=coff em=epoc-pe ;;
16653642Sguido      arm-*-wince)          fmt=coff em=wince-pe bfd_gas=yes;;
16763523Sdarrenr      arm-*-pe | thumb-*-pe)            fmt=coff em=pe ;;
168145522Sdarrenr      arm-*-riscix*)	                fmt=aout em=riscix ;;
169145522Sdarrenr
170255332Scy      avr-*-*)		    fmt=elf bfd_gas=yes ;;
171255332Scy
172255332Scy      d10v-*-*)		    fmt=elf bfd_gas=yes ;;
173255332Scy      d30v-*-*)		    fmt=elf bfd_gas=yes ;;
174255332Scy
175255332Scy
176255332Scy      fr30-*-*)		    fmt=elf bfd_gas=yes ;;
17753642Sguido
178255332Scy      hppa-*-*elf*)         fmt=elf em=hppa ;;
179145522Sdarrenr      hppa-*-linux-gnu*)    fmt=elf em=hppa ;;
180145522Sdarrenr      hppa-*-lites*)        fmt=elf em=hppa ;;
18153642Sguido      hppa-*-osf*)          fmt=som em=hppa ;;
182255332Scy      hppa-*-rtems*)        fmt=elf em=hppa ;;
183255332Scy      hppa-*-hpux*)         fmt=som em=hppa ;;
184255332Scy      hppa-*-mpeix*)        fmt=som em=hppa ;;
185255332Scy      hppa-*-bsd*)          fmt=som em=hppa ;;
186255332Scy      hppa-*-hiux*)         fmt=som em=hppa ;;
187145522Sdarrenr
188145522Sdarrenr      h8300-*-coff)         fmt=coff ;;
189145522Sdarrenr
19053642Sguido      i370-*-elf* | i370-*-linux*) fmt=elf ;;
19153642Sguido      i386-ibm-aix*)        fmt=coff em=i386aix ;;
19253642Sguido      i386-sequent-bsd*)    fmt=aout em=dynix bfd_gas=yes ;;
193145522Sdarrenr      i386-*-beospe*)       fmt=coff em=pe bfd_gas=yes ;;
194145522Sdarrenr      i386-*-beoself* | i386-*-beos*) fmt=elf bfd_gas=yes ;;
195255332Scy      i386-*-bsd*)          fmt=aout em=386bsd ;;
196145522Sdarrenr      i386-*-netbsd0.8)     fmt=aout em=386bsd ;;
197145522Sdarrenr      i386-*-netbsd*)       fmt=aout em=nbsd bfd_gas=yes;;
19853642Sguido      i386-*-openbsd*)      fmt=aout em=nbsd bfd_gas=yes;;
199145522Sdarrenr      i386-*-linux*aout* | i386-*-linuxoldld)   fmt=aout em=linux ;;
20053642Sguido      i386-*-linux*coff*)   fmt=coff em=linux ;;
201255332Scy      i386-*-linux-gnu*)    fmt=elf em=linux bfd_gas=yes ;;
202255332Scy      i386-*-lynxos*)       fmt=coff em=lynx ;;
203255332Scy      i386-*-sysv4* | i386-*-solaris* | i386-*-elf)
204255332Scy			    fmt=elf bfd_gas=yes ;;
205255332Scy      i386-*-freebsdaout* | i386-*-freebsd[12].* | i386-*-freebsd[12])
206255332Scy                            fmt=aout em=386bsd ;;
207255332Scy      i386-*-freebsd*)	    fmt=elf em=freebsd bfd_gas=yes ;;
208255332Scy      i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*)
209255332Scy                          fmt=coff ;;
210255332Scy      i386-*-sco3.2v5*)      fmt=elf
211255332Scy			    if test ${this_target} = $target; then
21253642Sguido				AC_DEFINE(SCO_ELF, 1,
213255332Scy				    [Define if defaulting to ELF on SCO 5.])
214255332Scy			    fi
215255332Scy			    ;;
21653642Sguido      i386-*-sco3.2*)       fmt=coff ;;
21792685Sdarrenr      i386-*-vsta)          fmt=aout ;;
218145522Sdarrenr      i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*)
219255332Scy			    fmt=coff em=go32;;
220255332Scy      i386-*-rtemself*)     fmt=elf ;;
221255332Scy      i386-*-rtems*)        fmt=coff ;;
222255332Scy      i386-*-gnu*)          fmt=elf ;;
22360857Sdarrenr      i386-*-mach*)
224255332Scy			    fmt=aout em=mach bfd_gas=yes ;;
225255332Scy      i386-*-msdos*)        fmt=aout ;;
226145522Sdarrenr      i386-*-moss*)	    fmt=elf ;;
227255332Scy      i386-*-pe)            fmt=coff em=pe ;;
228255332Scy      i386-*-cygwin*)       fmt=coff em=pe bfd_gas=yes ;;
229255332Scy      i386-*-interix*)	    fmt=coff em=interix bfd_gas=yes ;;
230255332Scy      i386-*-mingw32*)      fmt=coff em=pe bfd_gas=yes ;;
231145522Sdarrenr      i386-*-*nt*)          fmt=coff em=pe ;;
232255332Scy      i386-*-vxworks*)      fmt=aout ;;
233255332Scy      i960-*-bout)          fmt=bout ;;
234255332Scy      i960-*-coff)          fmt=coff em=ic960 ;;
235255332Scy      i960-*-rtems*)        fmt=coff em=ic960 ;;
23653642Sguido      i960-*-nindy*)        fmt=bout ;;
237255332Scy      i960-*-vxworks4*)     fmt=bout ;;
238255332Scy      i960-*-vxworks5.0)    fmt=bout ;;
239255332Scy      i960-*-vxworks5.*)    fmt=coff em=ic960 ;;
240255332Scy      i960-*-vxworks*)      fmt=bout ;;
241255332Scy      i960-*-elf*)	    fmt=elf ;;
242255332Scy
243255332Scy      m32r-*-*)		    fmt=elf bfd_gas=yes ;;
244255332Scy
245255332Scy      m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
246255332Scy			    fmt=aout em=sun3 ;;
247255332Scy      m68k-motorola-sysv*)  fmt=coff em=delta ;;
248255332Scy      m68k-bull-sysv3*)     fmt=coff em=dpx2 ;;
249255332Scy      m68k-apollo-*)        fmt=coff em=apollo ;;
250255332Scy      m68k-*-sysv4*) # must be before -sysv*
251255332Scy			    fmt=elf em=svr4 ;;
252255332Scy      m68k-*-elf*)	    fmt=elf ;;
253255332Scy      m68k-*-coff | m68k-*-sysv* | m68k-*-rtems*)
254255332Scy			    fmt=coff ;;
255145522Sdarrenr      m68k-*-hpux*)         fmt=hp300 em=hp300 ;;
256255332Scy      m68k-*-linux*aout*)   fmt=aout em=linux ;;
257255332Scy      m68k-*-linux-gnu*)    fmt=elf em=linux ;;
258255332Scy      m68k-*-gnu*)	    fmt=elf ;;
259255332Scy      m68k-*-lynxos*)       fmt=coff em=lynx ;;
260145522Sdarrenr      m68k-*-netbsd*)       fmt=aout em=nbsd bfd_gas=yes ;;
261255332Scy      m68k-*-openbsd*)      fmt=aout em=nbsd bfd_gas=yes ;;
262255332Scy      m68k-apple-aux*)      fmt=coff em=aux ;;
263255332Scy      m68k-*-psos*)         fmt=elf em=psos;;
264255332Scy
265255332Scy      m88k-motorola-sysv3*) fmt=coff em=delt88 ;;
266255332Scy      m88k-*-coff*)         fmt=coff ;;
267255332Scy
268255332Scy      mcore-*-elf)	    fmt=elf bfd_gas=yes ;;
269255332Scy      mcore-*-pe)	    fmt=coff em=pe bfd_gas=yes ;;
270255332Scy
271255332Scy      # don't change em like *-*-bsd does
272255332Scy      mips-dec-netbsd*)	    fmt=elf endian=little ;;
273255332Scy      mips-dec-openbsd*)    fmt=elf endian=little ;;
274255332Scy      mips-dec-bsd*)        fmt=aout endian=little ;;
275255332Scy      mips-sony-bsd*)       fmt=ecoff ;;
276255332Scy      mips-*-bsd*)          AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
277255332Scy      mips-*-ultrix*)       fmt=ecoff endian=little ;;
278255332Scy      mips-*-osf*)          fmt=ecoff endian=little ;;
279255332Scy      mips-*-ecoff*)        fmt=ecoff ;;
280255332Scy      mips-*-ecoff*)        fmt=ecoff ;;
281255332Scy      mips-*-pe*)           fmt=coff endian=little em=pe ;;
282255332Scy      mips-*-irix6*)	    fmt=elf ;;
283255332Scy      mips-*-irix5*)        fmt=elf ;;
284255332Scy      mips-*-irix*)         fmt=ecoff ;;
285255332Scy      mips-*-lnews*)        fmt=ecoff em=lnews ;;
286255332Scy      mips-*-riscos*)       fmt=ecoff ;;
287255332Scy      mips-*-sysv*)         fmt=ecoff ;;
288255332Scy      mips-*-elf* | mips-*-rtems* | mips-*-linux-gnu* | mips-*-gnu* | mips-*-openbsd*)
289255332Scy			    fmt=elf ;;
290255332Scy      mips-*-vxworks*)      fmt=elf
291255332Scy			    AC_DEFINE(MIPS_STABS_ELF, 1,
292255332Scy				[Use ELF stabs for MIPS, not ECOFF stabs])
293255332Scy			    ;;
294255332Scy      mn10200-*-*)	    fmt=elf bfd_gas=yes ;;
295255332Scy      mn10300-*-*)	    fmt=elf bfd_gas=yes ;;
296255332Scy      pj*)		    fmt=elf ;;
297255332Scy      ppc-*-pe | ppc-*-cygwin* | ppc-*-winnt*)
298255332Scy		            fmt=coff em=pe ;;
299255332Scy      ppc-*-aix*)           fmt=coff ;;
300255332Scy      ppc-*-beos*)          fmt=coff ;;
301255332Scy      ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
302255332Scy			    fmt=elf ;;
303255332Scy      ppc-*-linux-gnu*)	    fmt=elf
304255332Scy			    case "$endian" in
305255332Scy			    big)  ;;
306255332Scy			    *)    AC_MSG_ERROR(GNU/Linux must be configured big endian) ;;
307255332Scy			    esac
308255332Scy			    ;;
309255332Scy      ppc-*-solaris*)	    fmt=elf
310255332Scy			    if test ${this_target} = $target; then
311255332Scy				AC_DEFINE(TARGET_SOLARIS_COMMENT, 1,
312255332Scy				[Define if default target is PowerPC Solaris.])
313255332Scy			    fi
314255332Scy			    if test x${endian} = xbig; then
315255332Scy				AC_MSG_ERROR(Solaris must be configured little endian)
316255332Scy			    fi
317255332Scy			    ;;
318255332Scy      ppc-*-rtems*)	    fmt=elf ;;
319255332Scy      ppc-*-macos* | ppc-*-mpw*)
320255332Scy			    fmt=coff em=macos ;;
32160857Sdarrenr      ppc-*-netware*)       fmt=elf em=ppcnw ;;
32253642Sguido      ppc-*-vxworks*)       fmt=elf ;;
323255332Scy
324255332Scy      sh-*-elf*)	    fmt=elf ;;
32553642Sguido      sh-*-coff*)           fmt=coff ;;
32653642Sguido      sh-*-pe*)             fmt=coff em=pe bfd_gas=yes;;
32753642Sguido      sh-*-rtemself*)       fmt=elf ;;
32853642Sguido      sh-*-rtems*)	    fmt=coff ;;
329255332Scy
330255332Scy      ns32k-pc532-mach* | ns32k-pc532-ux*)    fmt=aout em=pc532mach ;;
331255332Scy      ns32k-pc532-netbsd* | ns32k-pc532-lites*)  fmt=aout em=nbsd532 ;;
332255332Scy      ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;
333255332Scy
334255332Scy      sparc-*-rtems*)       fmt=aout ;;
33553642Sguido      sparc-*-sunos4*)      fmt=aout em=sun3 ;;
336145522Sdarrenr      sparc-*-aout | sparc*-*-vxworks*)
337255332Scy			    fmt=aout em=sparcaout ;;
338145522Sdarrenr      sparc-*-coff)         fmt=coff ;;
33953642Sguido      sparc-*-linux*aout*)  fmt=aout em=linux ;;
340145522Sdarrenr      sparc-*-linux-gnu*)   fmt=elf em=linux ;;
341145522Sdarrenr      sparc-*-lynxos*)      fmt=coff em=lynx ;;
342255332Scy      sparc-fujitsu-none)   fmt=aout ;;
343255332Scy      sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*)
344255332Scy			    fmt=elf ;;
345255332Scy      sparc-*-netbsd*)      fmt=aout em=nbsd ;;
346255332Scy      sparc-*-openbsd*)     fmt=aout em=nbsd ;;
347255332Scy
348145522Sdarrenr      sparc*-*-freebsd)	    fmt=elf em=freebsd ;;
349145522Sdarrenr
350255332Scy      strongarm-*-coff)     fmt=coff ;;
351145522Sdarrenr      strongarm-*-elf)      fmt=elf ;;
352145522Sdarrenr
353      tic30-*-*aout*)	    fmt=aout bfd_gas=yes ;;
354      tic30-*-*coff*)       fmt=coff bfd_gas=yes ;;
355      tic80-*-*)	    fmt=coff ;;
356
357      v850-*-*)		    fmt=elf bfd_gas=yes ;;
358      v850e-*-*)	    fmt=elf bfd_gas=yes ;;
359      v850ea-*-*)	    fmt=elf bfd_gas=yes ;;
360
361      vax-*-bsd* | vax-*-ultrix*)
362			    fmt=aout ;;
363      vax-*-vms)            fmt=vms ;;
364
365
366      z8k-*-coff | z8k-*-sim)
367			    fmt=coff ;;
368
369      w65-*-*)              fmt=coff ;;
370
371      *-*-aout | *-*-scout)
372			    fmt=aout ;;
373      *-*-nindy*)
374			    fmt=bout ;;
375      *-*-bsd*)
376			    fmt=aout em=sun3 ;;
377      *-*-generic)          fmt=generic ;;
378      *-*-xray | *-*-hms)   fmt=coff ;;
379      *-*-sim)              fmt=coff ;;
380      *-*-elf | *-*-sysv4* | *-*-solaris*)
381			    AC_MSG_WARN(GAS support for ${generic_target} is incomplete.)
382			    fmt=elf dev=yes ;;
383      *-*-vxworks)          fmt=aout ;;
384      *-*-netware)          fmt=elf ;;
385    esac
386
387    if test ${this_target} = $target ; then
388      endian_def=
389      if test x${endian} = xbig; then
390	endian_def=1
391      elif test x${endian} = xlittle; then
392	endian_def=0
393      fi
394      if test x${endian_def} != x; then
395	AC_DEFINE_UNQUOTED(TARGET_BYTES_BIG_ENDIAN, $endian_def,
396			   [Define as 1 if big endian.])
397      fi
398    fi
399
400    case ${cpu_type}-${fmt} in
401      alpha*-*)	bfd_gas=yes ;;
402      arm-*)	bfd_gas=yes ;;
403    # not yet
404    # i386-aout)	bfd_gas=preferred ;;
405      mips-*)	bfd_gas=yes ;;
406      ns32k-*)	bfd_gas=yes ;;
407      ppc-*)	bfd_gas=yes ;;
408      sparc-*)	bfd_gas=yes ;;
409      strongarm-*)	bfd_gas=yes ;;
410      *-elf)	bfd_gas=yes ;;
411      *-ecoff)	bfd_gas=yes ;;
412      *-som)	bfd_gas=yes ;;
413    #enable bfd for coff and aout to allow testing if a bfd target is
414    #the primary target, but not for coff or aout as the primary target
415      i386-coff)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
416      i386-aout)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
417      *)		;;
418    esac
419
420# Other random stuff.
421
422    # Do we need the opcodes library?
423    case ${cpu_type} in
424      vax | i386 | tic30)
425	;;
426
427      *)
428	need_opcodes=yes
429
430	case "${enable_shared}" in
431	yes) shared_opcodes=true ;;
432	*opcodes*) shared_opcodes=true ;;
433	*) shared_opcodes=false ;;
434	esac
435	if test "${shared_opcodes}" = "true"; then
436	  # A shared libopcodes must be linked against libbfd.
437	  need_bfd=yes
438	fi
439	;;
440    esac
441
442    # Any other special object files needed ?
443    case ${cpu_type} in
444      fr30 | m32r)
445	using_cgen=yes
446	;;
447
448      m68k)
449	case ${extra_objects} in
450	*m68k-parse.o*) ;;
451	*) extra_objects="$extra_objects m68k-parse.o" ;;
452	esac
453	;;
454
455      mips)
456	echo ${extra_objects} | grep -s "itbl-parse.o" 
457	if test $? -ne 0 ; then
458	  extra_objects="$extra_objects itbl-parse.o"
459	fi
460
461	echo ${extra_objects} | grep -s "itbl-lex.o" 
462	if test $? -ne 0 ; then
463	  extra_objects="$extra_objects itbl-lex.o"
464	fi
465
466	echo ${extra_objects} | grep -s "itbl-ops.o" 
467	if test $? -ne 0 ; then
468	  extra_objects="$extra_objects itbl-ops.o"
469	fi
470	;;
471
472      sparc)
473	if test $this_target = $target ; then
474	  AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
475	fi
476	;;
477      *)
478	;;
479    esac
480
481    if test $using_cgen = yes ; then
482	case "x${extra_objects}" in
483	*cgen.o*) ;;
484	*) extra_objects="$extra_objects cgen.o" ;;
485	esac
486    fi
487
488# See if we really can support this configuration with the emulation code.
489
490    if test $this_target = $target ; then
491      primary_bfd_gas=$bfd_gas
492      obj_format=$fmt
493      te_file=$em
494
495      if test $bfd_gas = no ; then
496	# Can't support other configurations this way.
497	break
498      fi
499    elif test $bfd_gas = no ; then
500      # Can't support this configuration.
501      break
502    fi
503
504# From target name and format, produce a list of supported emulations.
505
506    case ${generic_target}-${fmt} in
507      mips-*-irix5*-*)	emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
508      mips-*-linux-gnu*-*) case "$endian" in
509			big)	emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
510			*)	emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;;
511			esac ;;
512      mips-*-lnews*-ecoff) ;;
513      mips-*-*-ecoff)	case "$endian" in
514			big)	emulation="mipsbecoff mipslecoff mipsecoff" ;;
515			*)	emulation="mipslecoff mipsbecoff mipsecoff" ;;
516			esac ;;
517      mips-*-*-elf)	case "$endian" in
518			big)	emulation="mipsbelf mipslelf mipself" ;;
519			*)	emulation="mipslelf mipsbelf mipself" ;;
520			esac ;;
521      # Uncommenting the next line will turn on support for i386 AOUT
522      # for the default linux configuration
523      # i386-*-linux*-elf) emulation="i386elf i386aout" ;;
524      #
525      i386-*-aout)	emulation="i386aout" ;;
526      i386-*-coff)	emulation="i386coff" ;;
527      i386-*-elf)	emulation="i386elf" ;;
528    esac
529
530    emulations="$emulations $emulation"
531
532done
533
534# Turn on all targets if possible
535if test ${all_targets} = "yes"; then
536  case ${target_cpu_type} in
537  i386)
538    case ${obj_format} in
539    aout)
540      emulations="$emulations i386coff i386elf"
541      ;;
542    coff)
543      emulations="$emulations i386aout i386elf"
544    ;;
545    elf)
546      emulations="$emulations i386aout i386coff"
547      ;;
548    esac
549  ;;
550  esac
551fi
552
553# Assign floating point type.  Most processors with FP support
554# IEEE FP.  On those that don't support FP at all, usually IEEE
555# is emulated.
556case ${target_cpu} in
557  vax | tahoe )	atof=${target_cpu} ;;
558  *)		atof=ieee ;;
559esac
560
561case "${obj_format}" in
562  "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
563esac
564
565# Unfortunately the cpu in cpu-opc.h file isn't always $(TARGET_CPU).
566cgen_cpu_prefix=""
567if test $using_cgen = yes ; then
568  case ${target_cpu} in
569    *) cgen_cpu_prefix=${target_cpu} ;;
570  esac
571  AC_SUBST(cgen_cpu_prefix)
572  AC_DEFINE(USING_CGEN, 1, [Using cgen code?])
573fi
574
575dnl
576dnl Make sure the desired support files exist.
577dnl
578
579if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
580  AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
581fi
582
583if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
584  AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
585fi
586
587case ${user_bfd_gas}-${primary_bfd_gas} in
588  yes-yes | no-no)
589    # We didn't override user's choice.
590    ;;
591  no-yes)
592    AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
593    ;;
594  no-preferred)
595    primary_bfd_gas=no
596    ;;
597  *-preferred)
598    primary_bfd_gas=yes
599    ;;
600  yes-*)
601    primary_bfd_gas=yes
602    ;;
603  -*)
604    # User specified nothing.
605    ;;
606esac
607
608# Some COFF configurations want these random other flags set.
609case ${obj_format} in
610  coff)
611    case ${target_cpu_type} in
612      i386) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;;
613      m68k) AC_DEFINE(M68KCOFF, 1, [Using m68k COFF?]) ;;
614      m88k) AC_DEFINE(M88KCOFF, 1, [Using m88k COFF?]) ;;
615    esac
616    ;;
617esac
618
619# Getting this done right is going to be a bitch.  Each configuration specified
620# with --enable-targets=... should be checked for environment, format, cpu, and
621# bfd_gas setting.
622#
623# For each configuration, the necessary object file support code must be linked
624# in.  This might be only one, it might be up to four.  The necessary emulation
625# code needs to be provided, too.
626#
627# And then there's "--enable-targets=all"....
628#
629# For now, just always do it for MIPS ELF or ECOFF configurations.  Sigh.
630
631formats="${obj_format}"
632emfiles=""
633EMULATIONS=""
634GAS_UNIQ(emulations)
635for em in . $emulations ; do
636  case $em in
637    .)	continue ;;
638    mipsbelf | mipslelf)
639	fmt=elf   file=mipself ;;
640    mipsbecoff | mipslecoff)
641	fmt=ecoff file=mipsecoff ;;
642    i386aout)
643	fmt=aout  file=i386aout ;;
644    i386coff)
645	fmt=coff  file=i386coff ;;
646    i386elf)
647	fmt=elf   file=i386elf ;;
648  esac
649  formats="$formats $fmt"
650  emfiles="$emfiles e-$file.o"
651  EMULATIONS="$EMULATIONS &$em,"
652done
653GAS_UNIQ(formats)
654GAS_UNIQ(emfiles)
655if test `set . $formats ; shift ; echo $#` -gt 1 ; then
656  for fmt in $formats ; do
657    case $fmt in
658      aout)	AC_DEFINE(OBJ_MAYBE_AOUT, 1,    [a.out support?])   ;;
659      bout)	AC_DEFINE(OBJ_MAYBE_BOUT, 1,    [b.out support?])   ;;
660      coff)	AC_DEFINE(OBJ_MAYBE_COFF, 1,    [COFF support?])    ;;
661      ecoff)	AC_DEFINE(OBJ_MAYBE_ECOFF, 1,   [ECOFF support?])   ;;
662      elf)	AC_DEFINE(OBJ_MAYBE_ELF, 1,     [ELF support?])     ;;
663      generic)	AC_DEFINE(OBJ_MAYBE_GENERIC, 1, [generic support?]) ;;
664      hp300)	AC_DEFINE(OBJ_MAYBE_HP300, 1,   [HP300 support?])   ;;
665      ieee)	AC_DEFINE(OBJ_MAYBE_IEEE, 1,    [IEEE support?])    ;;
666      som)	AC_DEFINE(OBJ_MAYBE_SOM, 1,     [SOM support?])     ;;
667      vms)	AC_DEFINE(OBJ_MAYBE_VMS, 1,     [VMS support?])     ;;
668    esac
669    extra_objects="$extra_objects obj-$fmt.o"
670  done
671  obj_format=multi
672fi
673if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
674  DEFAULT_EMULATION=`set . $emulations ; echo $2`
675  # e-mips* has more than one emulation per file, e-i386* has just one at the
676  # moment.  If only one emulation is specified, then don't define
677  # USE_EMULATIONS or include any of the e-files as they will only be bloat.
678  case "${obj_format}${emfiles}" in
679    multi* | *mips*)
680      extra_objects="$extra_objects $emfiles"
681      AC_DEFINE(USE_EMULATIONS, 1, [Use emulation support?]) ;;
682  esac
683fi
684AC_SUBST(extra_objects)
685AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS, [Supported emulations.])
686AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION",
687		   [Default emulation.])
688
689case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
690  yes-*-coff)	need_bfd=yes ;;
691  no-*-coff)	need_bfd=yes
692		AC_DEFINE(MANY_SEGMENTS, 1, [old COFF support?]) ;;
693esac
694
695reject_dev_configs=yes
696
697case ${reject_dev_configs}-${dev} in
698  yes-yes) # Oops.
699    AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
700    ;;
701esac
702
703AC_SUBST(target_cpu_type)
704AC_SUBST(obj_format)
705AC_SUBST(te_file)
706AC_SUBST(install_tooldir)
707AC_SUBST(atof)
708dnl AC_SUBST(emulation)
709
710case "${primary_bfd_gas}" in
711  yes)	AC_DEFINE(BFD_ASSEMBLER, 1, [Use BFD interface?])
712	need_bfd=yes ;;
713esac
714
715# do we need the opcodes library?
716case "${need_opcodes}" in
717yes)
718  OPCODES_LIB=../opcodes/libopcodes.la
719  ;;
720esac
721
722case "${need_bfd}" in
723yes)
724  BFDLIB=../bfd/libbfd.la
725  ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
726  ;;
727esac
728
729AC_SUBST(BFDLIB)
730AC_SUBST(OPCODES_LIB)
731
732AC_SUBST(ALL_OBJ_DEPS)
733
734AC_DEFINE_UNQUOTED(TARGET_ALIAS,	"${target_alias}", [Target alias.])
735AC_DEFINE_UNQUOTED(TARGET_CANONICAL,	"${target}",       [Canonical target.])
736AC_DEFINE_UNQUOTED(TARGET_CPU,		"${target_cpu}",   [Target CPU.])
737AC_DEFINE_UNQUOTED(TARGET_VENDOR,	"${target_vendor}", [Target vendor.])
738AC_DEFINE_UNQUOTED(TARGET_OS,		"${target_os}",    [Target OS.])
739
740AC_PROG_CC
741
742AC_PROG_YACC
743AM_PROG_LEX
744
745ALL_LINGUAS=
746CY_GNU_GETTEXT
747
748AM_MAINTAINER_MODE
749AC_EXEEXT
750
751AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
752
753# Put this here so that autoconf's "cross-compiling" message doesn't confuse
754# people who are not cross-compiling but are compiling cross-assemblers.
755AC_MSG_CHECKING(whether compiling a cross-assembler)
756if test "${host}" = "${target}"; then
757  cross_gas=no
758else
759  cross_gas=yes
760  AC_DEFINE(CROSS_COMPILE, 1, [Compiling cross-assembler?])
761fi
762AC_MSG_RESULT($cross_gas)
763
764dnl ansidecl.h will deal with const
765dnl AC_CONST
766AC_FUNC_ALLOCA
767AC_C_INLINE
768
769# VMS doesn't have unlink.
770AC_CHECK_FUNCS(unlink remove, break)
771
772# Some systems don't have sbrk().
773AC_CHECK_FUNCS(sbrk)
774
775# Some non-ANSI preprocessors botch requoting inside strings.  That's bad
776# enough, but on some of those systems, the assert macro relies on requoting
777# working properly!
778GAS_WORKING_ASSERT
779
780# On some systems, the system header files may not declare malloc, realloc,
781# and free.  There are places where gas needs these functions to have been
782# declared -- such as when taking their addresses.
783gas_test_headers="
784#ifdef HAVE_MEMORY_H
785#include <memory.h>
786#endif
787#ifdef HAVE_STRING_H
788#include <string.h>
789#else
790#ifdef HAVE_STRINGS_H
791#include <strings.h>
792#endif
793#endif
794#ifdef HAVE_STDLIB_H
795#include <stdlib.h>
796#endif
797#ifdef HAVE_UNISTD_H
798#include <unistd.h>
799#endif
800"
801GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
802GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
803GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
804GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
805GAS_CHECK_DECL_NEEDED(environ, f, char **f, $gas_test_headers)
806
807# Does errno.h declare errno, or do we have to add a separate declaration
808# for it?
809GAS_CHECK_DECL_NEEDED(errno, f, int f, [
810#ifdef HAVE_ERRNO_H
811#include <errno.h>
812#endif
813])
814
815dnl This must come last.
816
817dnl We used to make symlinks to files in the source directory, but now
818dnl we just use the right name for .c files, and create .h files in
819dnl the build directory which include the right .h file.  Make sure
820dnl the old symlinks don't exist, so that a reconfigure in an existing
821dnl directory behaves reasonably.
822
823AC_OUTPUT(Makefile doc/Makefile ${GDBINIT}:gdbinit.in po/Makefile.in:po/Make-in,
824[rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
825 echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
826 echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
827 echo '#include "te-'"${te_file}"'.h"' > targ-env.h
828 echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
829 if test "x$cgen_cpu_prefix" != x ; then
830   echo '#include "opcodes/'"${cgen_cpu_prefix}"'-desc.h"' > cgen-desc.h
831 fi
832
833 sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile],
834[target_cpu_type=${target_cpu_type}
835 cgen_cpu_prefix=${cgen_cpu_prefix}
836 obj_format=${obj_format}
837 te_file=${te_file}])
838