Extend description of the --enable-compressed-debug-sections configure option in...
[external/binutils.git] / gas / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 dnl And be careful when changing it!  If you must add tests with square
4 dnl brackets, be sure changequote invocations surround it.
5 dnl
6 dnl   Copyright (C) 2012-2015 Free Software Foundation, Inc.
7 dnl
8 dnl This file is free software; you can redistribute it and/or modify
9 dnl it under the terms of the GNU General Public License as published by
10 dnl the Free Software Foundation; either version 3 of the License, or
11 dnl (at your option) any later version.
12 dnl
13 dnl This program is distributed in the hope that it will be useful,
14 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
15 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 dnl GNU General Public License for more details.
17 dnl
18 dnl You should have received a copy of the GNU General Public License
19 dnl along with this program; see the file COPYING3.  If not see
20 dnl <http://www.gnu.org/licenses/>.
21 dnl
22 dnl v2.5 needed for --bindir et al
23 AC_PREREQ(2.59)
24 m4_include([../bfd/version.m4])
25 AC_INIT([gas], BFD_VERSION)
26 AC_CONFIG_SRCDIR(as.h)
27
28 dnl Autoconf 2.57 will find the aux dir without this.  However, unless
29 dnl we specify this explicitly, automake-1.7 will assume that ylwrap is in
30 dnl gas/ instead of gas/../.
31 AC_CONFIG_AUX_DIR(..)
32 AC_CANONICAL_TARGET
33 AC_ISC_POSIX
34
35 AM_INIT_AUTOMAKE
36
37 AC_PROG_CC
38 AC_GNU_SOURCE
39 AC_USE_SYSTEM_EXTENSIONS
40
41 LT_INIT
42 ACX_LARGEFILE
43
44 AC_ARG_ENABLE(targets,
45 [  --enable-targets        alternative target configurations besides the primary],
46 [case "${enableval}" in
47   yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
48             ;;
49   no)       enable_targets= ;;
50   *)        enable_targets=$enableval ;;
51 esac])dnl
52
53 ac_checking=yes
54 if grep '^RELEASE=y' ${srcdir}/../bfd/Makefile.am >/dev/null 2>/dev/null ; then
55   ac_checking=
56 fi
57 AC_ARG_ENABLE(checking,
58 [  --enable-checking       enable run-time checks],
59 [case "${enableval}" in
60   no|none)  ac_checking= ;;
61   *)        ac_checking=yes ;;
62 esac])dnl
63 if test x$ac_checking != x ; then
64   AC_DEFINE(ENABLE_CHECKING, 1, [Define if you want run-time sanity checks.])
65 fi
66
67 # PR gas/19109
68 # Decide the default method for compressing debug sections.
69 ac_default_compressed_debug_sections=unset
70 # Provide a configure time option to override our default.
71 AC_ARG_ENABLE(compressed_debug_sections,
72 [  --enable-compressed-debug-sections={all,gas,none}  compress debug sections by default],
73 [case "${enableval}" in
74   yes | all | gas) ac_default_compressed_debug_sections=yes ;;
75   no | none)  ac_default_compressed_debug_sections=no ;;
76   *)   ac_default_compressed_debug_sections=unset ;;
77 esac])dnl
78
79 using_cgen=no
80
81 AM_BINUTILS_WARNINGS
82
83 # Generate a header file
84 AC_CONFIG_HEADERS(config.h:config.in)
85
86 # PR 14072
87 AH_VERBATIM([00_CONFIG_H_CHECK],
88 [/* Check that config.h is #included before system headers
89    (this works only for glibc, but that should be enough).  */
90 #if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
91 #  error config.h must be #included before system headers
92 #endif
93 #define __CONFIG_H__ 1])
94
95 # If we are on a DOS filesystem, we must use gdb.ini rather than
96 # .gdbinit.
97 case "${host}" in
98   *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-windows*)
99     GDBINIT="gdb.ini"
100     AC_CONFIG_FILES(gdb.ini:gdbinit.in)
101     ;;
102   *)
103     GDBINIT=".gdbinit"
104     AC_CONFIG_FILES(.gdbinit:gdbinit.in)
105     ;;
106 esac
107 AC_SUBST(GDBINIT)
108
109 #We need this for the host.  BOUT header is in host order.
110 AC_C_BIGENDIAN
111
112 te_file=generic
113
114 # Makefile target for installing gas in $(tooldir)/bin.
115 install_tooldir=install-exec-tooldir
116
117 canon_targets=""
118 all_targets=no
119 if test -n "$enable_targets" ; then
120   for t in `echo $enable_targets | sed 's/,/ /g'`; do
121     if test $t = "all"; then
122       all_targets=yes
123       continue
124     fi
125     result=`$ac_config_sub $t 2>/dev/null`
126     if test -n "$result" ; then
127       canon_targets="$canon_targets $result"
128 #    else
129 #      # Permit "all", etc.  We don't support it yet though.
130 #      canon_targets="$canon_targets $t"
131     fi
132   done
133   GAS_UNIQ(canon_targets)
134 fi
135
136 emulations=""
137
138 for this_target in $target $canon_targets ; do
139
140     targ=${this_target}
141     . ${srcdir}/configure.tgt
142
143     case ${target_cpu} in
144       crisv32)
145         AC_DEFINE_UNQUOTED(DEFAULT_CRIS_ARCH, $arch,
146                            [Default CRIS architecture.])
147         ;;
148     esac
149
150     if test ${this_target} = $target ; then
151       target_cpu_type=${cpu_type}
152     elif test ${target_cpu_type} != ${cpu_type} ; then
153       continue
154     fi
155
156     generic_target=${cpu_type}-${target_vendor}-${target_os}
157     case ${generic_target} in
158       i386-*-sco3.2v5*)
159         if test ${this_target} = $target; then
160           AC_DEFINE(SCO_ELF, 1, [Define if defaulting to ELF on SCO 5.])
161         fi
162         ;;
163
164       i386-*-msdosdjgpp* \
165       | i386-*-go32* \
166       | i386-go32-rtems*)
167         AC_DEFINE(STRICTCOFF, 1, [Using strict COFF?])
168         ;;
169
170       i860-*-*)
171         AC_MSG_WARN(GAS support for ${generic_target} is preliminary and a work in progress)
172         ;;
173
174       microblaze*)
175         ;;
176
177 changequote(,)dnl
178       ppc-*-aix[5-9].*)
179 changequote([,])dnl
180         AC_DEFINE(AIX_WEAK_SUPPORT, 1,
181                   [Define if using AIX 5.2 value for C_WEAKEXT.])
182         ;;
183       ppc-*-solaris*)
184         if test ${this_target} = $target; then
185           AC_DEFINE(TARGET_SOLARIS_COMMENT, 1,
186                     [Define if default target is PowerPC Solaris.])
187         fi
188         if test x${endian} = xbig; then
189           AC_MSG_ERROR(Solaris must be configured little endian)
190         fi
191         ;;
192
193       sh*-*-symbianelf*)
194         AC_DEFINE(TARGET_SYMBIAN, 1, [Define if target is Symbian OS.])
195         ;;
196     esac
197
198     if test ${this_target} = $target ; then
199       endian_def=
200       if test x${endian} = xbig; then
201         endian_def=1
202       elif test x${endian} = xlittle; then
203         endian_def=0
204       fi
205       if test x${endian_def} != x; then
206         AC_DEFINE_UNQUOTED(TARGET_BYTES_BIG_ENDIAN, $endian_def,
207                            [Define as 1 if big endian.])
208       fi
209     fi
210
211 # Other random stuff.
212
213     case ${cpu_type} in
214       mips)
215         # Set mips_cpu to the name of the default CPU.
216         case ${target_cpu} in
217           mips | mipsbe | mipseb | mipsle | mipsel | mips64 | mips64el)
218             mips_cpu=from-abi
219             ;;
220           mipsisa32 | mipsisa32el)
221             mips_cpu=mips32
222             ;;
223           mipsisa32r2 | mipsisa32r2el)
224             mips_cpu=mips32r2
225             ;;
226           mipsisa32r3 | mipsisa32r3el)
227             mips_cpu=mips32r3
228             ;;
229           mipsisa32r5 | mipsisa32r5el)
230             mips_cpu=mips32r5
231             ;;
232           mipsisa32r6 | mipsisa32r6el)
233             mips_cpu=mips32r6
234             ;;
235           mipsisa64 | mipsisa64el)
236             mips_cpu=mips64
237             ;;
238           mipsisa64r2 | mipsisa64r2el)
239             mips_cpu=mips64r2
240             ;;
241           mipsisa64r3 | mipsisa64r3el)
242             mips_cpu=mips64r3
243             ;;
244           mipsisa64r5 | mipsisa64r5el)
245             mips_cpu=mips64r5
246             ;;
247           mipsisa64r6 | mipsisa64r6el)
248             mips_cpu=mips64r6
249             ;;
250           mipstx39 | mipstx39el)
251             mips_cpu=r3900
252             ;;
253           mips64vr | mips64vrel)
254             mips_cpu=vr4100
255             ;;
256           mipsisa32r2* | mipsisa64r2*)
257 changequote(,)dnl
258             mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..r2//' -e 's/el$//'`
259 changequote([,])dnl
260             ;;
261           mipsisa32r6* | mipsisa64r6*)
262 changequote(,)dnl
263             mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..r6//' -e 's/el$//'`
264 changequote([,])dnl
265             ;;
266           mips64* | mipsisa64* | mipsisa32*)
267 changequote(,)dnl
268             mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..//' -e 's/el$//'`
269 changequote([,])dnl
270             ;;
271           mips*)
272 changequote(,)dnl
273             mips_cpu=`echo $target_cpu | sed -e 's/^mips//' -e 's/el$//'`
274 changequote([,])dnl
275             ;;
276           *)
277             AC_MSG_ERROR($target_cpu isn't a supported MIPS CPU name)
278             ;;
279         esac
280         # See whether it's appropriate to set E_MIPS_ABI_O32 for o32
281         # binaries.  It's a GNU extension that some OSes don't understand.
282         case ${target} in
283           *-*-irix*)
284             use_e_mips_abi_o32=0
285             ;;
286           *)
287             use_e_mips_abi_o32=1
288             ;;
289         esac
290         # Decide whether to generate 32-bit or 64-bit code by default.
291         # Used to resolve -march=from-abi when an embedded ABI is selected.
292         case ${target} in
293           mips64*-*-* | mipsisa64*-*-*)
294             mips_default_64bit=1
295             ;;
296           *)
297             mips_default_64bit=0
298             ;;
299         esac
300         # Decide which ABI to target by default.
301         case ${target} in
302           mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* | mips64*-kfreebsd*-gnu)
303             mips_default_abi=N32_ABI
304             ;;
305           mips*-linux* | mips*-freebsd* | mips*-kfreebsd*-gnu)
306             mips_default_abi=O32_ABI
307             ;;
308           mips64*-openbsd*)
309             mips_default_abi=N64_ABI
310             ;;
311           *)
312             mips_default_abi=NO_ABI
313             ;;
314         esac
315         AC_DEFINE_UNQUOTED(MIPS_CPU_STRING_DEFAULT, "$mips_cpu",
316                            [Default CPU for MIPS targets. ])
317         AC_DEFINE_UNQUOTED(USE_E_MIPS_ABI_O32, $use_e_mips_abi_o32,
318                            [Allow use of E_MIPS_ABI_O32 on MIPS targets. ])
319         AC_DEFINE_UNQUOTED(MIPS_DEFAULT_64BIT, $mips_default_64bit,
320                            [Generate 64-bit code by default on MIPS targets. ])
321         AC_DEFINE_UNQUOTED(MIPS_DEFAULT_ABI, $mips_default_abi,
322                            [Choose a default ABI for MIPS targets. ])
323         ;;
324     esac
325
326     # Do we need the opcodes library?
327     case ${cpu_type} in
328       vax | tic30)
329         ;;
330
331       *)
332         need_opcodes=yes
333
334         case "${enable_shared}" in
335         yes) shared_opcodes=true ;;
336         *opcodes*) shared_opcodes=true ;;
337         *) shared_opcodes=false ;;
338         esac
339         ;;
340     esac
341
342     # Any other special object files needed ?
343     case ${cpu_type} in
344
345       bfin)
346         echo ${extra_objects} | grep -s "bfin-parse.o"
347         if test $? -ne 0 ; then
348           extra_objects="$extra_objects bfin-parse.o"
349         fi
350
351         echo ${extra_objects} | grep -s "bfin-lex-wrapper.o"
352         if test $? -ne 0 ; then
353           extra_objects="$extra_objects bfin-lex-wrapper.o"
354         fi
355         ;;
356
357       epiphany | fr30 | ip2k | iq2000 | lm32 | m32r | or1k)
358         using_cgen=yes
359         ;;
360
361       m32c)
362         using_cgen=yes
363         ;;
364       frv)
365         using_cgen=yes
366         ;;
367       m68k)
368         case ${extra_objects} in
369         *m68k-parse.o*) ;;
370         *) extra_objects="$extra_objects m68k-parse.o" ;;
371         esac
372         ;;
373
374       mep)
375         using_cgen=yes
376         ;;
377
378       mips)
379         echo ${extra_objects} | grep -s "itbl-parse.o"
380         if test $? -ne 0 ; then
381           extra_objects="$extra_objects itbl-parse.o"
382         fi
383
384         echo ${extra_objects} | grep -s "itbl-lex-wrapper.o"
385         if test $? -ne 0 ; then
386           extra_objects="$extra_objects itbl-lex-wrapper.o"
387         fi
388
389         echo ${extra_objects} | grep -s "itbl-ops.o"
390         if test $? -ne 0 ; then
391           extra_objects="$extra_objects itbl-ops.o"
392         fi
393         ;;
394
395       mt)
396         using_cgen=yes
397         ;;
398
399       nds32)
400         # Decide BASELINE, REDUCED_REGS, FPU_DP_EXT, FPU_SP_EXT features
401         # based on arch_name.
402         AC_MSG_CHECKING(for default configuration of --with-arch)
403         if test "x${with_arch}" != x; then
404           case ${with_arch} in
405             v2j | v2s | v2f | v2 | v3m | v3j | v3s | v3f | v3 )
406               AC_DEFINE_UNQUOTED(NDS32_DEFAULT_ARCH_NAME, "$with_arch",
407                                  [Define value for nds32_arch_name])
408               ;;
409             *)
410               AC_MSG_ERROR(This kind of arch name does *NOT* exist!)
411               ;;
412           esac
413         fi
414         AC_MSG_RESULT($with_arch)
415
416         # Decide features one by one.
417         AC_MSG_CHECKING(for default configuration of --enable-dx-regs)
418         if test "x${enable_dx_regs}" = xyes; then
419           AC_DEFINE(NDS32_DEFAULT_DX_REGS, 1,
420                     [Define value for nds32_dx_regs])
421         else
422           AC_DEFINE(NDS32_DEFAULT_DX_REGS, 0,
423                     [Define default value for nds32_dx_regs])
424         fi
425         AC_MSG_RESULT($enable_dx_regs)
426
427         AC_MSG_CHECKING(for default configuration of --enable-perf-ext)
428         if test "x${enable_perf_ext}" = xno; then
429           AC_DEFINE(NDS32_DEFAULT_PERF_EXT, 0,
430                     [Define value for nds32_perf_ext])
431         else
432           AC_DEFINE(NDS32_DEFAULT_PERF_EXT, 1,
433                     [Define default value for nds32_perf_ext])
434         fi
435         AC_MSG_RESULT($enable_perf_ext)
436
437         AC_MSG_CHECKING(for default configuration of --enable-perf-ext2)
438         if test "x${enable_perf_ext2}" = xno; then
439           AC_DEFINE(NDS32_DEFAULT_PERF_EXT2, 0,
440                     [Define value for nds32_perf_ext2])
441         else
442           AC_DEFINE(NDS32_DEFAULT_PERF_EXT2, 1,
443                     [Define default value for nds32_perf_ext2])
444         fi
445         AC_MSG_RESULT($enable_perf_ext2)
446
447         AC_MSG_CHECKING(for default configuration of --enable-string-ext)
448         if test "x${enable_string_ext}" = xno; then
449           AC_DEFINE(NDS32_DEFAULT_STRING_EXT, 0,
450                     [Define value for nds32_string_ext])
451         else
452           AC_DEFINE(NDS32_DEFAULT_STRING_EXT, 1,
453                     [Define default value for nds32_string_ext])
454         fi
455         AC_MSG_RESULT($enable_string_ext)
456
457         AC_MSG_CHECKING(for default configuration of --enable-audio-ext)
458         if test "x${enable_audio_ext}" = xno; then
459           AC_DEFINE(NDS32_DEFAULT_AUDIO_EXT, 0,
460                     [Define value for nds32_audio_ext])
461         else
462           AC_DEFINE(NDS32_DEFAULT_AUDIO_EXT, 1,
463                     [Define default value for nds32_audio_ext])
464         fi
465         AC_MSG_RESULT($enable_audio_ext)
466         ;;
467
468       i386 | s390 | sparc)
469         if test $this_target = $target ; then
470           AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
471         fi
472         ;;
473
474       rl78)
475         echo ${extra_objects} | grep -s "rl78-parse.o"
476         if test $? -ne 0 ; then
477           extra_objects="$extra_objects rl78-parse.o"
478         fi
479         ;;
480
481       rx)
482         echo ${extra_objects} | grep -s "rx-parse.o"
483         if test $? -ne 0 ; then
484           extra_objects="$extra_objects rx-parse.o"
485         fi
486         ;;
487
488       xstormy16)
489         using_cgen=yes
490         ;;
491
492       xc16x)
493         using_cgen=yes
494         ;;
495
496       xtensa)
497         echo ${extra_objects} | grep -s "xtensa-relax.o"
498         if test $? -ne 0 ; then
499           extra_objects="$extra_objects xtensa-relax.o"
500         fi
501         ;;
502
503       *)
504         ;;
505     esac
506
507     if test $using_cgen = yes ; then
508         case "x${extra_objects}" in
509         *cgen.o*) ;;
510         *) extra_objects="$extra_objects cgen.o" ;;
511         esac
512     fi
513
514 # See if we really can support this configuration with the emulation code.
515
516     if test $this_target = $target ; then
517       obj_format=$fmt
518       te_file=$em
519     fi
520
521    case ${te_file} in
522       vms) extra_objects="$extra_objects te-vms.o" ;;
523    esac
524
525 # From target name and format, produce a list of supported emulations.
526
527     case ${generic_target}-${fmt} in
528       mips-*-*-*)       case "$endian" in
529                         big)    emulation="mipsbelf mipslelf mipself" ;;
530                         *)      emulation="mipslelf mipsbelf mipself" ;;
531                         esac ;;
532       # i386-pc-pe-coff != i386-pc-coff.
533       i386-*-pe-coff)   ;;
534       # Uncommenting the next line will turn on support for i386 AOUT
535       # for the default linux configuration
536       # i386-*-linux*-elf) emulation="i386elf i386aout" ;;
537       #
538       i386-*-aout)      emulation="i386aout" ;;
539       i386-*-coff)      emulation="i386coff" ;;
540       i386-*-elf)       emulation="i386elf" ;;
541
542       # Always all formats.  The first stated emulation becomes the default.
543       cris-*-*aout*)    emulation="crisaout criself" ;;
544       cris-*-*)         emulation="criself crisaout" ;;
545     esac
546
547     emulations="$emulations $emulation"
548
549 done
550
551 if test x$ac_default_compressed_debug_sections == xyes ; then
552   AC_DEFINE(DEFAULT_FLAG_COMPRESS_DEBUG, 1, [Define if you want compressed debug sections by default.])
553 fi
554
555 # Turn on all targets if possible
556 if test ${all_targets} = "yes"; then
557   case ${target_cpu_type} in
558   i386)
559     case ${obj_format} in
560     aout)
561       emulations="$emulations i386coff i386elf"
562       ;;
563     coff)
564       emulations="$emulations i386aout i386elf"
565     ;;
566     elf)
567       emulations="$emulations i386aout i386coff"
568       ;;
569     esac
570   ;;
571   x86_64)
572     case ${obj_format} in
573     aout)
574       emulations="$emulations i386coff i386elf"
575       ;;
576     coff)
577       emulations="$emulations i386aout i386elf"
578     ;;
579     elf)
580       emulations="$emulations i386aout i386coff"
581       ;;
582     esac
583   ;;
584   esac
585 fi
586
587 # PE code has way too many macros tweaking behaviour
588 case ${te_file} in
589   pe*) emulations="" ;;
590 esac
591
592 # Assign floating point type.  Most processors with FP support
593 # IEEE FP.  On those that don't support FP at all, usually IEEE
594 # is emulated.
595 case ${target_cpu} in
596   vax | pdp11 ) atof=vax ;;
597   *)            atof=ieee ;;
598 esac
599
600 case "${obj_format}" in
601   "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
602 esac
603
604 # Unfortunately the cpu in cpu-opc.h file isn't always $(TARGET_CPU).
605 cgen_cpu_prefix=""
606 if test $using_cgen = yes ; then
607   case ${target_cpu} in
608     or1knd)
609        cgen_cpu_prefix=or1k ;;
610     *) cgen_cpu_prefix=${target_cpu} ;;
611   esac
612   AC_SUBST(cgen_cpu_prefix)
613   AC_DEFINE(USING_CGEN, 1, [Using cgen code?])
614 fi
615
616 dnl
617 dnl Make sure the desired support files exist.
618 dnl
619
620 if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
621   AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
622 fi
623
624 if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
625   AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
626 fi
627
628 # Some COFF configurations want these random other flags set.
629 case ${obj_format} in
630   coff)
631     case ${target_cpu_type} in
632       i386) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;;
633       m68k) AC_DEFINE(M68KCOFF, 1, [Using m68k COFF?]) ;;
634       m88k) AC_DEFINE(M88KCOFF, 1, [Using m88k COFF?]) ;;
635       x86_64) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;;
636     esac
637     ;;
638 esac
639
640 # Getting this done right is going to be a bitch.  Each configuration specified
641 # with --enable-targets=... should be checked for environment, format, cpu
642 # setting.
643 #
644 # For each configuration, the necessary object file support code must be linked
645 # in.  This might be only one, it might be up to four.  The necessary emulation
646 # code needs to be provided, too.
647 #
648 # And then there's "--enable-targets=all"....
649 #
650 # For now, just always do it for MIPS ELF configurations.  Sigh.
651
652 formats="${obj_format}"
653 emfiles=""
654 EMULATIONS=""
655 GAS_UNIQ(emulations)
656 for em in . $emulations ; do
657   case $em in
658     .)  continue ;;
659     mipsbelf | mipslelf | mipself)
660         fmt=elf   file=mipself ;;
661     *coff)
662         fmt=coff  file=$em ;;
663     *aout)
664         fmt=aout file=$em ;;
665     *elf)
666         fmt=elf file=$em ;;
667   esac
668   formats="$formats $fmt"
669   emfiles="$emfiles e-$file.o"
670   EMULATIONS="$EMULATIONS &$em,"
671 done
672 GAS_UNIQ(formats)
673 GAS_UNIQ(emfiles)
674 if test `set . $formats ; shift ; echo $#` -gt 1 ; then
675   for fmt in $formats ; do
676     case $fmt in
677       aout)     AC_DEFINE(OBJ_MAYBE_AOUT, 1,    [a.out support?])   ;;
678       bout)     AC_DEFINE(OBJ_MAYBE_BOUT, 1,    [b.out support?])   ;;
679       coff)     AC_DEFINE(OBJ_MAYBE_COFF, 1,    [COFF support?])    ;;
680       ecoff)    AC_DEFINE(OBJ_MAYBE_ECOFF, 1,   [ECOFF support?])   ;;
681       elf)      AC_DEFINE(OBJ_MAYBE_ELF, 1,     [ELF support?])     ;;
682       generic)  AC_DEFINE(OBJ_MAYBE_GENERIC, 1, [generic support?]) ;;
683       som)      AC_DEFINE(OBJ_MAYBE_SOM, 1,     [SOM support?])     ;;
684     esac
685     extra_objects="$extra_objects obj-$fmt.o"
686   done
687   obj_format=multi
688 fi
689 if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
690   DEFAULT_EMULATION=`set . $emulations ; echo $2`
691   # e-mipself has more than one emulation per file, e-i386* has just one at the
692   # moment.  If only one emulation is specified, then don't define
693   # USE_EMULATIONS or include any of the e-files as they will only be bloat.
694   case "${obj_format}${emfiles}" in
695     multi* | *mipself*)
696       extra_objects="$extra_objects $emfiles"
697       AC_DEFINE(USE_EMULATIONS, 1, [Use emulation support?]) ;;
698   esac
699 fi
700 AC_SUBST(extra_objects)
701 AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS, [Supported emulations.])
702 AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION",
703                    [Default emulation.])
704
705 reject_dev_configs=yes
706
707 case ${reject_dev_configs}-${dev} in
708   yes-yes) # Oops.
709     AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
710     ;;
711 esac
712
713 AC_SUBST(target_cpu_type)
714 AC_SUBST(obj_format)
715 AC_SUBST(te_file)
716 AC_SUBST(install_tooldir)
717 AC_SUBST(atof)
718 dnl AC_SUBST(emulation)
719
720 # do we need the opcodes library?
721 case "${need_opcodes}" in
722 yes)
723   OPCODES_LIB=../opcodes/libopcodes.la
724   ;;
725 esac
726
727 AC_SUBST(OPCODES_LIB)
728
729 AC_DEFINE_UNQUOTED(TARGET_ALIAS,        "${target_alias}", [Target alias.])
730 AC_DEFINE_UNQUOTED(TARGET_CANONICAL,    "${target}",       [Canonical target.])
731 AC_DEFINE_UNQUOTED(TARGET_CPU,          "${target_cpu}",   [Target CPU.])
732 AC_DEFINE_UNQUOTED(TARGET_VENDOR,       "${target_vendor}", [Target vendor.])
733 AC_DEFINE_UNQUOTED(TARGET_OS,           "${target_os}",    [Target OS.])
734
735 AC_PROG_YACC
736 AM_PROG_LEX
737
738 ALL_LINGUAS="fr tr es rw id ru fi ja"
739 ZW_GNU_GETTEXT_SISTER_DIR
740 AM_PO_SUBDIRS
741
742 AM_MAINTAINER_MODE
743 AM_CONDITIONAL(GENINSRC_NEVER, false)
744 AC_EXEEXT
745
746 AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h errno.h sys/types.h limits.h locale.h time.h sys/stat.h)
747 ACX_HEADER_STRING
748
749 # Put this here so that autoconf's "cross-compiling" message doesn't confuse
750 # people who are not cross-compiling but are compiling cross-assemblers.
751 AC_MSG_CHECKING(whether compiling a cross-assembler)
752 if test "${host}" = "${target}"; then
753   cross_gas=no
754 else
755   cross_gas=yes
756   AC_DEFINE(CROSS_COMPILE, 1, [Compiling cross-assembler?])
757 fi
758 AC_MSG_RESULT($cross_gas)
759
760 dnl ansidecl.h will deal with const
761 dnl AC_C_CONST
762 AC_FUNC_ALLOCA
763 AC_C_INLINE
764
765 # VMS doesn't have unlink.
766 AC_CHECK_FUNCS(unlink remove, break)
767 AC_CHECK_FUNCS(sbrk setlocale)
768
769 AM_LC_MESSAGES
770
771 # do we need the math library?
772 case "${need_libm}" in
773 yes)
774   LT_LIB_M
775   AC_SUBST(LIBM)
776   ;;
777 esac
778
779 # Some non-ANSI preprocessors botch requoting inside strings.  That's bad
780 # enough, but on some of those systems, the assert macro relies on requoting
781 # working properly!
782 GAS_WORKING_ASSERT
783
784 # On some systems, the system header files may not declare malloc, realloc,
785 # and free.  There are places where gas needs these functions to have been
786 # declared -- such as when taking their addresses.
787 gas_test_headers="
788 #ifdef HAVE_MEMORY_H
789 #include <memory.h>
790 #endif
791 #ifdef HAVE_STRING_H
792 #include <string.h>
793 #else
794 #ifdef HAVE_STRINGS_H
795 #include <strings.h>
796 #endif
797 #endif
798 #ifdef HAVE_STDLIB_H
799 #include <stdlib.h>
800 #endif
801 #ifdef HAVE_UNISTD_H
802 #include <unistd.h>
803 #endif
804 "
805
806 # Does errno.h declare errno, or do we have to add a separate declaration
807 # for it?
808 GAS_CHECK_DECL_NEEDED(errno, f, int f, [
809 #ifdef HAVE_ERRNO_H
810 #include <errno.h>
811 #endif
812 ])
813
814 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
815 AC_CACHE_VAL(gas_cv_decl_getopt_unistd_h,
816 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
817 gas_cv_decl_getopt_unistd_h=yes, gas_cv_decl_getopt_unistd_h=no)])
818 AC_MSG_RESULT($gas_cv_decl_getopt_unistd_h)
819 if test $gas_cv_decl_getopt_unistd_h = yes; then
820   AC_DEFINE([HAVE_DECL_GETOPT], 1,
821             [Is the prototype for getopt in <unistd.h> in the expected format?])
822 fi
823
824 GAS_CHECK_DECL_NEEDED(environ, f, char **f, $gas_test_headers)
825 GAS_CHECK_DECL_NEEDED(ffs, f, int (*f)(int), $gas_test_headers)
826 GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
827 GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
828 GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
829 GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
830
831 AC_CHECK_DECLS([free, getenv, malloc, mempcpy, realloc, stpcpy, strstr, vsnprintf, asprintf])
832
833 BFD_BINARY_FOPEN
834
835 # Link in zlib if we can.  This allows us to write compressed debug sections.
836 AM_ZLIB
837
838 # Support for VMS timestamps via cross compile
839
840 if test "$ac_cv_header_time_h" = yes; then
841   GAS_HAVE_TIME_TYPE_MEMBER(struct tm, tm_gmtoff)
842 fi
843
844 if test "$ac_cv_header_sys_stat_h" = yes; then
845     GAS_HAVE_SYS_STAT_TYPE_MEMBER(struct stat, st_mtim, tv_sec)
846     GAS_HAVE_SYS_STAT_TYPE_MEMBER(struct stat, st_mtim, tv_nsec)
847 fi
848
849
850 dnl Required for html, pdf, install-pdf and install-html targets.
851 AC_SUBST(datarootdir)
852 AC_SUBST(docdir)
853 AC_SUBST(htmldir)
854 AC_SUBST(pdfdir)
855
856 dnl This must come last.
857
858 dnl We used to make symlinks to files in the source directory, but now
859 dnl we just use the right name for .c files, and create .h files in
860 dnl the build directory which include the right .h file.  Make sure
861 dnl the old symlinks don't exist, so that a reconfigure in an existing
862 dnl directory behaves reasonably.
863
864 AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)
865 AC_CONFIG_COMMANDS([default],
866 [rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
867  echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
868  echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
869  echo '#include "te-'"${te_file}"'.h"' > targ-env.h
870  echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
871  if test "x$cgen_cpu_prefix" != x ; then
872    echo '#include "opcodes/'"${cgen_cpu_prefix}"'-desc.h"' > cgen-desc.h
873  fi],
874 [target_cpu_type=${target_cpu_type}
875  cgen_cpu_prefix=${cgen_cpu_prefix}
876  obj_format=${obj_format}
877  te_file=${te_file}])
878
879 AC_OUTPUT