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