15ba6b03cSchristosdnl Process this file with autoconf to produce a configure script.
25ba6b03cSchristosdnl
35ba6b03cSchristosdnl And be careful when changing it!  If you must add tests with square
45ba6b03cSchristosdnl brackets, be sure changequote invocations surround it.
55ba6b03cSchristosdnl
6*e072ec67Schristosdnl   Copyright (C) 2012-2022 Free Software Foundation, Inc.
75ba6b03cSchristosdnl
85ba6b03cSchristosdnl This file is free software; you can redistribute it and/or modify
95ba6b03cSchristosdnl it under the terms of the GNU General Public License as published by
105ba6b03cSchristosdnl the Free Software Foundation; either version 3 of the License, or
115ba6b03cSchristosdnl (at your option) any later version.
125ba6b03cSchristosdnl
135ba6b03cSchristosdnl This program is distributed in the hope that it will be useful,
145ba6b03cSchristosdnl but WITHOUT ANY WARRANTY; without even the implied warranty of
155ba6b03cSchristosdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
165ba6b03cSchristosdnl GNU General Public License for more details.
175ba6b03cSchristosdnl
185ba6b03cSchristosdnl You should have received a copy of the GNU General Public License
195ba6b03cSchristosdnl along with this program; see the file COPYING3.  If not see
205ba6b03cSchristosdnl <http://www.gnu.org/licenses/>.
215ba6b03cSchristosdnl
225ba6b03cSchristosdnl v2.5 needed for --bindir et al
235ba6b03cSchristosm4_include([../bfd/version.m4])
245ba6b03cSchristosAC_INIT([gas], BFD_VERSION)
255ba6b03cSchristosAC_CONFIG_SRCDIR(as.h)
265ba6b03cSchristos
275ba6b03cSchristosdnl Autoconf 2.57 will find the aux dir without this.  However, unless
285ba6b03cSchristosdnl we specify this explicitly, automake-1.7 will assume that ylwrap is in
295ba6b03cSchristosdnl gas/ instead of gas/../.
305ba6b03cSchristosAC_CONFIG_AUX_DIR(..)
315ba6b03cSchristosAC_CANONICAL_TARGET
325ba6b03cSchristos
335ba6b03cSchristosAM_INIT_AUTOMAKE
34*e072ec67SchristosAM_SILENT_RULES([yes])
355ba6b03cSchristos
365ba6b03cSchristosAC_PROG_CC
375ba6b03cSchristosAC_GNU_SOURCE
385ba6b03cSchristosAC_USE_SYSTEM_EXTENSIONS
395ba6b03cSchristos
405ba6b03cSchristosLT_INIT
415ba6b03cSchristosACX_LARGEFILE
42aa4b58b1SchristosACX_PROG_CMP_IGNORE_INITIAL
435ba6b03cSchristos
445ba6b03cSchristosAC_ARG_ENABLE(targets,
455ba6b03cSchristos[  --enable-targets        alternative target configurations besides the primary],
465ba6b03cSchristos[case "${enableval}" in
475ba6b03cSchristos  yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
485ba6b03cSchristos	    ;;
495ba6b03cSchristos  no)	    enable_targets= ;;
505ba6b03cSchristos  *)	    enable_targets=$enableval ;;
515ba6b03cSchristosesac])dnl
525ba6b03cSchristos
535ba6b03cSchristosac_checking=
54c21fdd85Schristos. ${srcdir}/../bfd/development.sh
55c21fdd85Schristostest "$development" = true && ac_checking=yes
565ba6b03cSchristosAC_ARG_ENABLE(checking,
575ba6b03cSchristos[  --enable-checking       enable run-time checks],
585ba6b03cSchristos[case "${enableval}" in
595ba6b03cSchristos  no|none)  ac_checking= ;;
605ba6b03cSchristos  *)	    ac_checking=yes ;;
615ba6b03cSchristosesac])dnl
625ba6b03cSchristosif test x$ac_checking != x ; then
635ba6b03cSchristos  AC_DEFINE(ENABLE_CHECKING, 1, [Define if you want run-time sanity checks.])
645ba6b03cSchristosfi
655ba6b03cSchristos
665ba6b03cSchristos# PR gas/19109
675ba6b03cSchristos# Decide the default method for compressing debug sections.
685ba6b03cSchristosac_default_compressed_debug_sections=unset
695ba6b03cSchristos# Provide a configure time option to override our default.
705ba6b03cSchristosAC_ARG_ENABLE(compressed_debug_sections,
715ba6b03cSchristos	      AS_HELP_STRING([--enable-compressed-debug-sections={all,gas,none}],
72ad93aa80Schristos	      [compress debug sections by default]),
735ba6b03cSchristos[case ,"${enableval}", in
745ba6b03cSchristos  ,yes, | ,all, | *,gas,*) ac_default_compressed_debug_sections=yes ;;
755ba6b03cSchristos  ,no, | ,none,)  ac_default_compressed_debug_sections=no ;;
765ba6b03cSchristos  *)   ac_default_compressed_debug_sections=unset ;;
775ba6b03cSchristosesac])dnl
785ba6b03cSchristos
79fe4a9685Schristos# PR gas/19520
80fe4a9685Schristos# Decide if x86 assembler should generate relax relocations.
81fe4a9685Schristosac_default_x86_relax_relocations=unset
82fe4a9685Schristos# Provide a configure time option to override our default.
83fe4a9685SchristosAC_ARG_ENABLE(x86_relax_relocations,
84fe4a9685Schristos	      AS_HELP_STRING([--enable-x86-relax-relocations],
85fe4a9685Schristos	      [generate x86 relax relocations by default]),
86fe4a9685Schristos[case "${enableval}" in
87fe4a9685Schristos  no)  ac_default_x86_relax_relocations=0 ;;
88fe4a9685Schristosesac])dnl
89fe4a9685Schristos
90ad93aa80Schristos# Decide if ELF assembler should generate common symbols with the
91ad93aa80Schristos# STT_COMMON type.
92ad93aa80Schristosac_default_elf_stt_common=unset
93ad93aa80Schristos# Provide a configure time option to override our default.
94ad93aa80SchristosAC_ARG_ENABLE(elf_stt_common,
95ad93aa80Schristos	      AS_HELP_STRING([--enable-elf-stt-common],
96ad93aa80Schristos	      [generate ELF common symbols with STT_COMMON type by default]),
97ad93aa80Schristos[case "${enableval}" in
98ad93aa80Schristos  yes)  ac_default_elf_stt_common=1 ;;
99ad93aa80Schristosesac])dnl
100ad93aa80Schristos
101916041edSchristos
102916041edSchristos# Decide if the ELF assembler should default to generating
103916041edSchristos# GNU Build notes if none are provided by the input.
104916041edSchristosac_default_generate_build_notes=0
105916041edSchristos# Provide a configuration option to override the default.
106916041edSchristosAC_ARG_ENABLE(generate_build_notes,
107916041edSchristos	      AS_HELP_STRING([--enable-generate-build-notes],
108916041edSchristos	      [generate GNU Build notes if none are provided by the input]),
109916041edSchristos[case "${enableval}" in
110916041edSchristos  yes)  ac_default_generate_build_notes=1 ;;
111916041edSchristos  no)   ac_default_generate_build_notes=0 ;;
112916041edSchristosesac])dnl
113916041edSchristos
114c21fdd85Schristos# Decide if the MIPS assembler should default to enable MIPS fix Loongson3
115c21fdd85Schristos# LLSC errata.
116c21fdd85Schristosac_default_mips_fix_loongson3_llsc=unset
117c21fdd85Schristos# Provide a configuration option to override the default.
118c21fdd85SchristosAC_ARG_ENABLE(mips-fix-loongson3-llsc,
119c21fdd85Schristos             AS_HELP_STRING([--enable-mips-fix-loongson3-llsc],
120c21fdd85Schristos             [enable MIPS fix Loongson3 LLSC errata]),
121c21fdd85Schristos[case "${enableval}" in
122c21fdd85Schristos  yes)  ac_default_mips_fix_loongson3_llsc=1 ;;
123c21fdd85Schristos  no)   ac_default_mips_fix_loongson3_llsc=0 ;;
124c21fdd85Schristosesac])dnl
125c21fdd85Schristos
126c21fdd85Schristos# Decide if the x86 ELF assembler should default to generating GNU x86
127c21fdd85Schristos# used ISA and feature properties.
128c21fdd85Schristosac_default_generate_x86_used_note=unset
129c21fdd85Schristos# Provide a configuration option to override the default.
130c21fdd85SchristosAC_ARG_ENABLE(x86-used-note,
131c21fdd85Schristos	      AS_HELP_STRING([--enable-x86-used-note],
132c21fdd85Schristos	      [generate GNU x86 used ISA and feature properties]),
133c21fdd85Schristos[case "${enableval}" in
134c21fdd85Schristos  yes)  ac_default_generate_x86_used_note=1 ;;
135c21fdd85Schristos  no)   ac_default_generate_x86_used_note=0 ;;
136c21fdd85Schristosesac])dnl
137c21fdd85Schristos
138c21fdd85Schristos# Decide if the RISC-V ELF assembler should default to generating attribute.
139c21fdd85Schristosac_default_generate_riscv_attr=unset
140c21fdd85Schristos# Provide a configuration option to override the default.
141c21fdd85SchristosAC_ARG_ENABLE(default-riscv-attribute,
142c21fdd85Schristos	      AS_HELP_STRING([--enable-default-riscv-attribute],
143c21fdd85Schristos	      [generate RISC-V arch attribute by default]),
144c21fdd85Schristos[case "${enableval}" in
145c21fdd85Schristos  yes)  ac_default_generate_riscv_attr=1 ;;
146c21fdd85Schristos  no)   ac_default_generate_riscv_attr=0 ;;
147c21fdd85Schristosesac])dnl
148916041edSchristos
1495ba6b03cSchristosusing_cgen=no
1505ba6b03cSchristos
1515ba6b03cSchristosAM_BINUTILS_WARNINGS
1525ba6b03cSchristos
1535ba6b03cSchristos# Generate a header file
1545ba6b03cSchristosAC_CONFIG_HEADERS(config.h:config.in)
1555ba6b03cSchristos
156ad93aa80Schristosdnl Option --with-cpu=TYPE allows configure type control of the default
157ad93aa80Schristosdnl cpu type within the assembler.  Currently only the ARC target
158ad93aa80Schristosdnl supports this feature, but others may be added in the future.
159ad93aa80SchristosAC_ARG_WITH(cpu,
160ad93aa80Schristos            AS_HELP_STRING([--with-cpu=CPU],
161ad93aa80Schristos            [default cpu variant is CPU (currently only supported on ARC)]),
162ad93aa80Schristos            [AC_DEFINE_UNQUOTED(TARGET_WITH_CPU,
163ad93aa80Schristos                                "${with_cpu}",
164ad93aa80Schristos                                [Target specific CPU.])],
165ad93aa80Schristos            [])
166ad93aa80Schristos
1675ba6b03cSchristos# PR 14072
1685ba6b03cSchristosAH_VERBATIM([00_CONFIG_H_CHECK],
1695ba6b03cSchristos[/* Check that config.h is #included before system headers
1705ba6b03cSchristos   (this works only for glibc, but that should be enough).  */
1715ba6b03cSchristos#if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
1725ba6b03cSchristos#  error config.h must be #included before system headers
1735ba6b03cSchristos#endif
1745ba6b03cSchristos#define __CONFIG_H__ 1])
1755ba6b03cSchristos
1765ba6b03cSchristos# If we are on a DOS filesystem, we must use gdb.ini rather than
1775ba6b03cSchristos# .gdbinit.
1785ba6b03cSchristoscase "${host}" in
1795ba6b03cSchristos  *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-windows*)
1805ba6b03cSchristos    GDBINIT="gdb.ini"
1815ba6b03cSchristos    AC_CONFIG_FILES(gdb.ini:gdbinit.in)
1825ba6b03cSchristos    ;;
1835ba6b03cSchristos  *)
1845ba6b03cSchristos    GDBINIT=".gdbinit"
1855ba6b03cSchristos    AC_CONFIG_FILES(.gdbinit:gdbinit.in)
1865ba6b03cSchristos    ;;
1875ba6b03cSchristosesac
1885ba6b03cSchristosAC_SUBST(GDBINIT)
1895ba6b03cSchristos
190916041edSchristos#We need this for the host.
1915ba6b03cSchristosAC_C_BIGENDIAN
1925ba6b03cSchristos
1935ba6b03cSchristoste_file=generic
1945ba6b03cSchristos
1955ba6b03cSchristos# Makefile target for installing gas in $(tooldir)/bin.
1965ba6b03cSchristosinstall_tooldir=install-exec-tooldir
1975ba6b03cSchristos
1985ba6b03cSchristoscanon_targets=""
1995ba6b03cSchristosall_targets=no
2005ba6b03cSchristosif test -n "$enable_targets" ; then
2015ba6b03cSchristos  for t in `echo $enable_targets | sed 's/,/ /g'`; do
2025ba6b03cSchristos    if test $t = "all"; then
2035ba6b03cSchristos      all_targets=yes
2045ba6b03cSchristos      continue
2055ba6b03cSchristos    fi
2065ba6b03cSchristos    result=`$ac_config_sub $t 2>/dev/null`
2075ba6b03cSchristos    if test -n "$result" ; then
2085ba6b03cSchristos      canon_targets="$canon_targets $result"
2095ba6b03cSchristos#    else
2105ba6b03cSchristos#      # Permit "all", etc.  We don't support it yet though.
2115ba6b03cSchristos#      canon_targets="$canon_targets $t"
2125ba6b03cSchristos    fi
2135ba6b03cSchristos  done
2145ba6b03cSchristos  GAS_UNIQ(canon_targets)
2155ba6b03cSchristosfi
2165ba6b03cSchristos
2175ba6b03cSchristosemulations=""
2185ba6b03cSchristos
2195ba6b03cSchristosfor this_target in $target $canon_targets ; do
2205ba6b03cSchristos
2215ba6b03cSchristos    targ=${this_target}
2225ba6b03cSchristos    . ${srcdir}/configure.tgt
2235ba6b03cSchristos
2245ba6b03cSchristos    case ${target_cpu} in
2255ba6b03cSchristos      crisv32)
2265ba6b03cSchristos	AC_DEFINE_UNQUOTED(DEFAULT_CRIS_ARCH, $arch,
2275ba6b03cSchristos			   [Default CRIS architecture.])
2285ba6b03cSchristos	;;
2295ba6b03cSchristos    esac
2305ba6b03cSchristos
2315ba6b03cSchristos    if test ${this_target} = $target ; then
2325ba6b03cSchristos      target_cpu_type=${cpu_type}
2335ba6b03cSchristos    elif test ${target_cpu_type} != ${cpu_type} ; then
2345ba6b03cSchristos      continue
2355ba6b03cSchristos    fi
2365ba6b03cSchristos
2375ba6b03cSchristos    generic_target=${cpu_type}-${target_vendor}-${target_os}
2385ba6b03cSchristos    case ${generic_target} in
2395ba6b03cSchristos      i386-*-msdosdjgpp* \
2405ba6b03cSchristos      | i386-*-go32* \
2415ba6b03cSchristos      | i386-go32-rtems*)
2425ba6b03cSchristos	AC_DEFINE(STRICTCOFF, 1, [Using strict COFF?])
2435ba6b03cSchristos	;;
2445ba6b03cSchristos
245*e072ec67Schristos      i386-*-linux-* | x86_64-*-linux-*)
246*e072ec67Schristos	if test ${this_target} = $target \
247*e072ec67Schristos	   && test ${ac_default_generate_x86_used_note} = unset; then
248*e072ec67Schristos	  ac_default_generate_x86_used_note=1
249*e072ec67Schristos	fi
250*e072ec67Schristos	;;
251*e072ec67Schristos
252fe4a9685Schristos      i386-*-solaris2 \
253fe4a9685Schristos      | x86_64-*-solaris2 \
254fe4a9685Schristos      | i386-*-solaris2.[[0-9]] \
255fe4a9685Schristos      | i386-*-solaris2.1[[01]] \
256fe4a9685Schristos      | x86_64-*-solaris2.1[[01]])
257fe4a9685Schristos	if test ${this_target} = $target \
258fe4a9685Schristos	   && test ${ac_default_x86_relax_relocations} = unset; then
259fe4a9685Schristos	  ac_default_x86_relax_relocations=0
260fe4a9685Schristos	fi
261fe4a9685Schristos	;;
262fe4a9685Schristos
2635ba6b03cSchristos      microblaze*)
2645ba6b03cSchristos        ;;
2655ba6b03cSchristos
2665ba6b03cSchristoschangequote(,)dnl
2675ba6b03cSchristos      ppc-*-aix[5-9].*)
2685ba6b03cSchristoschangequote([,])dnl
2695ba6b03cSchristos	AC_DEFINE(AIX_WEAK_SUPPORT, 1,
2705ba6b03cSchristos		  [Define if using AIX 5.2 value for C_WEAKEXT.])
2715ba6b03cSchristos	;;
2725ba6b03cSchristos      ppc-*-solaris*)
2735ba6b03cSchristos	if test ${this_target} = $target; then
2745ba6b03cSchristos	  AC_DEFINE(TARGET_SOLARIS_COMMENT, 1,
2755ba6b03cSchristos		    [Define if default target is PowerPC Solaris.])
2765ba6b03cSchristos	fi
2775ba6b03cSchristos	if test x${endian} = xbig; then
2785ba6b03cSchristos	  AC_MSG_ERROR(Solaris must be configured little endian)
2795ba6b03cSchristos	fi
2805ba6b03cSchristos	;;
2815ba6b03cSchristos    esac
2825ba6b03cSchristos
2835ba6b03cSchristos    if test ${this_target} = $target ; then
2845ba6b03cSchristos      endian_def=
2855ba6b03cSchristos      if test x${endian} = xbig; then
2865ba6b03cSchristos	endian_def=1
2875ba6b03cSchristos      elif test x${endian} = xlittle; then
2885ba6b03cSchristos	endian_def=0
2895ba6b03cSchristos      fi
2905ba6b03cSchristos      if test x${endian_def} != x; then
2915ba6b03cSchristos	AC_DEFINE_UNQUOTED(TARGET_BYTES_BIG_ENDIAN, $endian_def,
2925ba6b03cSchristos			   [Define as 1 if big endian.])
2935ba6b03cSchristos      fi
2945ba6b03cSchristos    fi
2955ba6b03cSchristos
2965ba6b03cSchristos# Other random stuff.
2975ba6b03cSchristos
2985ba6b03cSchristos    case ${cpu_type} in
2995ba6b03cSchristos      mips)
3005ba6b03cSchristos	# Set mips_cpu to the name of the default CPU.
3015ba6b03cSchristos	case ${target_cpu} in
302da500f8bSchristos	  mips | mipsbe | mipseb | mipsle | mipsel | mips64 | mips64el | mips64eb | mipsn64el | mipsn64eb )
3035ba6b03cSchristos	    mips_cpu=from-abi
3045ba6b03cSchristos	    ;;
3055ba6b03cSchristos	  mipsisa32 | mipsisa32el)
3065ba6b03cSchristos	    mips_cpu=mips32
3075ba6b03cSchristos	    ;;
3085ba6b03cSchristos	  mipsisa32r2 | mipsisa32r2el)
3095ba6b03cSchristos	    mips_cpu=mips32r2
3105ba6b03cSchristos	    ;;
3115ba6b03cSchristos	  mipsisa32r3 | mipsisa32r3el)
3125ba6b03cSchristos	    mips_cpu=mips32r3
3135ba6b03cSchristos	    ;;
3145ba6b03cSchristos	  mipsisa32r5 | mipsisa32r5el)
3155ba6b03cSchristos	    mips_cpu=mips32r5
3165ba6b03cSchristos	    ;;
3175ba6b03cSchristos	  mipsisa32r6 | mipsisa32r6el)
3185ba6b03cSchristos	    mips_cpu=mips32r6
3195ba6b03cSchristos	    ;;
3205ba6b03cSchristos	  mipsisa64 | mipsisa64el)
3215ba6b03cSchristos	    mips_cpu=mips64
3225ba6b03cSchristos	    ;;
3235ba6b03cSchristos	  mipsisa64r2 | mipsisa64r2el)
3245ba6b03cSchristos	    mips_cpu=mips64r2
3255ba6b03cSchristos	    ;;
3265ba6b03cSchristos	  mipsisa64r3 | mipsisa64r3el)
3275ba6b03cSchristos	    mips_cpu=mips64r3
3285ba6b03cSchristos	    ;;
3295ba6b03cSchristos	  mipsisa64r5 | mipsisa64r5el)
3305ba6b03cSchristos	    mips_cpu=mips64r5
3315ba6b03cSchristos	    ;;
3325ba6b03cSchristos	  mipsisa64r6 | mipsisa64r6el)
3335ba6b03cSchristos	    mips_cpu=mips64r6
3345ba6b03cSchristos	    ;;
3355ba6b03cSchristos	  mipstx39 | mipstx39el)
3365ba6b03cSchristos	    mips_cpu=r3900
3375ba6b03cSchristos	    ;;
3385ba6b03cSchristos	  mips64vr | mips64vrel)
3395ba6b03cSchristos	    mips_cpu=vr4100
3405ba6b03cSchristos	    ;;
3415ba6b03cSchristos	  mipsisa32r2* | mipsisa64r2*)
3425ba6b03cSchristoschangequote(,)dnl
3435ba6b03cSchristos	    mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..r2//' -e 's/el$//'`
3445ba6b03cSchristoschangequote([,])dnl
3455ba6b03cSchristos	    ;;
3465ba6b03cSchristos	  mipsisa32r6* | mipsisa64r6*)
3475ba6b03cSchristoschangequote(,)dnl
3485ba6b03cSchristos	    mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..r6//' -e 's/el$//'`
3495ba6b03cSchristoschangequote([,])dnl
3505ba6b03cSchristos	    ;;
3515ba6b03cSchristos	  mips64* | mipsisa64* | mipsisa32*)
3525ba6b03cSchristoschangequote(,)dnl
3535ba6b03cSchristos	    mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..//' -e 's/el$//'`
3545ba6b03cSchristoschangequote([,])dnl
3555ba6b03cSchristos	    ;;
3565ba6b03cSchristos	  mips*)
3575ba6b03cSchristoschangequote(,)dnl
3585ba6b03cSchristos	    mips_cpu=`echo $target_cpu | sed -e 's/^mips//' -e 's/el$//'`
3595ba6b03cSchristoschangequote([,])dnl
3605ba6b03cSchristos	    ;;
3615ba6b03cSchristos	  *)
3625ba6b03cSchristos	    AC_MSG_ERROR($target_cpu isn't a supported MIPS CPU name)
3635ba6b03cSchristos	    ;;
3645ba6b03cSchristos	esac
3655ba6b03cSchristos	# See whether it's appropriate to set E_MIPS_ABI_O32 for o32
3665ba6b03cSchristos	# binaries.  It's a GNU extension that some OSes don't understand.
3675ba6b03cSchristos	case ${target} in
3685ba6b03cSchristos	  *-*-irix*)
3695ba6b03cSchristos	    use_e_mips_abi_o32=0
3705ba6b03cSchristos	    ;;
3715ba6b03cSchristos	  *)
3725ba6b03cSchristos	    use_e_mips_abi_o32=1
3735ba6b03cSchristos	    ;;
3745ba6b03cSchristos	esac
3755ba6b03cSchristos	# Decide whether to generate 32-bit or 64-bit code by default.
3765ba6b03cSchristos	# Used to resolve -march=from-abi when an embedded ABI is selected.
3775ba6b03cSchristos	case ${target} in
3785ba6b03cSchristos	  mips64*-*-* | mipsisa64*-*-*)
3795ba6b03cSchristos	    mips_default_64bit=1
3805ba6b03cSchristos	    ;;
3815ba6b03cSchristos	  *)
3825ba6b03cSchristos	    mips_default_64bit=0
3835ba6b03cSchristos	    ;;
3845ba6b03cSchristos	esac
3855ba6b03cSchristos	# Decide which ABI to target by default.
3865ba6b03cSchristos	case ${target} in
387aa4b58b1Schristos	  mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* \
388aa4b58b1Schristos	  | mips64*-kfreebsd*-gnu | mips64*-ps2-elf*)
3895ba6b03cSchristos	    mips_default_abi=N32_ABI
3905ba6b03cSchristos	    ;;
3915ba6b03cSchristos	  mips*-linux* | mips*-freebsd* | mips*-kfreebsd*-gnu)
3925ba6b03cSchristos	    mips_default_abi=O32_ABI
3935ba6b03cSchristos	    ;;
3945ba6b03cSchristos	  mips64*-openbsd*)
3955ba6b03cSchristos	    mips_default_abi=N64_ABI
3965ba6b03cSchristos	    ;;
3975ba6b03cSchristos	  *)
3985ba6b03cSchristos	    mips_default_abi=NO_ABI
3995ba6b03cSchristos	    ;;
4005ba6b03cSchristos	esac
4015ba6b03cSchristos	AC_DEFINE_UNQUOTED(MIPS_CPU_STRING_DEFAULT, "$mips_cpu",
4025ba6b03cSchristos			   [Default CPU for MIPS targets. ])
4035ba6b03cSchristos	AC_DEFINE_UNQUOTED(USE_E_MIPS_ABI_O32, $use_e_mips_abi_o32,
4045ba6b03cSchristos			   [Allow use of E_MIPS_ABI_O32 on MIPS targets. ])
4055ba6b03cSchristos	AC_DEFINE_UNQUOTED(MIPS_DEFAULT_64BIT, $mips_default_64bit,
4065ba6b03cSchristos			   [Generate 64-bit code by default on MIPS targets. ])
4075ba6b03cSchristos	AC_DEFINE_UNQUOTED(MIPS_DEFAULT_ABI, $mips_default_abi,
4085ba6b03cSchristos			   [Choose a default ABI for MIPS targets. ])
4095ba6b03cSchristos	;;
4105ba6b03cSchristos    esac
4115ba6b03cSchristos
4125ba6b03cSchristos    # Do we need the opcodes library?
4135ba6b03cSchristos    case ${cpu_type} in
4145ba6b03cSchristos      vax | tic30)
4155ba6b03cSchristos	;;
4165ba6b03cSchristos
4175ba6b03cSchristos      *)
4185ba6b03cSchristos	need_opcodes=yes
4195ba6b03cSchristos
4205ba6b03cSchristos	case "${enable_shared}" in
4215ba6b03cSchristos	yes) shared_opcodes=true ;;
4225ba6b03cSchristos	*opcodes*) shared_opcodes=true ;;
4235ba6b03cSchristos	*) shared_opcodes=false ;;
4245ba6b03cSchristos	esac
4255ba6b03cSchristos	;;
4265ba6b03cSchristos    esac
4275ba6b03cSchristos
4285ba6b03cSchristos    # Any other special object files needed ?
4295ba6b03cSchristos    case ${cpu_type} in
4305ba6b03cSchristos
4315ba6b03cSchristos      bfin)
432*e072ec67Schristos	for f in config/bfin-parse.o config/bfin-lex-wrapper.o; do
433916041edSchristos	  case " $extra_objects " in
434916041edSchristos	    *" $f "*) ;;
435916041edSchristos	    *) extra_objects="$extra_objects $f" ;;
436916041edSchristos	  esac
437916041edSchristos	done
4385ba6b03cSchristos	;;
4395ba6b03cSchristos
440c21fdd85Schristos      bpf)
441c21fdd85Schristos      	if test $this_target = $target ; then
442c21fdd85Schristos	  AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
443c21fdd85Schristos	fi
444c21fdd85Schristos        using_cgen=yes
445c21fdd85Schristos        ;;
4465ba6b03cSchristos      epiphany | fr30 | ip2k | iq2000 | lm32 | m32r | or1k)
4475ba6b03cSchristos	using_cgen=yes
4485ba6b03cSchristos	;;
4495ba6b03cSchristos
450*e072ec67Schristos      loongarch)
451*e072ec67Schristos	for f in config/loongarch-parse.o config/loongarch-lex-wrapper.o; do
452*e072ec67Schristos	  case " $extra_objects " in
453*e072ec67Schristos	    *" $f "*) ;;
454*e072ec67Schristos	    *) extra_objects="$extra_objects $f" ;;
455*e072ec67Schristos	  esac
456*e072ec67Schristos	done
457*e072ec67Schristos        # --target=loongarch[32|64]-*-*.  */
458*e072ec67Schristos        if test $this_target = $target ; then
459*e072ec67Schristos          AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
460*e072ec67Schristos        fi
461*e072ec67Schristos	;;
462*e072ec67Schristos
4635ba6b03cSchristos      m32c)
4645ba6b03cSchristos	using_cgen=yes
4655ba6b03cSchristos	;;
4665ba6b03cSchristos      frv)
4675ba6b03cSchristos	using_cgen=yes
4685ba6b03cSchristos	;;
4695ba6b03cSchristos      m68k)
470*e072ec67Schristos	f=config/m68k-parse.o
471916041edSchristos	case " $extra_objects " in
472916041edSchristos	  *" $f "*) ;;
473916041edSchristos	  *) extra_objects="$extra_objects $f" ;;
4745ba6b03cSchristos	esac
4755ba6b03cSchristos	;;
4765ba6b03cSchristos
4775ba6b03cSchristos      mep)
4785ba6b03cSchristos	using_cgen=yes
4795ba6b03cSchristos	;;
4805ba6b03cSchristos
4815ba6b03cSchristos      mips)
482916041edSchristos	for f in itbl-parse.o itbl-lex-wrapper.o itbl-ops.o; do
483916041edSchristos	  case " $extra_objects " in
484916041edSchristos	    *" $f "*) ;;
485916041edSchristos	    *) extra_objects="$extra_objects $f" ;;
486916041edSchristos	  esac
487916041edSchristos	done
4885ba6b03cSchristos	;;
4895ba6b03cSchristos
4905ba6b03cSchristos      mt)
4915ba6b03cSchristos	using_cgen=yes
4925ba6b03cSchristos	;;
4935ba6b03cSchristos
4945ba6b03cSchristos      nds32)
495c21fdd85Schristos	# setup NDS32_LINUX_TOOLCHAIN definition
496c21fdd85Schristos	if test "linux" = $em; then
497c21fdd85Schristos	  AC_DEFINE(NDS32_LINUX_TOOLCHAIN, 1,
498c21fdd85Schristos	    [Define value for nds32_linux_toolchain])
499c21fdd85Schristos	else
500c21fdd85Schristos	  AC_DEFINE(NDS32_LINUX_TOOLCHAIN, 0,
501c21fdd85Schristos	    [Define default value for nds32_linux_toolchain])
502c21fdd85Schristos	fi
503c21fdd85Schristos
5045ba6b03cSchristos	# Decide BASELINE, REDUCED_REGS, FPU_DP_EXT, FPU_SP_EXT features
5055ba6b03cSchristos	# based on arch_name.
5065ba6b03cSchristos	AC_MSG_CHECKING(for default configuration of --with-arch)
5075ba6b03cSchristos	if test "x${with_arch}" != x; then
5085ba6b03cSchristos	  case ${with_arch} in
5095ba6b03cSchristos	    v2j | v2s | v2f | v2 | v3m | v3j | v3s | v3f | v3 )
5105ba6b03cSchristos	      AC_DEFINE_UNQUOTED(NDS32_DEFAULT_ARCH_NAME, "$with_arch",
5115ba6b03cSchristos				 [Define value for nds32_arch_name])
5125ba6b03cSchristos	      ;;
5135ba6b03cSchristos	    *)
5145ba6b03cSchristos	      AC_MSG_ERROR(This kind of arch name does *NOT* exist!)
5155ba6b03cSchristos	      ;;
5165ba6b03cSchristos	  esac
5175ba6b03cSchristos	fi
5185ba6b03cSchristos	AC_MSG_RESULT($with_arch)
5195ba6b03cSchristos
5205ba6b03cSchristos	# Decide features one by one.
5215ba6b03cSchristos	AC_MSG_CHECKING(for default configuration of --enable-dx-regs)
5225ba6b03cSchristos	if test "x${enable_dx_regs}" = xyes; then
5235ba6b03cSchristos	  AC_DEFINE(NDS32_DEFAULT_DX_REGS, 1,
5245ba6b03cSchristos		    [Define value for nds32_dx_regs])
5255ba6b03cSchristos	else
5265ba6b03cSchristos	  AC_DEFINE(NDS32_DEFAULT_DX_REGS, 0,
5275ba6b03cSchristos		    [Define default value for nds32_dx_regs])
5285ba6b03cSchristos	fi
5295ba6b03cSchristos	AC_MSG_RESULT($enable_dx_regs)
5305ba6b03cSchristos
5315ba6b03cSchristos	AC_MSG_CHECKING(for default configuration of --enable-perf-ext)
5325ba6b03cSchristos	if test "x${enable_perf_ext}" = xno; then
5335ba6b03cSchristos	  AC_DEFINE(NDS32_DEFAULT_PERF_EXT, 0,
5345ba6b03cSchristos		    [Define value for nds32_perf_ext])
5355ba6b03cSchristos	else
5365ba6b03cSchristos	  AC_DEFINE(NDS32_DEFAULT_PERF_EXT, 1,
5375ba6b03cSchristos		    [Define default value for nds32_perf_ext])
5385ba6b03cSchristos	fi
5395ba6b03cSchristos	AC_MSG_RESULT($enable_perf_ext)
5405ba6b03cSchristos
5415ba6b03cSchristos	AC_MSG_CHECKING(for default configuration of --enable-perf-ext2)
5425ba6b03cSchristos	if test "x${enable_perf_ext2}" = xno; then
5435ba6b03cSchristos	  AC_DEFINE(NDS32_DEFAULT_PERF_EXT2, 0,
5445ba6b03cSchristos		    [Define value for nds32_perf_ext2])
5455ba6b03cSchristos	else
5465ba6b03cSchristos	  AC_DEFINE(NDS32_DEFAULT_PERF_EXT2, 1,
5475ba6b03cSchristos		    [Define default value for nds32_perf_ext2])
5485ba6b03cSchristos	fi
5495ba6b03cSchristos	AC_MSG_RESULT($enable_perf_ext2)
5505ba6b03cSchristos
5515ba6b03cSchristos	AC_MSG_CHECKING(for default configuration of --enable-string-ext)
5525ba6b03cSchristos	if test "x${enable_string_ext}" = xno; then
5535ba6b03cSchristos	  AC_DEFINE(NDS32_DEFAULT_STRING_EXT, 0,
5545ba6b03cSchristos		    [Define value for nds32_string_ext])
5555ba6b03cSchristos	else
5565ba6b03cSchristos	  AC_DEFINE(NDS32_DEFAULT_STRING_EXT, 1,
5575ba6b03cSchristos		    [Define default value for nds32_string_ext])
5585ba6b03cSchristos	fi
5595ba6b03cSchristos	AC_MSG_RESULT($enable_string_ext)
5605ba6b03cSchristos
5615ba6b03cSchristos	AC_MSG_CHECKING(for default configuration of --enable-audio-ext)
5625ba6b03cSchristos	if test "x${enable_audio_ext}" = xno; then
5635ba6b03cSchristos	  AC_DEFINE(NDS32_DEFAULT_AUDIO_EXT, 0,
5645ba6b03cSchristos		    [Define value for nds32_audio_ext])
5655ba6b03cSchristos	else
5665ba6b03cSchristos	  AC_DEFINE(NDS32_DEFAULT_AUDIO_EXT, 1,
5675ba6b03cSchristos		    [Define default value for nds32_audio_ext])
5685ba6b03cSchristos	fi
5695ba6b03cSchristos	AC_MSG_RESULT($enable_audio_ext)
570c21fdd85Schristos
571c21fdd85Schristos	AC_MSG_CHECKING(for default configuration of --enable-dsp-ext)
572c21fdd85Schristos	if test "x${enable_dsp_ext}" = xno; then
573c21fdd85Schristos	  AC_DEFINE(NDS32_DEFAULT_DSP_EXT, 0,
574c21fdd85Schristos		    [Define value for nds32_dsp_ext])
575c21fdd85Schristos	else
576c21fdd85Schristos	  AC_DEFINE(NDS32_DEFAULT_DSP_EXT, 1,
577c21fdd85Schristos		    [Define default value for nds32_dsp_ext])
578c21fdd85Schristos	fi
579c21fdd85Schristos	AC_MSG_RESULT($enable_dsp_ext)
580c21fdd85Schristos
581c21fdd85Schristos	AC_MSG_CHECKING(for default configuration of --enable-zol-ext)
582c21fdd85Schristos	if test "x${enable_zol_ext}" = xno; then
583c21fdd85Schristos	  AC_DEFINE(NDS32_DEFAULT_ZOL_EXT, 0,
584c21fdd85Schristos		    [Define value for nds32_zol_ext])
585c21fdd85Schristos	else
586c21fdd85Schristos	  AC_DEFINE(NDS32_DEFAULT_ZOL_EXT, 1,
587c21fdd85Schristos		    [Define default value for nds32_zol_ext])
588c21fdd85Schristos	fi
589c21fdd85Schristos	AC_MSG_RESULT($enable_zol_ext)
5905ba6b03cSchristos	;;
5915ba6b03cSchristos
592*e072ec67Schristos      aarch64 | i386 | s390 | sparc)
5935ba6b03cSchristos	if test $this_target = $target ; then
5945ba6b03cSchristos	  AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
5955ba6b03cSchristos	fi
5965ba6b03cSchristos	;;
5975ba6b03cSchristos
598*e072ec67Schristos      riscv)
599*e072ec67Schristos        # --target=riscv[32|64]-*-*.  */
600*e072ec67Schristos        if test $this_target = $target ; then
601*e072ec67Schristos          AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
602*e072ec67Schristos        fi
603*e072ec67Schristos
604*e072ec67Schristos        # --with-arch=<value>.  The syntax of <value> is same as Gas option -march.
605*e072ec67Schristos        AC_MSG_CHECKING(for default configuration of --with-arch)
606*e072ec67Schristos        if test "x${with_arch}" != x; then
607*e072ec67Schristos        AC_DEFINE_UNQUOTED(DEFAULT_RISCV_ARCH_WITH_EXT, "$with_arch",
608*e072ec67Schristos                           [Define default value for RISC-V -march.])
609*e072ec67Schristos        fi
610*e072ec67Schristos        AC_MSG_RESULT($with_arch)
611*e072ec67Schristos
612*e072ec67Schristos        # --with-isa-spec=[2.2|20190608|20191213].
613*e072ec67Schristos        AC_MSG_CHECKING(for default configuration of --with-isa-spec)
614*e072ec67Schristos        if test "x${with_isa_spec}" != x; then
615*e072ec67Schristos          AC_DEFINE_UNQUOTED(DEFAULT_RISCV_ISA_SPEC, "$with_isa_spec",
616*e072ec67Schristos                             [Define default value for RISC-V -misa-spec.])
617*e072ec67Schristos        fi
618*e072ec67Schristos        AC_MSG_RESULT($with_isa_spec)
619*e072ec67Schristos
620*e072ec67Schristos        # --with-priv-spec=[1.9.1|1.10|1.11|1.12].
621*e072ec67Schristos        AC_MSG_CHECKING(for default configuration of --with-priv-spec)
622*e072ec67Schristos        if test "x${with_priv_spec}" != x; then
623*e072ec67Schristos          AC_DEFINE_UNQUOTED(DEFAULT_RISCV_PRIV_SPEC, "$with_priv_spec",
624*e072ec67Schristos                             [Define default value for RISC-V -mpriv-spec])
625*e072ec67Schristos        fi
626*e072ec67Schristos        AC_MSG_RESULT($with_priv_spec)
627*e072ec67Schristos        ;;
628*e072ec67Schristos
6295ba6b03cSchristos      rl78)
630*e072ec67Schristos	f=config/rl78-parse.o
631916041edSchristos	case " $extra_objects " in
632916041edSchristos	  *" $f "*) ;;
633916041edSchristos	  *) extra_objects="$extra_objects $f" ;;
634916041edSchristos	esac
6355ba6b03cSchristos	;;
6365ba6b03cSchristos
6375ba6b03cSchristos      rx)
638*e072ec67Schristos	f=config/rx-parse.o
639916041edSchristos	case " $extra_objects " in
640916041edSchristos	  *" $f "*) ;;
641916041edSchristos	  *) extra_objects="$extra_objects $f" ;;
642916041edSchristos	esac
6435ba6b03cSchristos	;;
6445ba6b03cSchristos
6455ba6b03cSchristos      xstormy16)
6465ba6b03cSchristos	using_cgen=yes
6475ba6b03cSchristos	;;
6485ba6b03cSchristos
6495ba6b03cSchristos      xtensa)
650916041edSchristos	f=config/xtensa-relax.o
651916041edSchristos	case " $extra_objects " in
652916041edSchristos	  *" $f "*) ;;
653916041edSchristos	  *) extra_objects="$extra_objects $f" ;;
654916041edSchristos	esac
6555ba6b03cSchristos	;;
6565ba6b03cSchristos
6575ba6b03cSchristos      *)
6585ba6b03cSchristos	;;
6595ba6b03cSchristos    esac
6605ba6b03cSchristos
6615ba6b03cSchristos    if test $using_cgen = yes ; then
662916041edSchristos	f=cgen.o
663916041edSchristos	case " $extra_objects " in
664916041edSchristos	  *" $f "*) ;;
665916041edSchristos	  *) extra_objects="$extra_objects $f" ;;
6665ba6b03cSchristos	esac
6675ba6b03cSchristos    fi
6685ba6b03cSchristos
6695ba6b03cSchristos# See if we really can support this configuration with the emulation code.
6705ba6b03cSchristos
6715ba6b03cSchristos    if test $this_target = $target ; then
6725ba6b03cSchristos      obj_format=$fmt
6735ba6b03cSchristos      te_file=$em
6745ba6b03cSchristos    fi
6755ba6b03cSchristos
6765ba6b03cSchristos    case ${te_file} in
677916041edSchristos      vms)
678916041edSchristos	f=config/te-vms.o
679916041edSchristos	case " $extra_objects " in
680916041edSchristos	  *" $f "*) ;;
681916041edSchristos	  *) extra_objects="$extra_objects $f" ;;
682916041edSchristos	esac ;;
6835ba6b03cSchristos    esac
6845ba6b03cSchristos
6855ba6b03cSchristos# From target name and format, produce a list of supported emulations.
6865ba6b03cSchristos
6875ba6b03cSchristos    case ${generic_target}-${fmt} in
6885ba6b03cSchristos      mips-*-*-*)	case "$endian" in
6895ba6b03cSchristos			big)	emulation="mipsbelf mipslelf mipself" ;;
6905ba6b03cSchristos			*)	emulation="mipslelf mipsbelf mipself" ;;
6915ba6b03cSchristos			esac ;;
6925ba6b03cSchristos      # i386-pc-pe-coff != i386-pc-coff.
6935ba6b03cSchristos      i386-*-pe-coff)	;;
6945ba6b03cSchristos      # Uncommenting the next line will turn on support for i386 AOUT
6955ba6b03cSchristos      # for the default linux configuration
6965ba6b03cSchristos      # i386-*-linux*-elf) emulation="i386elf i386aout" ;;
6975ba6b03cSchristos      #
6985ba6b03cSchristos      i386-*-aout)	emulation="i386aout" ;;
6995ba6b03cSchristos      i386-*-coff)	emulation="i386coff" ;;
7005ba6b03cSchristos      i386-*-elf)	emulation="i386elf" ;;
7015ba6b03cSchristos
7025ba6b03cSchristos      # Always all formats.  The first stated emulation becomes the default.
7035ba6b03cSchristos      cris-*-*aout*)	emulation="crisaout criself" ;;
7045ba6b03cSchristos      cris-*-*)		emulation="criself crisaout" ;;
7055ba6b03cSchristos    esac
7065ba6b03cSchristos
7075ba6b03cSchristos    emulations="$emulations $emulation"
7085ba6b03cSchristos
7095ba6b03cSchristosdone
7105ba6b03cSchristos
711fe4a9685Schristosif test ${ac_default_x86_relax_relocations} = unset; then
712fe4a9685Schristos  ac_default_x86_relax_relocations=1
713fe4a9685Schristosfi
714fe4a9685SchristosAC_DEFINE_UNQUOTED(DEFAULT_GENERATE_X86_RELAX_RELOCATIONS,
715fe4a9685Schristos  $ac_default_x86_relax_relocations,
716fe4a9685Schristos  [Define to 1 if you want to generate x86 relax relocations by default.])
717fe4a9685Schristos
718ad93aa80Schristosif test ${ac_default_elf_stt_common} = unset; then
719ad93aa80Schristos  ac_default_elf_stt_common=0
720ad93aa80Schristosfi
721ad93aa80SchristosAC_DEFINE_UNQUOTED(DEFAULT_GENERATE_ELF_STT_COMMON,
722ad93aa80Schristos  $ac_default_elf_stt_common,
723ad93aa80Schristos  [Define to 1 if you want to generate ELF common symbols with the
724ad93aa80Schristos   STT_COMMON type by default.])
725ad93aa80Schristos
726916041edSchristosAC_DEFINE_UNQUOTED(DEFAULT_GENERATE_BUILD_NOTES,
727916041edSchristos  $ac_default_generate_build_notes,
728916041edSchristos  [Define to 1 if you want to generate GNU Build attribute notes
729916041edSchristos   by default, if none are contained in the input.])
730916041edSchristos
731c21fdd85Schristosif test ${ac_default_generate_x86_used_note} = unset; then
732c21fdd85Schristos  ac_default_generate_x86_used_note=0
733c21fdd85Schristosfi
734c21fdd85SchristosAC_DEFINE_UNQUOTED(DEFAULT_X86_USED_NOTE,
735c21fdd85Schristos  $ac_default_generate_x86_used_note,
736c21fdd85Schristos  [Define to 1 if you want to generate GNU x86 used ISA and feature
737c21fdd85Schristos   properties by default.])
738c21fdd85Schristos
739c21fdd85Schristosif test ${ac_default_generate_riscv_attr} = unset; then
740c21fdd85Schristos  ac_default_generate_riscv_attr=1
741c21fdd85Schristosfi
742c21fdd85Schristos
743c21fdd85SchristosAC_DEFINE_UNQUOTED(DEFAULT_RISCV_ATTR,
744c21fdd85Schristos  $ac_default_generate_riscv_attr,
745c21fdd85Schristos  [Define to 1 if you want to generate RISC-V arch attribute by default.])
746c21fdd85Schristos
747c21fdd85Schristosif test ${ac_default_mips_fix_loongson3_llsc} = unset; then
748c21fdd85Schristos  ac_default_mips_fix_loongson3_llsc=0
749c21fdd85Schristosfi
750c21fdd85SchristosAC_DEFINE_UNQUOTED(DEFAULT_MIPS_FIX_LOONGSON3_LLSC,
751c21fdd85Schristos  $ac_default_mips_fix_loongson3_llsc,
752c21fdd85Schristos  [Define to 1 if you want to fix Loongson3 LLSC Errata by default.])
753c21fdd85Schristos
7547342eb49Schristosif test x$ac_default_compressed_debug_sections = xyes ; then
7555ba6b03cSchristos  AC_DEFINE(DEFAULT_FLAG_COMPRESS_DEBUG, 1, [Define if you want compressed debug sections by default.])
7565ba6b03cSchristosfi
7575ba6b03cSchristos
7585ba6b03cSchristos# Turn on all targets if possible
7595ba6b03cSchristosif test ${all_targets} = "yes"; then
7605ba6b03cSchristos  case ${target_cpu_type} in
7615ba6b03cSchristos  i386)
7625ba6b03cSchristos    case ${obj_format} in
7635ba6b03cSchristos    aout)
7645ba6b03cSchristos      emulations="$emulations i386coff i386elf"
7655ba6b03cSchristos      ;;
7665ba6b03cSchristos    coff)
7675ba6b03cSchristos      emulations="$emulations i386aout i386elf"
7685ba6b03cSchristos    ;;
7695ba6b03cSchristos    elf)
7705ba6b03cSchristos      emulations="$emulations i386aout i386coff"
7715ba6b03cSchristos      ;;
7725ba6b03cSchristos    esac
7735ba6b03cSchristos  ;;
7745ba6b03cSchristos  x86_64)
7755ba6b03cSchristos    case ${obj_format} in
7765ba6b03cSchristos    aout)
7775ba6b03cSchristos      emulations="$emulations i386coff i386elf"
7785ba6b03cSchristos      ;;
7795ba6b03cSchristos    coff)
7805ba6b03cSchristos      emulations="$emulations i386aout i386elf"
7815ba6b03cSchristos    ;;
7825ba6b03cSchristos    elf)
7835ba6b03cSchristos      emulations="$emulations i386aout i386coff"
7845ba6b03cSchristos      ;;
7855ba6b03cSchristos    esac
7865ba6b03cSchristos  ;;
7875ba6b03cSchristos  esac
7885ba6b03cSchristosfi
7895ba6b03cSchristos
7905ba6b03cSchristos# PE code has way too many macros tweaking behaviour
7915ba6b03cSchristoscase ${te_file} in
7925ba6b03cSchristos  pe*) emulations="" ;;
7935ba6b03cSchristosesac
7945ba6b03cSchristos
7955ba6b03cSchristos# Assign floating point type.  Most processors with FP support
7965ba6b03cSchristos# IEEE FP.  On those that don't support FP at all, usually IEEE
7975ba6b03cSchristos# is emulated.
7985ba6b03cSchristoscase ${target_cpu} in
7995ba6b03cSchristos  vax | pdp11 )	atof=vax ;;
8005ba6b03cSchristos  *)		atof=ieee ;;
8015ba6b03cSchristosesac
8025ba6b03cSchristos
8035ba6b03cSchristoscase "${obj_format}" in
8045ba6b03cSchristos  "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
8055ba6b03cSchristosesac
8065ba6b03cSchristos
8075ba6b03cSchristos# Unfortunately the cpu in cpu-opc.h file isn't always $(TARGET_CPU).
8085ba6b03cSchristoscgen_cpu_prefix=""
8095ba6b03cSchristosif test $using_cgen = yes ; then
8105ba6b03cSchristos  case ${target_cpu} in
8115ba6b03cSchristos    or1knd)
8125ba6b03cSchristos       cgen_cpu_prefix=or1k ;;
8135ba6b03cSchristos    *) cgen_cpu_prefix=${target_cpu} ;;
8145ba6b03cSchristos  esac
8155ba6b03cSchristos  AC_SUBST(cgen_cpu_prefix)
8165ba6b03cSchristos  AC_DEFINE(USING_CGEN, 1, [Using cgen code?])
8175ba6b03cSchristosfi
8185ba6b03cSchristos
8195ba6b03cSchristosdnl
8205ba6b03cSchristosdnl Make sure the desired support files exist.
8215ba6b03cSchristosdnl
8225ba6b03cSchristos
8235ba6b03cSchristosif test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
8245ba6b03cSchristos  AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
8255ba6b03cSchristosfi
8265ba6b03cSchristos
8275ba6b03cSchristosif test ! -r ${srcdir}/config/obj-${obj_format}.c; then
8285ba6b03cSchristos  AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
8295ba6b03cSchristosfi
8305ba6b03cSchristos
8315ba6b03cSchristos# Some COFF configurations want these random other flags set.
8325ba6b03cSchristoscase ${obj_format} in
8335ba6b03cSchristos  coff)
8345ba6b03cSchristos    case ${target_cpu_type} in
8355ba6b03cSchristos      i386) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;;
8365ba6b03cSchristos      x86_64) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;;
8375ba6b03cSchristos    esac
8385ba6b03cSchristos    ;;
8395ba6b03cSchristosesac
8405ba6b03cSchristos
8415ba6b03cSchristos# Getting this done right is going to be a bitch.  Each configuration specified
8425ba6b03cSchristos# with --enable-targets=... should be checked for environment, format, cpu
8435ba6b03cSchristos# setting.
8445ba6b03cSchristos#
8455ba6b03cSchristos# For each configuration, the necessary object file support code must be linked
8465ba6b03cSchristos# in.  This might be only one, it might be up to four.  The necessary emulation
8475ba6b03cSchristos# code needs to be provided, too.
8485ba6b03cSchristos#
8495ba6b03cSchristos# And then there's "--enable-targets=all"....
8505ba6b03cSchristos#
8515ba6b03cSchristos# For now, just always do it for MIPS ELF configurations.  Sigh.
8525ba6b03cSchristos
8535ba6b03cSchristosformats="${obj_format}"
8545ba6b03cSchristosemfiles=""
8555ba6b03cSchristosEMULATIONS=""
8565ba6b03cSchristosGAS_UNIQ(emulations)
8575ba6b03cSchristosfor em in . $emulations ; do
8585ba6b03cSchristos  case $em in
8595ba6b03cSchristos    .)	continue ;;
8605ba6b03cSchristos    mipsbelf | mipslelf | mipself)
8615ba6b03cSchristos	fmt=elf   file=mipself ;;
8625ba6b03cSchristos    *coff)
8635ba6b03cSchristos	fmt=coff  file=$em ;;
8645ba6b03cSchristos    *aout)
8655ba6b03cSchristos	fmt=aout file=$em ;;
8665ba6b03cSchristos    *elf)
8675ba6b03cSchristos	fmt=elf file=$em ;;
8685ba6b03cSchristos  esac
8695ba6b03cSchristos  formats="$formats $fmt"
870916041edSchristos  emfiles="$emfiles config/e-$file.o"
8715ba6b03cSchristos  EMULATIONS="$EMULATIONS &$em,"
8725ba6b03cSchristosdone
8735ba6b03cSchristosGAS_UNIQ(formats)
8745ba6b03cSchristosGAS_UNIQ(emfiles)
8755ba6b03cSchristosif test `set . $formats ; shift ; echo $#` -gt 1 ; then
8765ba6b03cSchristos  for fmt in $formats ; do
8775ba6b03cSchristos    case $fmt in
8785ba6b03cSchristos      aout)	AC_DEFINE(OBJ_MAYBE_AOUT, 1,    [a.out support?])   ;;
8795ba6b03cSchristos      coff)	AC_DEFINE(OBJ_MAYBE_COFF, 1,    [COFF support?])    ;;
8805ba6b03cSchristos      ecoff)	AC_DEFINE(OBJ_MAYBE_ECOFF, 1,   [ECOFF support?])   ;;
8815ba6b03cSchristos      elf)	AC_DEFINE(OBJ_MAYBE_ELF, 1,     [ELF support?])     ;;
8825ba6b03cSchristos      generic)	AC_DEFINE(OBJ_MAYBE_GENERIC, 1, [generic support?]) ;;
8835ba6b03cSchristos      som)	AC_DEFINE(OBJ_MAYBE_SOM, 1,     [SOM support?])     ;;
8845ba6b03cSchristos    esac
885916041edSchristos    extra_objects="$extra_objects config/obj-$fmt.o"
8865ba6b03cSchristos  done
8875ba6b03cSchristos  obj_format=multi
8885ba6b03cSchristosfi
8895ba6b03cSchristosif test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
8905ba6b03cSchristos  DEFAULT_EMULATION=`set . $emulations ; echo $2`
8915ba6b03cSchristos  # e-mipself has more than one emulation per file, e-i386* has just one at the
8925ba6b03cSchristos  # moment.  If only one emulation is specified, then don't define
8935ba6b03cSchristos  # USE_EMULATIONS or include any of the e-files as they will only be bloat.
8945ba6b03cSchristos  case "${obj_format}${emfiles}" in
8955ba6b03cSchristos    multi* | *mipself*)
8965ba6b03cSchristos      extra_objects="$extra_objects $emfiles"
8975ba6b03cSchristos      AC_DEFINE(USE_EMULATIONS, 1, [Use emulation support?]) ;;
8985ba6b03cSchristos  esac
8995ba6b03cSchristosfi
9005ba6b03cSchristosAC_SUBST(extra_objects)
9015ba6b03cSchristosAC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS, [Supported emulations.])
9025ba6b03cSchristosAC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION",
9035ba6b03cSchristos		   [Default emulation.])
9045ba6b03cSchristos
9055ba6b03cSchristosreject_dev_configs=yes
9065ba6b03cSchristos
9075ba6b03cSchristoscase ${reject_dev_configs}-${dev} in
9085ba6b03cSchristos  yes-yes) # Oops.
9095ba6b03cSchristos    AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
9105ba6b03cSchristos    ;;
9115ba6b03cSchristosesac
9125ba6b03cSchristos
9135ba6b03cSchristosAC_SUBST(target_cpu_type)
9145ba6b03cSchristosAC_SUBST(obj_format)
9155ba6b03cSchristosAC_SUBST(te_file)
9165ba6b03cSchristosAC_SUBST(install_tooldir)
9175ba6b03cSchristosAC_SUBST(atof)
9185ba6b03cSchristosdnl AC_SUBST(emulation)
9195ba6b03cSchristos
9205ba6b03cSchristos# do we need the opcodes library?
9215ba6b03cSchristoscase "${need_opcodes}" in
9225ba6b03cSchristosyes)
9235ba6b03cSchristos  OPCODES_LIB=../opcodes/libopcodes.la
9245ba6b03cSchristos  ;;
9255ba6b03cSchristosesac
9265ba6b03cSchristos
9275ba6b03cSchristosAC_SUBST(OPCODES_LIB)
9285ba6b03cSchristos
9295ba6b03cSchristosAC_DEFINE_UNQUOTED(TARGET_ALIAS,	"${target_alias}", [Target alias.])
9305ba6b03cSchristosAC_DEFINE_UNQUOTED(TARGET_CANONICAL,	"${target}",       [Canonical target.])
9315ba6b03cSchristosAC_DEFINE_UNQUOTED(TARGET_CPU,		"${target_cpu}",   [Target CPU.])
9325ba6b03cSchristosAC_DEFINE_UNQUOTED(TARGET_VENDOR,	"${target_vendor}", [Target vendor.])
9335ba6b03cSchristosAC_DEFINE_UNQUOTED(TARGET_OS,		"${target_os}",    [Target OS.])
9345ba6b03cSchristos
9355ba6b03cSchristosAC_PROG_YACC
9365ba6b03cSchristosAM_PROG_LEX
9375ba6b03cSchristos
938916041edSchristosALL_LINGUAS="es fi fr id ja ru rw sv tr uk zh_CN"
9395ba6b03cSchristosZW_GNU_GETTEXT_SISTER_DIR
9405ba6b03cSchristosAM_PO_SUBDIRS
9415ba6b03cSchristos
9425ba6b03cSchristosAM_MAINTAINER_MODE
9435ba6b03cSchristosAM_CONDITIONAL(GENINSRC_NEVER, false)
9445ba6b03cSchristosAC_EXEEXT
9455ba6b03cSchristos
946*e072ec67SchristosAC_CHECK_HEADERS(memory.h sys/stat.h sys/types.h unistd.h)
9475ba6b03cSchristos
9485ba6b03cSchristos# Put this here so that autoconf's "cross-compiling" message doesn't confuse
9495ba6b03cSchristos# people who are not cross-compiling but are compiling cross-assemblers.
9505ba6b03cSchristosAC_MSG_CHECKING(whether compiling a cross-assembler)
9515ba6b03cSchristosif test "${host}" = "${target}"; then
9525ba6b03cSchristos  cross_gas=no
9535ba6b03cSchristoselse
9545ba6b03cSchristos  cross_gas=yes
9555ba6b03cSchristos  AC_DEFINE(CROSS_COMPILE, 1, [Compiling cross-assembler?])
9565ba6b03cSchristosfi
9575ba6b03cSchristosAC_MSG_RESULT($cross_gas)
9585ba6b03cSchristos
959aa4b58b1SchristosAC_CHECK_FUNCS(strsignal)
9605ba6b03cSchristos
9615ba6b03cSchristosAM_LC_MESSAGES
9625ba6b03cSchristos
9635ba6b03cSchristos# do we need the math library?
9645ba6b03cSchristoscase "${need_libm}" in
9655ba6b03cSchristosyes)
9665ba6b03cSchristos  LT_LIB_M
9675ba6b03cSchristos  AC_SUBST(LIBM)
9685ba6b03cSchristos  ;;
9695ba6b03cSchristosesac
9705ba6b03cSchristos
9715ba6b03cSchristos# Some non-ANSI preprocessors botch requoting inside strings.  That's bad
9725ba6b03cSchristos# enough, but on some of those systems, the assert macro relies on requoting
9735ba6b03cSchristos# working properly!
9745ba6b03cSchristosGAS_WORKING_ASSERT
9755ba6b03cSchristos
9765ba6b03cSchristos# On some systems, the system header files may not declare malloc, realloc,
9775ba6b03cSchristos# and free.  There are places where gas needs these functions to have been
9785ba6b03cSchristos# declared -- such as when taking their addresses.
9795ba6b03cSchristosgas_test_headers="
9805ba6b03cSchristos#ifdef HAVE_MEMORY_H
9815ba6b03cSchristos#include <memory.h>
9825ba6b03cSchristos#endif
9835ba6b03cSchristos#include <string.h>
9845ba6b03cSchristos#include <stdlib.h>
9855ba6b03cSchristos#ifdef HAVE_UNISTD_H
9865ba6b03cSchristos#include <unistd.h>
9875ba6b03cSchristos#endif
9885ba6b03cSchristos"
9895ba6b03cSchristos
9905ba6b03cSchristosAC_MSG_CHECKING(for a known getopt prototype in unistd.h)
9915ba6b03cSchristosAC_CACHE_VAL(gas_cv_decl_getopt_unistd_h,
9925ba6b03cSchristos[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
9935ba6b03cSchristosgas_cv_decl_getopt_unistd_h=yes, gas_cv_decl_getopt_unistd_h=no)])
9945ba6b03cSchristosAC_MSG_RESULT($gas_cv_decl_getopt_unistd_h)
9955ba6b03cSchristosif test $gas_cv_decl_getopt_unistd_h = yes; then
9965ba6b03cSchristos  AC_DEFINE([HAVE_DECL_GETOPT], 1,
9975ba6b03cSchristos	    [Is the prototype for getopt in <unistd.h> in the expected format?])
9985ba6b03cSchristosfi
9995ba6b03cSchristos
10005ba6b03cSchristosGAS_CHECK_DECL_NEEDED(environ, f, char **f, $gas_test_headers)
10015ba6b03cSchristosGAS_CHECK_DECL_NEEDED(ffs, f, int (*f)(int), $gas_test_headers)
10025ba6b03cSchristos
1003*e072ec67SchristosAC_CHECK_DECLS([asprintf, mempcpy, stpcpy])
10045ba6b03cSchristos
10055ba6b03cSchristosBFD_BINARY_FOPEN
10065ba6b03cSchristos
10075ba6b03cSchristos# Link in zlib if we can.  This allows us to write compressed debug sections.
10085ba6b03cSchristosAM_ZLIB
10095ba6b03cSchristos
10105ba6b03cSchristos# Support for VMS timestamps via cross compile
10115ba6b03cSchristos
10125ba6b03cSchristosif test "$ac_cv_header_time_h" = yes; then
10135ba6b03cSchristos  GAS_HAVE_TIME_TYPE_MEMBER(struct tm, tm_gmtoff)
10145ba6b03cSchristosfi
10155ba6b03cSchristos
10165ba6b03cSchristosif test "$ac_cv_header_sys_stat_h" = yes; then
10175ba6b03cSchristos    GAS_HAVE_SYS_STAT_TYPE_MEMBER(struct stat, st_mtim, tv_sec)
10185ba6b03cSchristos    GAS_HAVE_SYS_STAT_TYPE_MEMBER(struct stat, st_mtim, tv_nsec)
10195ba6b03cSchristosfi
10205ba6b03cSchristos
10215ba6b03cSchristos
10225ba6b03cSchristosdnl Required for html, pdf, install-pdf and install-html targets.
10235ba6b03cSchristosAC_SUBST(datarootdir)
10245ba6b03cSchristosAC_SUBST(docdir)
10255ba6b03cSchristosAC_SUBST(htmldir)
10265ba6b03cSchristosAC_SUBST(pdfdir)
10275ba6b03cSchristos
10285ba6b03cSchristosdnl This must come last.
10295ba6b03cSchristos
10305ba6b03cSchristosdnl We used to make symlinks to files in the source directory, but now
10315ba6b03cSchristosdnl we just use the right name for .c files, and create .h files in
10325ba6b03cSchristosdnl the build directory which include the right .h file.  Make sure
10335ba6b03cSchristosdnl the old symlinks don't exist, so that a reconfigure in an existing
10345ba6b03cSchristosdnl directory behaves reasonably.
10355ba6b03cSchristos
1036*e072ec67SchristosAC_CONFIG_FILES(Makefile po/Makefile.in:po/Make-in)
10375ba6b03cSchristosAC_CONFIG_COMMANDS([default],
10385ba6b03cSchristos[rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
10395ba6b03cSchristos echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
10405ba6b03cSchristos echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
10415ba6b03cSchristos echo '#include "te-'"${te_file}"'.h"' > targ-env.h
10425ba6b03cSchristos echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
10435ba6b03cSchristos if test "x$cgen_cpu_prefix" != x ; then
10445ba6b03cSchristos   echo '#include "opcodes/'"${cgen_cpu_prefix}"'-desc.h"' > cgen-desc.h
10455ba6b03cSchristos fi],
10465ba6b03cSchristos[target_cpu_type=${target_cpu_type}
10475ba6b03cSchristos cgen_cpu_prefix=${cgen_cpu_prefix}
10485ba6b03cSchristos obj_format=${obj_format}
10495ba6b03cSchristos te_file=${te_file}])
10505ba6b03cSchristos
10515ba6b03cSchristosAC_OUTPUT
1052*e072ec67Schristos
1053*e072ec67SchristosGNU_MAKE_JOBSERVER
1054