configure.in revision 89866
1dnl Process this file with autoconf to produce a configure script.
2dnl
3dnl And be careful when changing it!  If you must add tests with square
4dnl brackets, be sure changequote invocations surround it.
5dnl
6dnl $FreeBSD: head/contrib/binutils/gas/configure.in 89866 2002-01-27 12:15:52Z obrien $
7dnl
8dnl v2.5 needed for --bindir et al
9AC_PREREQ(2.13)
10AC_INIT(as.h)
11
12AC_CANONICAL_SYSTEM
13AC_ISC_POSIX
14
15changequote(,)dnl
16BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ 	]*\([^ 	]*\)[ 	]*).*/\1/p' < ${srcdir}/../bfd/configure.in`
17changequote([,])dnl
18AM_INIT_AUTOMAKE(gas, ${BFD_VERSION})
19
20AM_PROG_LIBTOOL
21
22user_bfd_gas=
23AC_ARG_ENABLE(bfd-assembler,
24[  --enable-bfd-assembler  use BFD back end for writing object files],
25[case "${enableval}" in
26  yes) need_bfd=yes user_bfd_gas=yes ;;
27  no)  user_bfd_gas=no ;;
28  *)   AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;;
29esac])dnl
30AC_ARG_ENABLE(targets,
31[    targets            alternative target configurations besides the primary],
32[case "${enableval}" in
33  yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
34	    ;;
35  no)	    enable_targets= ;;
36  *)	    enable_targets=$enableval ;;
37esac])dnl
38AC_ARG_ENABLE(commonbfdlib,
39[  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
40[case "${enableval}" in
41  yes) commonbfdlib=true ;;
42  no)  commonbfdlib=false ;;
43  *)   AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
44esac])dnl
45
46using_cgen=no
47
48build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
49AC_ARG_ENABLE(build-warnings,
50[  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
51[case "${enableval}" in
52  yes)	;;
53  no)	build_warnings="-w";;
54  ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
55        build_warnings="${build_warnings} ${t}";;
56  *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
57        build_warnings="${t} ${build_warnings}";;
58  *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
59esac
60if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
61  echo "Setting warning flags = $build_warnings" 6>&1
62fi])dnl
63WARN_CFLAGS=""
64if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
65    WARN_CFLAGS="${build_warnings}"
66fi
67AC_SUBST(WARN_CFLAGS)
68
69# Generate a header file
70AM_CONFIG_HEADER(config.h:config.in)
71
72# If we are on a DOS filesystem, we must use gdb.ini rather than
73# .gdbinit.
74GDBINIT=".gdbinit"
75case "${host}" in
76  *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
77    GDBINIT="gdb.ini"
78    ;;
79esac
80AC_SUBST(GDBINIT)
81
82te_file=generic
83
84# Makefile target for installing gas in $(tooldir)/bin.
85install_tooldir=install-exec-tooldir
86
87canon_targets=""
88all_targets=no
89if test -n "$enable_targets" ; then
90  for t in `echo $enable_targets | sed 's/,/ /g'`; do
91    if test $t = "all"; then
92      all_targets=yes
93      continue
94    fi
95    result=`$ac_config_sub $t 2>/dev/null`
96    if test -n "$result" ; then
97      canon_targets="$canon_targets $result"
98#    else
99#      # Permit "all", etc.  We don't support it yet though.
100#      canon_targets="$canon_targets $t"
101    fi
102  done
103  GAS_UNIQ(canon_targets)
104fi
105
106emulations=""
107
108for this_target in $target $canon_targets ; do
109
110changequote(,)dnl
111    eval `echo $this_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'`
112changequote([,])dnl
113
114    # check for architecture variants
115    arch=
116    endian=
117    case ${cpu} in
118      alpha*)		cpu_type=alpha ;;
119      armeb)		cpu_type=arm endian=big ;;
120      arm*)		cpu_type=arm endian=little ;;
121      armb*)		cpu_type=arm endian=little ;;
122      armv*l)		cpu_type=arm endian=little ;;
123      armv*b)		cpu_type=arm endian=big ;;
124      xscale*)		cpu_type=arm endian=little ;;
125      strongarm*)	cpu_type=arm endian=little ;;
126      thumb*)		cpu_type=arm endian=little ;;
127      hppa*)		cpu_type=hppa ;;
128changequote(,)dnl
129      i[3456]86)	cpu_type=i386 arch=i386;;
130      x86_64)		cpu_type=i386 arch=x86_64;;
131      ia64)		cpu_type=ia64 ;;
132      m6811|m6812|m68hc12) cpu_type=m68hc11 ;;
133      m680[012346]0)	cpu_type=m68k ;;
134changequote([,])dnl
135      m68008)		cpu_type=m68k ;;
136      m683??)		cpu_type=m68k ;;
137      m5200)		cpu_type=m68k ;;
138      m8*)		cpu_type=m88k ;;
139      mips*el)		cpu_type=mips endian=little ;;
140      mips*)		cpu_type=mips endian=big ;;
141      pjl*)		cpu_type=pj endian=little ;;
142      pj*)		cpu_type=pj endian=big ;;
143      powerpc*le*)	cpu_type=ppc endian=little ;;
144      powerpc*)		cpu_type=ppc endian=big ;;
145      rs6000*)		cpu_type=ppc ;;
146      s390x*)		cpu_type=s390 arch=s390x ;;
147      s390*)		cpu_type=s390 arch=s390 ;;
148      sh*le)		cpu_type=sh endian=little ;;
149      sh*)		cpu_type=sh endian=big ;;
150      sparclite*)	cpu_type=sparc arch=sparclite ;;
151      sparclet*)	cpu_type=sparc arch=sparclet ;;
152      sparc64*)		cpu_type=sparc arch=v9-64 ;;
153      sparc86x*)	cpu_type=sparc arch=sparc86x  ;;
154      sparc*)		cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
155      v850*)		cpu_type=v850 ;;
156      *)		cpu_type=${cpu} ;;
157    esac
158
159    if test ${this_target} = $target ; then
160      target_cpu_type=${cpu_type}
161    elif test ${target_cpu_type} != ${cpu_type} ; then
162      continue
163    fi
164
165    generic_target=${cpu_type}-$vendor-$os
166    dev=no
167    bfd_gas=no
168    em=generic
169    mips_stabs_elf=
170
171    # assign object format
172    case ${generic_target} in
173      a29k-*-coff)          fmt=coff ;;
174      a29k-amd-udi)         fmt=coff ;;
175      a29k-amd-ebmon)       fmt=coff ;;
176      a29k-nyu-sym1)        fmt=coff ;;
177      a29k-*-rtems*)        fmt=coff ;;
178      a29k-*-vxworks*)      fmt=coff ;;
179
180      alpha*-*-*vms*)	    fmt=evax ;;
181      alpha*-*-netware*)    fmt=ecoff ;;
182      alpha*-*-openbsd*)    fmt=ecoff ;;
183      alpha*-*-osf*)        fmt=ecoff ;;
184      alpha*-*-linuxecoff*) fmt=ecoff ;;
185      alpha*-*-linux-gnu*)  fmt=elf em=linux ;;
186      alpha*-*-netbsd*)     fmt=elf em=nbsd ;;
187
188      arc-*-elf*)           fmt=elf bfd_gas=yes ;;
189
190      arm-*-aout)	                fmt=aout ;;
191      arm-*-coff | thumb-*-coff)        fmt=coff ;;
192      arm-*-rtems | thumb-*-rtems)      fmt=elf ;;
193      arm-*-elf | thumb-*-elf)          fmt=elf ;;
194      arm*-*-conix*)			fmt=elf ;;
195      arm-*-linux*aout*)	        fmt=aout em=linux ;;
196      arm*-*-linux-gnu* | arm*-*-uclinux*)	
197					fmt=elf  em=linux ;;
198      arm-*-netbsdelf*)                 fmt=elf  em=nbsd ;;
199      arm-*-netbsd* | arm-*-openbsd*)   fmt=aout em=nbsd ;;
200      arm-*-oabi | thumb-*-oabi)        fmt=elf ;;
201      arm-epoc-pe | thumb-epoc-pe)      fmt=coff em=epoc-pe ;;
202      arm-*-wince)			fmt=coff em=wince-pe ;;
203      arm-*-pe | thumb-*-pe)            fmt=coff em=pe ;;
204      arm-*-riscix*)	                fmt=aout em=riscix ;;
205      arm-*-vxworks)	                fmt=coff ;;
206
207      avr-*-*)		    fmt=elf bfd_gas=yes ;;
208
209      cris-*-*)		    fmt=multi bfd_gas=yes ;;
210
211      d10v-*-*)		    fmt=elf bfd_gas=yes ;;
212      d30v-*-*)		    fmt=elf bfd_gas=yes ;;
213
214
215      fr30-*-*)		    fmt=elf bfd_gas=yes ;;
216
217      hppa-*-linux-gnu*)    case ${cpu} in
218				hppa*64*)
219					fmt=elf em=hppalinux64;;
220				hppa*)
221					fmt=elf em=linux;;
222			    esac ;;
223      hppa-*-*elf*)         fmt=elf em=hppa ;;
224      hppa-*-lites*)        fmt=elf em=hppa ;;
225      hppa-*-osf*)          fmt=som em=hppa ;;
226      hppa-*-rtems*)        fmt=elf em=hppa ;;
227      hppa-*-hpux11*)	    case ${cpu} in
228				hppa*64*)
229					fmt=elf em=hppa64 ;;
230				hppa*)
231					fmt=som em=hppa ;;
232			    esac ;;
233      hppa-*-hpux*)         fmt=som em=hppa ;;
234      hppa-*-mpeix*)        fmt=som em=hppa ;;
235      hppa-*-bsd*)          fmt=som em=hppa ;;
236      hppa-*-hiux*)         fmt=som em=hppa ;;
237
238      h8300-*-rtems*)       fmt=coff ;;
239      h8300-*-coff)         fmt=coff ;;
240      h8300-*-elf)          fmt=elf ;;
241      h8500-*-rtems*)       fmt=coff ;;
242      h8500-*-coff)         fmt=coff ;;
243
244      i370-*-elf* | i370-*-linux*) fmt=elf ;;
245      i386-ibm-aix*)        fmt=coff em=i386aix ;;
246      i386-sequent-bsd*)    fmt=aout em=dynix bfd_gas=yes ;;
247      i386-*-beospe*)       fmt=coff em=pe bfd_gas=yes ;;
248      i386-*-beoself* | i386-*-beos*) fmt=elf bfd_gas=yes ;;
249      i386-*-bsd*)          fmt=aout em=386bsd ;;
250      i386-*-netbsd0.8)     fmt=aout em=386bsd ;;
251      i386-*-netbsd*)       em=nbsd bfd_gas=yes
252			    case ${cpu} in
253			      x86_64)	fmt=elf ;;
254			      *)	case ${os} in
255					  *elf*) fmt=elf ;;
256					  *)     fmt=aout ;;
257					esac
258					;;
259			    esac
260			    ;;
261      i386-*-openbsd*)      fmt=aout em=nbsd bfd_gas=yes;;
262      i386-*-linux*aout* | i386-*-linux*oldld)   fmt=aout em=linux ;;
263      i386-*-linux*coff*)   fmt=coff em=linux ;;
264      i386-*-linux-gnu*)    fmt=elf em=linux bfd_gas=yes ;;
265      x86_64-*-linux-gnu*)  fmt=elf em=linux bfd_gas=yes ;;
266      i386-*-lynxos*)       fmt=coff em=lynx ;;
267changequote(,)dnl
268      i386-*-sysv[45]* | i386-*-solaris* | i386-*-elf)
269			    fmt=elf bfd_gas=yes ;;
270      i386-*-freebsdaout* | i386-*-freebsd[12].* | i386-*-freebsd[12])
271                            fmt=aout em=386bsd ;;
272changequote([,])dnl
273      i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*)
274                          fmt=coff ;;
275      i386-*-sco3.2v5*)      fmt=elf
276			    if test ${this_target} = $target; then
277				AC_DEFINE(SCO_ELF, 1,
278				    [Define if defaulting to ELF on SCO 5.])
279			    fi
280			    ;;
281      i386-*-sco3.2*)       fmt=coff ;;
282      i386-*-vsta)          fmt=aout ;;
283      i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*)
284			    fmt=coff em=go32 bfd_gas=yes
285			    AC_DEFINE(STRICTCOFF, 1, [Using strict COFF?])
286			    ;;
287      i386-*-rtemself*)     fmt=elf ;;
288      i386-*-rtemscoff*)    fmt=coff ;;
289      i386-*-rtems*)        fmt=elf ;;
290      i386-*-gnu*)          fmt=elf ;;
291      i386-*-mach*)
292			    fmt=aout em=mach bfd_gas=yes ;;
293      i386-*-msdos*)        fmt=aout ;;
294      i386-*-moss*)	    fmt=elf ;;
295      i386-*-pe)            fmt=coff em=pe bfd_gas=yes ;;
296      i386-*-cygwin*)       fmt=coff em=pe bfd_gas=yes ;;
297      i386-*-interix*)	    fmt=coff em=interix bfd_gas=yes ;;
298      i386-*-mingw32*)      fmt=coff em=pe bfd_gas=yes ;;
299      i386-*-*nt*)          fmt=coff em=pe bfd_gas=yes ;;
300      i386-*-vxworks*)      fmt=aout ;;
301      i386-*-chaos)         fmt=elf ;;
302      i860-stardent-sysv4* | i860-stardent-elf*)
303			    fmt=elf bfd_gas=yes endian=little
304			    AC_MSG_WARN(GAS support for ${generic_target} is preliminary and a work in progress) ;;
305      i960-*-bout)          fmt=bout ;;
306      i960-*-coff)          fmt=coff em=ic960 ;;
307      i960-*-rtems*)        fmt=coff em=ic960 ;;
308      i960-*-nindy*)        fmt=bout ;;
309      i960-*-vxworks4*)     fmt=bout ;;
310      i960-*-vxworks5.0)    fmt=bout ;;
311      i960-*-vxworks5.*)    fmt=coff em=ic960 ;;
312      i960-*-vxworks*)      fmt=bout ;;
313      i960-*-elf*)	    fmt=elf ;;
314
315      ia64-*-elf*)	    fmt=elf ;;
316      ia64-*-aix*)	    fmt=elf em=ia64aix ;;
317      ia64-*-linux-gnu*)    fmt=elf em=linux ;;
318      ia64-*-hpux*)	    fmt=elf em=hpux ;;
319      ia64-*-netbsd*)       fmt=elf em=nbsd ;;
320
321      m32r-*-*)		    fmt=elf bfd_gas=yes ;;
322
323      m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)fmt=elf bfd_gas=yes ;;
324
325      m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
326			    fmt=aout em=sun3 ;;
327      m68k-motorola-sysv*)  fmt=coff em=delta ;;
328      m68k-bull-sysv3*)     fmt=coff em=dpx2 ;;
329      m68k-apollo-*)        fmt=coff em=apollo ;;
330      m68k-*-sysv4*) # must be before -sysv*
331			    fmt=elf em=svr4 ;;
332      m68k-*-elf*)	    fmt=elf ;;
333      m68k-*-coff | m68k-*-sysv* | m68k-*-rtemscoff*)
334			    fmt=coff ;;
335      m68k-*-rtems*)	    fmt=elf ;;
336      m68k-*-hpux*)         fmt=hp300 em=hp300 ;;
337      m68k-*-linux*aout*)   fmt=aout em=linux ;;
338      m68k-*-linux-gnu*)    fmt=elf em=linux ;;
339      m68k-*-gnu*)	    fmt=elf ;;
340      m68k-*-lynxos*)       fmt=coff em=lynx ;;
341      m68k-*-netbsdelf*)    fmt=elf em=nbsd bfd_gas=yes ;;
342      m68k-*-netbsdaout* | m68k-*-netbsd*)
343			    fmt=aout em=nbsd bfd_gas=yes ;;
344      m68k-*-openbsd*)      fmt=aout em=nbsd bfd_gas=yes ;;
345      m68k-apple-aux*)      fmt=coff em=aux ;;
346      m68k-*-psos*)         fmt=elf em=psos;;
347
348      m88k-motorola-sysv3*) fmt=coff em=delt88 ;;
349      m88k-*-coff*)         fmt=coff ;;
350
351      mcore-*-elf)	    fmt=elf bfd_gas=yes ;;
352      mcore-*-pe)	    fmt=coff em=pe bfd_gas=yes ;;
353
354      # don't change em like *-*-bsd does
355      mips-dec-openbsd*)    fmt=elf endian=little ;;
356      mips-dec-bsd*)        fmt=aout endian=little ;;
357      mips-sony-bsd*)       fmt=ecoff ;;
358      mips-*-bsd*)          AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
359      mips-*-ultrix*)       fmt=ecoff endian=little ;;
360      mips-*-osf*)          fmt=ecoff endian=little ;;
361      mips-*-ecoff*)        fmt=ecoff ;;
362      mips-*-pe*)           fmt=coff endian=little em=pe ;;
363      mips-*-irix6*)	    fmt=elf ;;
364      mips-*-irix5*)        fmt=elf ;;
365      mips-*-irix*)         fmt=ecoff ;;
366      mips-*-lnews*)        fmt=ecoff em=lnews ;;
367      mips-*-riscos*)       fmt=ecoff ;;
368      mips*-*-linux*)	    fmt=elf em=tmips mips_stabs_elf=y ;;
369      mips-*-sysv4*MP* | mips-*-gnu*)
370			    fmt=elf em=tmips ;;
371      mips-*-sysv*)         fmt=ecoff ;;
372      mips-*-elf* | mips-*-rtems* | mips-*-netbsd* | mips-*-openbsd*)
373			    fmt=elf ;;
374      mips-*-vxworks*)      fmt=elf mips_stabs_elf=y ;;
375      mmix-*-*)		    fmt=elf bfd_gas=yes ;;
376      mn10200-*-*)	    fmt=elf bfd_gas=yes ;;
377      mn10300-*-*)	    fmt=elf bfd_gas=yes ;;
378      openrisc-*-*)	    fmt=elf bfd_gas=yes ;;
379      pj*)		    fmt=elf ;;
380      ppc-*-pe | ppc-*-cygwin* | ppc-*-winnt*)
381		            fmt=coff em=pe ;;
382      ppc-*-aix*)           fmt=coff ;;
383      ppc-*-beos*)          fmt=coff ;;
384      ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
385			    fmt=elf ;;
386      ppc-*-linux-gnu*)	    fmt=elf
387			    case "$endian" in
388			    big)  ;;
389			    *)    AC_MSG_ERROR(GNU/Linux must be configured big endian) ;;
390			    esac
391			    ;;
392      ppc-*-solaris*)	    fmt=elf
393			    if test ${this_target} = $target; then
394				AC_DEFINE(TARGET_SOLARIS_COMMENT, 1,
395				[Define if default target is PowerPC Solaris.])
396			    fi
397			    if test x${endian} = xbig; then
398				AC_MSG_ERROR(Solaris must be configured little endian)
399			    fi
400			    ;;
401      ppc-*-rtems*)	    fmt=elf ;;
402      ppc-*-macos* | ppc-*-mpw*)
403			    fmt=coff em=macos ;;
404      ppc-*-netware*)       fmt=elf em=ppcnw ;;
405      ppc-*-vxworks*)       fmt=elf ;;
406
407      s390x-*-linux-gnu*)   fmt=elf em=linux ;;
408      s390-*-linux-gnu*)    fmt=elf em=linux ;;
409
410      sh*-*-linux*)	    fmt=elf em=linux
411			    case ${cpu} in
412				sh*eb)
413					endian=big ;;
414				sh*)
415					endian=little ;;
416			    esac ;;
417      sh*-*-netbsdelf*)     fmt=elf em=nbsd ;;
418      sh-*-elf*)	    fmt=elf ;;
419      sh-*-coff*)           fmt=coff bfd_gas=yes;;
420      sh-*-pe*)             fmt=coff em=pe bfd_gas=yes endian=little ;;
421      sh-*-rtemself*)       fmt=elf ;;
422      sh-*-rtems*)	    fmt=coff bfd_gas=yes;;
423
424      ns32k-pc532-mach* | ns32k-pc532-ux*)    fmt=aout em=pc532mach ;;
425      ns32k-pc532-netbsd* | ns32k-pc532-lites*)  fmt=aout em=nbsd532 ;;
426      ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;
427
428      sparc-*-rtemsaout*)   fmt=aout ;;
429      sparc-*-rtemself*)    fmt=elf ;;
430      sparc-*-rtems*)       fmt=elf ;;
431      sparc-*-sunos4*)      fmt=aout em=sun3 ;;
432      sparc-*-aout | sparc*-*-vxworks*)
433			    fmt=aout em=sparcaout ;;
434      sparc-*-coff)         fmt=coff ;;
435      sparc-*-linux*aout*)  fmt=aout em=linux ;;
436      sparc-*-linux-gnu*)   fmt=elf em=linux ;;
437      sparc-*-lynxos*)      fmt=coff em=lynx ;;
438      sparc-fujitsu-none)   fmt=aout ;;
439      sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*)
440			    fmt=elf ;;
441      sparc-*-netbsd*)      em=nbsd bfd_gas=yes
442                            case ${cpu} in
443                                sparc) case ${os} in
444                                           *elf*) fmt=elf ;;
445                                           *)     fmt=aout ;;
446                                       esac ;;
447                                sparc64) fmt=elf ;;
448                            esac
449                            ;;
450      sparc-*-openbsd*)     fmt=aout em=nbsd ;;
451
452      strongarm-*-coff)     fmt=coff ;;
453      strongarm-*-elf)      fmt=elf ;;
454      xscale-*-coff)     fmt=coff ;;
455      xscale-*-elf)      fmt=elf ;;
456
457      tic30-*-*aout*)	    fmt=aout bfd_gas=yes ;;
458      tic30-*-*coff*)       fmt=coff bfd_gas=yes ;;
459      tic54x-*-* | c54x*-*-*)
460			    fmt=coff bfd_gas=yes need_libm=yes;;
461      tic80-*-*)	    fmt=coff ;;
462
463      v850-*-*)		    fmt=elf bfd_gas=yes ;;
464      v850e-*-*)	    fmt=elf bfd_gas=yes ;;
465      v850ea-*-*)	    fmt=elf bfd_gas=yes ;;
466
467      vax-*-bsd* | vax-*-ultrix*)
468			    fmt=aout ;;
469      vax-*-vms)            fmt=vms ;;
470
471      w65-*-*)              fmt=coff ;;
472
473      xstormy16-*-*)	    fmt=elf bfd_gas=yes ;;
474
475      z8k-*-coff | z8k-*-sim)
476			    fmt=coff ;;
477
478      *-*-aout | *-*-scout)
479			    fmt=aout ;;
480      *-*-freebsd*)	    fmt=elf em=freebsd bfd_gas=yes ;;
481      *-*-nindy*)
482			    fmt=bout ;;
483      *-*-bsd*)
484			    fmt=aout em=sun3 ;;
485      *-*-generic)          fmt=generic ;;
486      *-*-xray | *-*-hms)   fmt=coff ;;
487      *-*-sim)              fmt=coff ;;
488      *-*-elf | *-*-sysv4* | *-*-solaris*)
489			    AC_MSG_WARN(GAS support for ${generic_target} is incomplete.)
490			    fmt=elf dev=yes ;;
491      *-*-vxworks)          fmt=aout ;;
492      *-*-netware)          fmt=elf ;;
493    esac
494
495    if test ${this_target} = $target ; then
496      endian_def=
497      if test x${endian} = xbig; then
498	endian_def=1
499      elif test x${endian} = xlittle; then
500	endian_def=0
501      fi
502      if test x${endian_def} != x; then
503	AC_DEFINE_UNQUOTED(TARGET_BYTES_BIG_ENDIAN, $endian_def,
504			   [Define as 1 if big endian.])
505      fi
506    fi
507
508    if test x${mips_stabs_elf} != x; then
509      AC_DEFINE(MIPS_STABS_ELF, 1,
510		[Use ELF stabs for MIPS, not ECOFF stabs])
511    fi
512
513    case ${cpu_type}-${fmt} in
514      alpha*-*)	bfd_gas=yes ;;
515      arm-*)	bfd_gas=yes ;;
516    # not yet
517    # i386-aout)	bfd_gas=preferred ;;
518      ia64*-*)	bfd_gas=yes ;;
519      mips-*)	bfd_gas=yes ;;
520      ns32k-*)	bfd_gas=yes ;;
521      pdp11-*)	bfd_gas=yes ;;
522      ppc-*)	bfd_gas=yes ;;
523      sparc-*)	bfd_gas=yes ;;
524      strongarm-*)	bfd_gas=yes ;;
525      xscale-*)	bfd_gas=yes ;;
526      *-elf)	bfd_gas=yes ;;
527      *-ecoff)	bfd_gas=yes ;;
528      *-som)	bfd_gas=yes ;;
529    #enable bfd for coff and aout to allow testing if a bfd target is
530    #the primary target, but not for coff or aout as the primary target
531      i386-coff)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
532      i386-aout)	if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
533      *)		;;
534    esac
535
536# Other random stuff.
537
538    # Do we need the opcodes library?
539    case ${cpu_type} in
540      vax | i386 | tic30)
541	;;
542
543      *)
544	need_opcodes=yes
545
546	case "${enable_shared}" in
547	yes) shared_opcodes=true ;;
548	*opcodes*) shared_opcodes=true ;;
549	*) shared_opcodes=false ;;
550	esac
551	if test "${shared_opcodes}" = "true"; then
552	  # A shared libopcodes must be linked against libbfd.
553	  need_bfd=yes
554	fi
555	;;
556    esac
557
558    # Any other special object files needed ?
559    case ${cpu_type} in
560      fr30 | m32r | openrisc)
561	using_cgen=yes
562	;;
563
564      m68k)
565	case ${extra_objects} in
566	*m68k-parse.o*) ;;
567	*) extra_objects="$extra_objects m68k-parse.o" ;;
568	esac
569	;;
570
571      mips)
572	echo ${extra_objects} | grep -s "itbl-parse.o" 
573	if test $? -ne 0 ; then
574	  extra_objects="$extra_objects itbl-parse.o"
575	fi
576
577	echo ${extra_objects} | grep -s "itbl-lex.o" 
578	if test $? -ne 0 ; then
579	  extra_objects="$extra_objects itbl-lex.o"
580	fi
581
582	echo ${extra_objects} | grep -s "itbl-ops.o" 
583	if test $? -ne 0 ; then
584	  extra_objects="$extra_objects itbl-ops.o"
585	fi
586	;;
587
588      i386 | s390 | sparc)
589	if test $this_target = $target ; then
590	  AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
591	fi
592	;;
593
594      xstormy16)
595	using_cgen=yes
596	;;
597
598      *)
599	;;
600    esac
601
602    if test $using_cgen = yes ; then
603	case "x${extra_objects}" in
604	*cgen.o*) ;;
605	*) extra_objects="$extra_objects cgen.o" ;;
606	esac
607    fi
608
609# See if we really can support this configuration with the emulation code.
610
611    if test $this_target = $target ; then
612      primary_bfd_gas=$bfd_gas
613      obj_format=$fmt
614      te_file=$em
615
616      if test $bfd_gas = no ; then
617	# Can't support other configurations this way.
618	break
619      fi
620    elif test $bfd_gas = no ; then
621      # Can't support this configuration.
622      break
623    fi
624
625# From target name and format, produce a list of supported emulations.
626
627    case ${generic_target}-${fmt} in
628      mips-*-irix5*-*)	emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
629      mips*-*-linux*-*) case "$endian" in
630			big)	emulation="mipsbelf mipslelf mipself" ;;
631			*)	emulation="mipslelf mipsbelf mipself" ;;
632			esac ;;
633      mips-*-lnews*-ecoff) ;;
634      mips-*-*-ecoff)	case "$endian" in
635			big)	emulation="mipsbecoff mipslecoff mipsecoff" ;;
636			*)	emulation="mipslecoff mipsbecoff mipsecoff" ;;
637			esac ;;
638      mips-*-*-elf)	case "$endian" in
639			big)	emulation="mipsbelf mipslelf mipself" ;;
640			*)	emulation="mipslelf mipsbelf mipself" ;;
641			esac ;;
642      mips-*-sysv4*MP*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
643      # i386-pc-pe-coff != i386-pc-coff.
644      i386-*-pe-coff)	;;
645      # Uncommenting the next line will turn on support for i386 AOUT
646      # for the default linux configuration
647      # i386-*-linux*-elf) emulation="i386elf i386aout" ;;
648      #
649      i386-*-aout)	emulation="i386aout" ;;
650      i386-*-coff)	emulation="i386coff" ;;
651      i386-*-elf)	emulation="i386elf" ;;
652
653      # Always all formats.  The first stated emulation becomes the default.
654      cris-*-*aout*)	emulation="crisaout criself" ;;
655      cris-*-*)		emulation="criself crisaout" ;;
656    esac
657
658    emulations="$emulations $emulation"
659
660done
661
662# Turn on all targets if possible
663if test ${all_targets} = "yes"; then
664  case ${target_cpu_type} in
665  i386)
666    case ${obj_format} in
667    aout)
668      emulations="$emulations i386coff i386elf"
669      ;;
670    coff)
671      emulations="$emulations i386aout i386elf"
672    ;;
673    elf)
674      emulations="$emulations i386aout i386coff"
675      ;;
676    esac
677  ;;
678  esac
679fi
680
681# Assign floating point type.  Most processors with FP support
682# IEEE FP.  On those that don't support FP at all, usually IEEE
683# is emulated.
684case ${target_cpu} in
685  vax | tahoe )	atof=${target_cpu} ;;
686  pdp11)	atof=vax ;;
687  *)		atof=ieee ;;
688esac
689
690case "${obj_format}" in
691  "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
692esac
693
694# Unfortunately the cpu in cpu-opc.h file isn't always $(TARGET_CPU).
695cgen_cpu_prefix=""
696if test $using_cgen = yes ; then
697  case ${target_cpu} in
698    *) cgen_cpu_prefix=${target_cpu} ;;
699  esac
700  AC_SUBST(cgen_cpu_prefix)
701  AC_DEFINE(USING_CGEN, 1, [Using cgen code?])
702fi
703
704dnl
705dnl Make sure the desired support files exist.
706dnl
707
708if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
709  AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
710fi
711
712if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
713  AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
714fi
715
716case ${user_bfd_gas}-${primary_bfd_gas} in
717  yes-yes | no-no)
718    # We didn't override user's choice.
719    ;;
720  no-yes)
721    AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.)
722    ;;
723  no-preferred)
724    primary_bfd_gas=no
725    ;;
726  *-preferred)
727    primary_bfd_gas=yes
728    ;;
729  yes-*)
730    primary_bfd_gas=yes
731    ;;
732  -*)
733    # User specified nothing.
734    ;;
735esac
736
737# Some COFF configurations want these random other flags set.
738case ${obj_format} in
739  coff)
740    case ${target_cpu_type} in
741      i386) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;;
742      m68k) AC_DEFINE(M68KCOFF, 1, [Using m68k COFF?]) ;;
743      m88k) AC_DEFINE(M88KCOFF, 1, [Using m88k COFF?]) ;;
744    esac
745    ;;
746esac
747
748# Getting this done right is going to be a bitch.  Each configuration specified
749# with --enable-targets=... should be checked for environment, format, cpu, and
750# bfd_gas setting.
751#
752# For each configuration, the necessary object file support code must be linked
753# in.  This might be only one, it might be up to four.  The necessary emulation
754# code needs to be provided, too.
755#
756# And then there's "--enable-targets=all"....
757#
758# For now, just always do it for MIPS ELF or ECOFF configurations.  Sigh.
759
760formats="${obj_format}"
761emfiles=""
762EMULATIONS=""
763GAS_UNIQ(emulations)
764for em in . $emulations ; do
765  case $em in
766    .)	continue ;;
767    mipsbelf | mipslelf | mipself)
768	fmt=elf   file=mipself ;;
769    mipsbecoff | mipslecoff | mipsecoff)
770	fmt=ecoff file=mipsecoff ;;
771    *coff)
772	fmt=coff  file=$em ;;
773    *aout)
774	fmt=aout file=$em ;;
775    *elf)
776	fmt=elf file=$em ;;
777  esac
778  formats="$formats $fmt"
779  emfiles="$emfiles e-$file.o"
780  EMULATIONS="$EMULATIONS &$em,"
781done
782GAS_UNIQ(formats)
783GAS_UNIQ(emfiles)
784if test `set . $formats ; shift ; echo $#` -gt 1 ; then
785  for fmt in $formats ; do
786    case $fmt in
787      aout)	AC_DEFINE(OBJ_MAYBE_AOUT, 1,    [a.out support?])   ;;
788      bout)	AC_DEFINE(OBJ_MAYBE_BOUT, 1,    [b.out support?])   ;;
789      coff)	AC_DEFINE(OBJ_MAYBE_COFF, 1,    [COFF support?])    ;;
790      ecoff)	AC_DEFINE(OBJ_MAYBE_ECOFF, 1,   [ECOFF support?])   ;;
791      elf)	AC_DEFINE(OBJ_MAYBE_ELF, 1,     [ELF support?])     ;;
792      generic)	AC_DEFINE(OBJ_MAYBE_GENERIC, 1, [generic support?]) ;;
793      hp300)	AC_DEFINE(OBJ_MAYBE_HP300, 1,   [HP300 support?])   ;;
794      ieee)	AC_DEFINE(OBJ_MAYBE_IEEE, 1,    [IEEE support?])    ;;
795      som)	AC_DEFINE(OBJ_MAYBE_SOM, 1,     [SOM support?])     ;;
796      vms)	AC_DEFINE(OBJ_MAYBE_VMS, 1,     [VMS support?])     ;;
797    esac
798    extra_objects="$extra_objects obj-$fmt.o"
799  done
800  obj_format=multi
801fi
802if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
803  DEFAULT_EMULATION=`set . $emulations ; echo $2`
804  # e-mips* has more than one emulation per file, e-i386* has just one at the
805  # moment.  If only one emulation is specified, then don't define
806  # USE_EMULATIONS or include any of the e-files as they will only be bloat.
807  case "${obj_format}${emfiles}" in
808    multi* | *mips*)
809      extra_objects="$extra_objects $emfiles"
810      AC_DEFINE(USE_EMULATIONS, 1, [Use emulation support?]) ;;
811  esac
812fi
813AC_SUBST(extra_objects)
814AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS, [Supported emulations.])
815AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION",
816		   [Default emulation.])
817
818case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in
819  yes-*-coff)	need_bfd=yes ;;
820  no-*-coff)	need_bfd=yes
821		AC_DEFINE(MANY_SEGMENTS, 1, [old COFF support?]) ;;
822esac
823
824reject_dev_configs=yes
825
826case ${reject_dev_configs}-${dev} in
827  yes-yes) # Oops.
828    AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
829    ;;
830esac
831
832AC_SUBST(target_cpu_type)
833AC_SUBST(obj_format)
834AC_SUBST(te_file)
835AC_SUBST(install_tooldir)
836AC_SUBST(atof)
837dnl AC_SUBST(emulation)
838
839case "${primary_bfd_gas}" in
840  yes)	AC_DEFINE(BFD_ASSEMBLER, 1, [Use BFD interface?])
841	need_bfd=yes ;;
842esac
843
844# do we need the opcodes library?
845case "${need_opcodes}" in
846yes)
847  OPCODES_LIB=../opcodes/libopcodes.la
848  ;;
849esac
850
851case "${need_bfd}" in
852yes)
853  BFDLIB=../bfd/libbfd.la
854  ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
855  ;;
856esac
857
858AC_SUBST(BFDLIB)
859AC_SUBST(OPCODES_LIB)
860
861AC_SUBST(ALL_OBJ_DEPS)
862
863AC_DEFINE_UNQUOTED(TARGET_ALIAS,	"${target_alias}", [Target alias.])
864AC_DEFINE_UNQUOTED(TARGET_CANONICAL,	"${target}",       [Canonical target.])
865AC_DEFINE_UNQUOTED(TARGET_CPU,		"${target_cpu}",   [Target CPU.])
866AC_DEFINE_UNQUOTED(TARGET_VENDOR,	"${target_vendor}", [Target vendor.])
867AC_DEFINE_UNQUOTED(TARGET_OS,		"${target_os}",    [Target OS.])
868
869AC_PROG_CC
870
871AC_PROG_YACC
872AM_PROG_LEX
873
874ALL_LINGUAS="fr tr"
875CY_GNU_GETTEXT
876
877AM_MAINTAINER_MODE
878AC_EXEEXT
879
880AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
881
882# Put this here so that autoconf's "cross-compiling" message doesn't confuse
883# people who are not cross-compiling but are compiling cross-assemblers.
884AC_MSG_CHECKING(whether compiling a cross-assembler)
885if test "${host}" = "${target}"; then
886  cross_gas=no
887else
888  cross_gas=yes
889  AC_DEFINE(CROSS_COMPILE, 1, [Compiling cross-assembler?])
890fi
891AC_MSG_RESULT($cross_gas)
892
893dnl ansidecl.h will deal with const
894dnl AC_CONST
895AC_FUNC_ALLOCA
896AC_C_INLINE
897
898# VMS doesn't have unlink.
899AC_CHECK_FUNCS(unlink remove, break)
900
901# Some systems don't have sbrk().
902AC_CHECK_FUNCS(sbrk)
903
904# do we need the math library?
905case "${need_libm}" in
906yes) 
907  AC_CHECK_LIBM
908  AC_SUBST(LIBM)
909  ;;
910esac
911
912# Some non-ANSI preprocessors botch requoting inside strings.  That's bad
913# enough, but on some of those systems, the assert macro relies on requoting
914# working properly!
915GAS_WORKING_ASSERT
916
917# On some systems, the system header files may not declare malloc, realloc,
918# and free.  There are places where gas needs these functions to have been
919# declared -- such as when taking their addresses.
920gas_test_headers="
921#ifdef HAVE_MEMORY_H
922#include <memory.h>
923#endif
924#ifdef HAVE_STRING_H
925#include <string.h>
926#else
927#ifdef HAVE_STRINGS_H
928#include <strings.h>
929#endif
930#endif
931#ifdef HAVE_STDLIB_H
932#include <stdlib.h>
933#endif
934#ifdef HAVE_UNISTD_H
935#include <unistd.h>
936#endif
937"
938GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
939GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
940GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
941GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
942GAS_CHECK_DECL_NEEDED(environ, f, char **f, $gas_test_headers)
943
944# Does errno.h declare errno, or do we have to add a separate declaration
945# for it?
946GAS_CHECK_DECL_NEEDED(errno, f, int f, [
947#ifdef HAVE_ERRNO_H
948#include <errno.h>
949#endif
950])
951
952dnl This must come last.
953
954dnl We used to make symlinks to files in the source directory, but now
955dnl we just use the right name for .c files, and create .h files in
956dnl the build directory which include the right .h file.  Make sure
957dnl the old symlinks don't exist, so that a reconfigure in an existing
958dnl directory behaves reasonably.
959
960AC_OUTPUT(Makefile doc/Makefile ${GDBINIT}:gdbinit.in po/Makefile.in:po/Make-in,
961[rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
962 echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
963 echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
964 echo '#include "te-'"${te_file}"'.h"' > targ-env.h
965 echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
966 if test "x$cgen_cpu_prefix" != x ; then
967   echo '#include "opcodes/'"${cgen_cpu_prefix}"'-desc.h"' > cgen-desc.h
968 fi
969
970 sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile],
971[target_cpu_type=${target_cpu_type}
972 cgen_cpu_prefix=${cgen_cpu_prefix}
973 obj_format=${obj_format}
974 te_file=${te_file}])
975