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