133965Sjdpdnl Process this file with autoconf to produce a configure script. 233965Sjdpdnl 333965Sjdpdnl And be careful when changing it! If you must add tests with square 433965Sjdpdnl brackets, be sure changequote invocations surround it. 533965Sjdpdnl 633965Sjdpdnl 738891Sjdpdnl v2.5 needed for --bindir et al 8130570SobrienAC_PREREQ(2.57) 938891SjdpAC_INIT(as.h) 1038891Sjdp 11130570Sobriendnl Autoconf 2.57 will find the aux dir without this. However, unless 12130570Sobriendnl we specify this explicitly, automake-1.7 will assume that ylwrap is in 13130570Sobriendnl gas/ instead of gas/../. 14130570SobrienAC_CONFIG_AUX_DIR(..) 1538891SjdpAC_CANONICAL_SYSTEM 1677310SobrienAC_ISC_POSIX 1738891Sjdp 1878837Sobrienchangequote(,)dnl 1978837SobrienBFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${srcdir}/../bfd/configure.in` 2078837Sobrienchangequote([,])dnl 2178837SobrienAM_INIT_AUTOMAKE(gas, ${BFD_VERSION}) 2238891Sjdp 2338891SjdpAM_PROG_LIBTOOL 2438891Sjdp 2533965SjdpAC_ARG_ENABLE(targets, 26218822Sdim[ --enable-targets alternative target configurations besides the primary], 2733965Sjdp[case "${enableval}" in 2833965Sjdp yes | "") AC_ERROR(enable-targets option must specify target names or 'all') 2933965Sjdp ;; 3033965Sjdp no) enable_targets= ;; 3133965Sjdp *) enable_targets=$enableval ;; 3233965Sjdpesac])dnl 33218822Sdim 3433965SjdpAC_ARG_ENABLE(commonbfdlib, 3533965Sjdp[ --enable-commonbfdlib build shared BFD/opcodes/libiberty library], 3633965Sjdp[case "${enableval}" in 3733965Sjdp yes) commonbfdlib=true ;; 3833965Sjdp no) commonbfdlib=false ;; 3933965Sjdp *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;; 4033965Sjdpesac])dnl 4133965Sjdp 42218822Sdimac_checking=yes 43218822Sdimif grep '^RELEASE=y' ${srcdir}/../bfd/Makefile.am >/dev/null 2>/dev/null ; then 44218822Sdim ac_checking= 45218822Sdimfi 46218822SdimAC_ARG_ENABLE(checking, 47218822Sdim[ --enable-checking enable run-time checks], 4877310Sobrien[case "${enableval}" in 49218822Sdim no|none) ac_checking= ;; 50218822Sdim *) ac_checking=yes ;; 51218822Sdimesac])dnl 52218822Sdimif test x$ac_checking != x ; then 53218822Sdim AC_DEFINE(ENABLE_CHECKING, 1, [Define if you want run-time sanity checks.]) 5477310Sobrienfi 5577310Sobrien 56218822Sdimusing_cgen=no 57218822Sdim 58218822SdimAM_BINUTILS_WARNINGS 59218822Sdim 6038891Sjdp# Generate a header file 6138891SjdpAM_CONFIG_HEADER(config.h:config.in) 6233965Sjdp 6360517Sobrien# If we are on a DOS filesystem, we must use gdb.ini rather than 6460517Sobrien# .gdbinit. 6560517Sobriencase "${host}" in 66130570Sobrien *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-windows*) 6760517Sobrien GDBINIT="gdb.ini" 68130570Sobrien AC_CONFIG_FILES(gdb.ini:gdbinit.in) 6960517Sobrien ;; 70130570Sobrien *) 71130570Sobrien GDBINIT=".gdbinit" 72130570Sobrien AC_CONFIG_FILES(.gdbinit:gdbinit.in) 73130570Sobrien ;; 7460517Sobrienesac 7560517SobrienAC_SUBST(GDBINIT) 7660517Sobrien 77218822Sdim#We need this for the host. BOUT header is in host order. 78218822SdimAC_C_BIGENDIAN 79218822Sdim 8033965Sjdpte_file=generic 8133965Sjdp 8260517Sobrien# Makefile target for installing gas in $(tooldir)/bin. 8360517Sobrieninstall_tooldir=install-exec-tooldir 8460517Sobrien 8533965Sjdpcanon_targets="" 8660517Sobrienall_targets=no 8733965Sjdpif test -n "$enable_targets" ; then 8833965Sjdp for t in `echo $enable_targets | sed 's/,/ /g'`; do 8960517Sobrien if test $t = "all"; then 9060517Sobrien all_targets=yes 9160517Sobrien continue 9260517Sobrien fi 9360517Sobrien result=`$ac_config_sub $t 2>/dev/null` 9433965Sjdp if test -n "$result" ; then 9533965Sjdp canon_targets="$canon_targets $result" 9633965Sjdp# else 9733965Sjdp# # Permit "all", etc. We don't support it yet though. 9833965Sjdp# canon_targets="$canon_targets $t" 9933965Sjdp fi 10033965Sjdp done 10133965Sjdp GAS_UNIQ(canon_targets) 10233965Sjdpfi 10333965Sjdp 10433965Sjdpemulations="" 10533965Sjdp 10633965Sjdpfor this_target in $target $canon_targets ; do 10733965Sjdp 108218822Sdim targ=${this_target} 109218822Sdim . ${srcdir}/configure.tgt 11033965Sjdp 111218822Sdim case ${target_cpu} in 112218822Sdim crisv32) 113218822Sdim AC_DEFINE_UNQUOTED(DEFAULT_CRIS_ARCH, $arch, 114218822Sdim [Default CRIS architecture.]) 115218822Sdim ;; 11633965Sjdp esac 11733965Sjdp 11833965Sjdp if test ${this_target} = $target ; then 11933965Sjdp target_cpu_type=${cpu_type} 12033965Sjdp elif test ${target_cpu_type} != ${cpu_type} ; then 12133965Sjdp continue 12233965Sjdp fi 12333965Sjdp 124218822Sdim generic_target=${cpu_type}-${target_vendor}-${target_os} 12533965Sjdp case ${generic_target} in 126218822Sdim i386-*-sco3.2v5*) 127218822Sdim if test ${this_target} = $target; then 128218822Sdim AC_DEFINE(SCO_ELF, 1, [Define if defaulting to ELF on SCO 5.]) 129218822Sdim fi 130218822Sdim ;; 13133965Sjdp 132130570Sobrien i386-*-msdosdjgpp* \ 133130570Sobrien | i386-*-go32* \ 134218822Sdim | i386-go32-rtems*) 135218822Sdim AC_DEFINE(STRICTCOFF, 1, [Using strict COFF?]) 136218822Sdim ;; 13733965Sjdp 138218822Sdim i860-*-*) 139218822Sdim AC_MSG_WARN(GAS support for ${generic_target} is preliminary and a work in progress) 140218822Sdim ;; 14177310Sobrien 142218822Sdim mips-sony-bsd*) 143218822Sdim ;; 144130570Sobrien mips-*-bsd*) 145218822Sdim AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) 146218822Sdim ;; 14733965Sjdp 148218822Sdim ppc-*-aix5.*) 149218822Sdim AC_DEFINE(AIX_WEAK_SUPPORT, 1, 150130570Sobrien [Define if using AIX 5.2 value for C_WEAKEXT.]) 151218822Sdim ;; 152218822Sdim ppc-*-linux-*) 153218822Sdim case "$endian" in 154218822Sdim big) ;; 155218822Sdim *) AC_MSG_ERROR(GNU/Linux must be configured big endian) ;; 156218822Sdim esac 157218822Sdim ;; 158218822Sdim ppc-*-solaris*) 159218822Sdim if test ${this_target} = $target; then 160218822Sdim AC_DEFINE(TARGET_SOLARIS_COMMENT, 1, 161218822Sdim [Define if default target is PowerPC Solaris.]) 162218822Sdim fi 163218822Sdim if test x${endian} = xbig; then 164218822Sdim AC_MSG_ERROR(Solaris must be configured little endian) 165218822Sdim fi 166218822Sdim ;; 16733965Sjdp 168218822Sdim sh*-*-symbianelf*) 169218822Sdim AC_DEFINE(TARGET_SYMBIAN, 1, [Define if target is Symbian OS.]) 170218822Sdim ;; 17133965Sjdp esac 17233965Sjdp 17360517Sobrien if test ${this_target} = $target ; then 17460517Sobrien endian_def= 17560517Sobrien if test x${endian} = xbig; then 17660517Sobrien endian_def=1 17760517Sobrien elif test x${endian} = xlittle; then 17860517Sobrien endian_def=0 17960517Sobrien fi 18060517Sobrien if test x${endian_def} != x; then 18160517Sobrien AC_DEFINE_UNQUOTED(TARGET_BYTES_BIG_ENDIAN, $endian_def, 18260517Sobrien [Define as 1 if big endian.]) 18360517Sobrien fi 18460517Sobrien fi 18560517Sobrien 18633965Sjdp# Other random stuff. 18733965Sjdp 188130570Sobrien case ${cpu_type} in 189130570Sobrien mips) 190130570Sobrien # Set mips_cpu to the name of the default CPU. 191130570Sobrien case ${target_cpu} in 192130570Sobrien mips | mipsbe | mipseb | mipsle | mipsel | mips64 | mips64el) 193130570Sobrien mips_cpu=from-abi 194130570Sobrien ;; 195130570Sobrien mipsisa32 | mipsisa32el) 196130570Sobrien mips_cpu=mips32 197130570Sobrien ;; 198130570Sobrien mipsisa32r2 | mipsisa32r2el) 199130570Sobrien mips_cpu=mips32r2 200130570Sobrien ;; 201130570Sobrien mipsisa64 | mipsisa64el) 202130570Sobrien mips_cpu=mips64 203130570Sobrien ;; 204130570Sobrien mipsisa64r2 | mipsisa64r2el) 205130570Sobrien mips_cpu=mips64r2 206130570Sobrien ;; 207130570Sobrien mipstx39 | mipstx39el) 208130570Sobrien mips_cpu=r3900 209130570Sobrien ;; 210130570Sobrien mips64vr | mips64vrel) 211130570Sobrien mips_cpu=vr4100 212130570Sobrien ;; 213130570Sobrien mipsisa32r2* | mipsisa64r2*) 214130570Sobrienchangequote(,)dnl 215130570Sobrien mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..r2//' -e 's/el$//'` 216130570Sobrienchangequote([,])dnl 217130570Sobrien ;; 218130570Sobrien mips64* | mipsisa64* | mipsisa32*) 219130570Sobrienchangequote(,)dnl 220130570Sobrien mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..//' -e 's/el$//'` 221130570Sobrienchangequote([,])dnl 222130570Sobrien ;; 223130570Sobrien *) 224130570Sobrien AC_ERROR($target_cpu isn't a supported MIPS CPU name) 225130570Sobrien ;; 226130570Sobrien esac 227130570Sobrien # See whether it's appropriate to set E_MIPS_ABI_O32 for o32 228130570Sobrien # binaries. It's a GNU extension that some OSes don't understand. 229130570Sobrien # The value only matters on ELF targets. 230130570Sobrien case ${target} in 231130570Sobrien *-*-irix*) 232130570Sobrien use_e_mips_abi_o32=0 233130570Sobrien ;; 234130570Sobrien *) 235130570Sobrien use_e_mips_abi_o32=1 236130570Sobrien ;; 237130570Sobrien esac 238130570Sobrien # Decide whether to generate 32-bit or 64-bit code by default. 239130570Sobrien # Used to resolve -march=from-abi when an embedded ABI is selected. 240130570Sobrien case ${target} in 241130570Sobrien mips64*-*-* | mipsisa64*-*-*) 242130570Sobrien mips_default_64bit=1 243130570Sobrien ;; 244130570Sobrien *) 245130570Sobrien mips_default_64bit=0 246130570Sobrien ;; 247130570Sobrien esac 248130570Sobrien # Decide which ABI to target by default. 249130570Sobrien case ${target} in 250130570Sobrien mips64*-linux* | mips-sgi-irix6*) 251130570Sobrien mips_default_abi=N32_ABI 252130570Sobrien ;; 253130570Sobrien mips*-linux*) 254130570Sobrien mips_default_abi=O32_ABI 255130570Sobrien ;; 256218822Sdim mips64*-openbsd*) 257218822Sdim mips_default_abi=N64_ABI 258218822Sdim ;; 259130570Sobrien *) 260130570Sobrien mips_default_abi=NO_ABI 261130570Sobrien ;; 262130570Sobrien esac 263130570Sobrien AC_DEFINE_UNQUOTED(MIPS_CPU_STRING_DEFAULT, "$mips_cpu", 264130570Sobrien [Default CPU for MIPS targets. ]) 265130570Sobrien AC_DEFINE_UNQUOTED(USE_E_MIPS_ABI_O32, $use_e_mips_abi_o32, 266130570Sobrien [Allow use of E_MIPS_ABI_O32 on MIPS targets. ]) 267130570Sobrien AC_DEFINE_UNQUOTED(MIPS_DEFAULT_64BIT, $mips_default_64bit, 268130570Sobrien [Generate 64-bit code by default on MIPS targets. ]) 269130570Sobrien AC_DEFINE_UNQUOTED(MIPS_DEFAULT_ABI, $mips_default_abi, 270130570Sobrien [Choose a default ABI for MIPS targets. ]) 271130570Sobrien ;; 272130570Sobrien esac 273130570Sobrien 27460517Sobrien # Do we need the opcodes library? 27533965Sjdp case ${cpu_type} in 276218822Sdim vax | tic30) 27733965Sjdp ;; 27860517Sobrien 27933965Sjdp *) 28033965Sjdp need_opcodes=yes 28138891Sjdp 28238891Sjdp case "${enable_shared}" in 28338891Sjdp yes) shared_opcodes=true ;; 28438891Sjdp *opcodes*) shared_opcodes=true ;; 28538891Sjdp *) shared_opcodes=false ;; 28638891Sjdp esac 28733965Sjdp ;; 28833965Sjdp esac 28933965Sjdp 29060517Sobrien # Any other special object files needed ? 29133965Sjdp case ${cpu_type} in 292218822Sdim 293218822Sdim bfin) 294218822Sdim echo ${extra_objects} | grep -s "bfin-parse.o" 295218822Sdim if test $? -ne 0 ; then 296218822Sdim extra_objects="$extra_objects bfin-parse.o" 297218822Sdim fi 298218822Sdim 299218822Sdim echo ${extra_objects} | grep -s "bfin-lex.o" 300218822Sdim if test $? -ne 0 ; then 301218822Sdim extra_objects="$extra_objects bfin-lex.o" 302218822Sdim fi 303218822Sdim ;; 304218822Sdim 305130570Sobrien fr30 | ip2k | iq2000 | m32r | openrisc) 30660517Sobrien using_cgen=yes 30733965Sjdp ;; 30833965Sjdp 309218822Sdim m32c) 310218822Sdim using_cgen=yes 311218822Sdim ;; 312104849Sobrien frv) 313104849Sobrien using_cgen=yes 314104849Sobrien ;; 31533965Sjdp m68k) 31633965Sjdp case ${extra_objects} in 31733965Sjdp *m68k-parse.o*) ;; 31833965Sjdp *) extra_objects="$extra_objects m68k-parse.o" ;; 31933965Sjdp esac 32033965Sjdp ;; 32133965Sjdp 322218822Sdim mep) 323218822Sdim using_cgen=yes 324218822Sdim ;; 325218822Sdim 32633965Sjdp mips) 327218822Sdim echo ${extra_objects} | grep -s "itbl-parse.o" 32833965Sjdp if test $? -ne 0 ; then 32933965Sjdp extra_objects="$extra_objects itbl-parse.o" 33033965Sjdp fi 33133965Sjdp 332218822Sdim echo ${extra_objects} | grep -s "itbl-lex.o" 33333965Sjdp if test $? -ne 0 ; then 33433965Sjdp extra_objects="$extra_objects itbl-lex.o" 33533965Sjdp fi 33633965Sjdp 337218822Sdim echo ${extra_objects} | grep -s "itbl-ops.o" 33833965Sjdp if test $? -ne 0 ; then 33933965Sjdp extra_objects="$extra_objects itbl-ops.o" 34033965Sjdp fi 34133965Sjdp ;; 34233965Sjdp 343218822Sdim mt) 344218822Sdim using_cgen=yes 345218822Sdim ;; 346218822Sdim 34789866Sobrien i386 | s390 | sparc) 34877310Sobrien if test $this_target = $target ; then 34977310Sobrien AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.]) 35077310Sobrien fi 35177310Sobrien ;; 35289866Sobrien 35389866Sobrien xstormy16) 35489866Sobrien using_cgen=yes 35538891Sjdp ;; 35689866Sobrien 357218822Sdim xc16x) 358218822Sdim using_cgen=yes 359218822Sdim ;; 360218822Sdim 361130570Sobrien xtensa) 362130570Sobrien echo ${extra_objects} | grep -s "xtensa-relax.o" 363130570Sobrien if test $? -ne 0 ; then 364130570Sobrien extra_objects="$extra_objects xtensa-relax.o" 365130570Sobrien fi 366130570Sobrien ;; 367130570Sobrien 36833965Sjdp *) 36933965Sjdp ;; 37033965Sjdp esac 37133965Sjdp 37260517Sobrien if test $using_cgen = yes ; then 37360517Sobrien case "x${extra_objects}" in 37460517Sobrien *cgen.o*) ;; 37560517Sobrien *) extra_objects="$extra_objects cgen.o" ;; 37660517Sobrien esac 37760517Sobrien fi 37860517Sobrien 37933965Sjdp# See if we really can support this configuration with the emulation code. 38033965Sjdp 38133965Sjdp if test $this_target = $target ; then 38233965Sjdp obj_format=$fmt 38333965Sjdp te_file=$em 38433965Sjdp fi 38533965Sjdp 38633965Sjdp# From target name and format, produce a list of supported emulations. 38733965Sjdp 38833965Sjdp case ${generic_target}-${fmt} in 38933965Sjdp mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; 39089866Sobrien mips*-*-linux*-*) case "$endian" in 39189866Sobrien big) emulation="mipsbelf mipslelf mipself" ;; 39289866Sobrien *) emulation="mipslelf mipsbelf mipself" ;; 39333965Sjdp esac ;; 39433965Sjdp mips-*-lnews*-ecoff) ;; 39533965Sjdp mips-*-*-ecoff) case "$endian" in 39633965Sjdp big) emulation="mipsbecoff mipslecoff mipsecoff" ;; 39733965Sjdp *) emulation="mipslecoff mipsbecoff mipsecoff" ;; 39833965Sjdp esac ;; 39933965Sjdp mips-*-*-elf) case "$endian" in 40033965Sjdp big) emulation="mipsbelf mipslelf mipself" ;; 40133965Sjdp *) emulation="mipslelf mipsbelf mipself" ;; 40233965Sjdp esac ;; 40377310Sobrien mips-*-sysv4*MP*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; 40477310Sobrien # i386-pc-pe-coff != i386-pc-coff. 40577310Sobrien i386-*-pe-coff) ;; 40660517Sobrien # Uncommenting the next line will turn on support for i386 AOUT 40760517Sobrien # for the default linux configuration 40860517Sobrien # i386-*-linux*-elf) emulation="i386elf i386aout" ;; 40960517Sobrien # 41060517Sobrien i386-*-aout) emulation="i386aout" ;; 41160517Sobrien i386-*-coff) emulation="i386coff" ;; 41260517Sobrien i386-*-elf) emulation="i386elf" ;; 41377310Sobrien 41477310Sobrien # Always all formats. The first stated emulation becomes the default. 41577310Sobrien cris-*-*aout*) emulation="crisaout criself" ;; 41677310Sobrien cris-*-*) emulation="criself crisaout" ;; 41733965Sjdp esac 41833965Sjdp 41933965Sjdp emulations="$emulations $emulation" 42033965Sjdp 42133965Sjdpdone 42233965Sjdp 42360517Sobrien# Turn on all targets if possible 42460517Sobrienif test ${all_targets} = "yes"; then 42560517Sobrien case ${target_cpu_type} in 42660517Sobrien i386) 42760517Sobrien case ${obj_format} in 42860517Sobrien aout) 42960517Sobrien emulations="$emulations i386coff i386elf" 43060517Sobrien ;; 43160517Sobrien coff) 43260517Sobrien emulations="$emulations i386aout i386elf" 43360517Sobrien ;; 43460517Sobrien elf) 43560517Sobrien emulations="$emulations i386aout i386coff" 43660517Sobrien ;; 43760517Sobrien esac 43860517Sobrien ;; 439218822Sdim x86_64) 440218822Sdim case ${obj_format} in 441218822Sdim aout) 442218822Sdim emulations="$emulations i386coff i386elf" 443218822Sdim ;; 444218822Sdim coff) 445218822Sdim emulations="$emulations i386aout i386elf" 446218822Sdim ;; 447218822Sdim elf) 448218822Sdim emulations="$emulations i386aout i386coff" 449218822Sdim ;; 450218822Sdim esac 451218822Sdim ;; 45260517Sobrien esac 45360517Sobrienfi 45460517Sobrien 45533965Sjdp# Assign floating point type. Most processors with FP support 45633965Sjdp# IEEE FP. On those that don't support FP at all, usually IEEE 45733965Sjdp# is emulated. 45833965Sjdpcase ${target_cpu} in 459218822Sdim vax | pdp11 ) atof=vax ;; 46033965Sjdp *) atof=ieee ;; 46133965Sjdpesac 46233965Sjdp 46333965Sjdpcase "${obj_format}" in 46433965Sjdp "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;; 46533965Sjdpesac 46633965Sjdp 46760517Sobrien# Unfortunately the cpu in cpu-opc.h file isn't always $(TARGET_CPU). 46860517Sobriencgen_cpu_prefix="" 46960517Sobrienif test $using_cgen = yes ; then 47060517Sobrien case ${target_cpu} in 47160517Sobrien *) cgen_cpu_prefix=${target_cpu} ;; 47260517Sobrien esac 47360517Sobrien AC_SUBST(cgen_cpu_prefix) 47460517Sobrien AC_DEFINE(USING_CGEN, 1, [Using cgen code?]) 47560517Sobrienfi 47660517Sobrien 47733965Sjdpdnl 47833965Sjdpdnl Make sure the desired support files exist. 47933965Sjdpdnl 48033965Sjdp 48133965Sjdpif test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then 48233965Sjdp AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type}) 48333965Sjdpfi 48433965Sjdp 48533965Sjdpif test ! -r ${srcdir}/config/obj-${obj_format}.c; then 48633965Sjdp AC_MSG_ERROR(GAS does not have support for object file format ${obj_format}) 48733965Sjdpfi 48833965Sjdp 48933965Sjdp# Some COFF configurations want these random other flags set. 49033965Sjdpcase ${obj_format} in 49133965Sjdp coff) 49233965Sjdp case ${target_cpu_type} in 49360517Sobrien i386) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;; 49460517Sobrien m68k) AC_DEFINE(M68KCOFF, 1, [Using m68k COFF?]) ;; 49560517Sobrien m88k) AC_DEFINE(M88KCOFF, 1, [Using m88k COFF?]) ;; 496218822Sdim x86_64) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;; 49733965Sjdp esac 49833965Sjdp ;; 49933965Sjdpesac 50033965Sjdp 50133965Sjdp# Getting this done right is going to be a bitch. Each configuration specified 502218822Sdim# with --enable-targets=... should be checked for environment, format, cpu 503218822Sdim# setting. 50433965Sjdp# 50533965Sjdp# For each configuration, the necessary object file support code must be linked 50633965Sjdp# in. This might be only one, it might be up to four. The necessary emulation 50733965Sjdp# code needs to be provided, too. 50833965Sjdp# 50933965Sjdp# And then there's "--enable-targets=all".... 51033965Sjdp# 51133965Sjdp# For now, just always do it for MIPS ELF or ECOFF configurations. Sigh. 51233965Sjdp 51333965Sjdpformats="${obj_format}" 51433965Sjdpemfiles="" 51533965SjdpEMULATIONS="" 51633965SjdpGAS_UNIQ(emulations) 51733965Sjdpfor em in . $emulations ; do 51833965Sjdp case $em in 51933965Sjdp .) continue ;; 52078837Sobrien mipsbelf | mipslelf | mipself) 52133965Sjdp fmt=elf file=mipself ;; 52278837Sobrien mipsbecoff | mipslecoff | mipsecoff) 52333965Sjdp fmt=ecoff file=mipsecoff ;; 52477310Sobrien *coff) 52577310Sobrien fmt=coff file=$em ;; 52677310Sobrien *aout) 52777310Sobrien fmt=aout file=$em ;; 52877310Sobrien *elf) 52977310Sobrien fmt=elf file=$em ;; 53033965Sjdp esac 53133965Sjdp formats="$formats $fmt" 53233965Sjdp emfiles="$emfiles e-$file.o" 53333965Sjdp EMULATIONS="$EMULATIONS &$em," 53433965Sjdpdone 53533965SjdpGAS_UNIQ(formats) 53633965SjdpGAS_UNIQ(emfiles) 53733965Sjdpif test `set . $formats ; shift ; echo $#` -gt 1 ; then 53833965Sjdp for fmt in $formats ; do 53933965Sjdp case $fmt in 54060517Sobrien aout) AC_DEFINE(OBJ_MAYBE_AOUT, 1, [a.out support?]) ;; 54160517Sobrien bout) AC_DEFINE(OBJ_MAYBE_BOUT, 1, [b.out support?]) ;; 54260517Sobrien coff) AC_DEFINE(OBJ_MAYBE_COFF, 1, [COFF support?]) ;; 54360517Sobrien ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF, 1, [ECOFF support?]) ;; 54460517Sobrien elf) AC_DEFINE(OBJ_MAYBE_ELF, 1, [ELF support?]) ;; 54560517Sobrien generic) AC_DEFINE(OBJ_MAYBE_GENERIC, 1, [generic support?]) ;; 54660517Sobrien som) AC_DEFINE(OBJ_MAYBE_SOM, 1, [SOM support?]) ;; 54733965Sjdp esac 54833965Sjdp extra_objects="$extra_objects obj-$fmt.o" 54933965Sjdp done 55033965Sjdp obj_format=multi 55133965Sjdpfi 55233965Sjdpif test `set . $emfiles ; shift ; echo $#` -gt 0 ; then 55333965Sjdp DEFAULT_EMULATION=`set . $emulations ; echo $2` 55460517Sobrien # e-mips* has more than one emulation per file, e-i386* has just one at the 55560517Sobrien # moment. If only one emulation is specified, then don't define 55660517Sobrien # USE_EMULATIONS or include any of the e-files as they will only be bloat. 55760517Sobrien case "${obj_format}${emfiles}" in 55860517Sobrien multi* | *mips*) 55960517Sobrien extra_objects="$extra_objects $emfiles" 56060517Sobrien AC_DEFINE(USE_EMULATIONS, 1, [Use emulation support?]) ;; 56160517Sobrien esac 56233965Sjdpfi 56333965SjdpAC_SUBST(extra_objects) 56460517SobrienAC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS, [Supported emulations.]) 56560517SobrienAC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION", 56660517Sobrien [Default emulation.]) 56733965Sjdp 56833965Sjdpreject_dev_configs=yes 56933965Sjdp 57033965Sjdpcase ${reject_dev_configs}-${dev} in 57133965Sjdp yes-yes) # Oops. 57233965Sjdp AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.) 57333965Sjdp ;; 57433965Sjdpesac 57533965Sjdp 57633965SjdpAC_SUBST(target_cpu_type) 57733965SjdpAC_SUBST(obj_format) 57833965SjdpAC_SUBST(te_file) 57960517SobrienAC_SUBST(install_tooldir) 58033965SjdpAC_SUBST(atof) 58133965Sjdpdnl AC_SUBST(emulation) 58233965Sjdp 58333965Sjdp# do we need the opcodes library? 58433965Sjdpcase "${need_opcodes}" in 58533965Sjdpyes) 58638891Sjdp OPCODES_LIB=../opcodes/libopcodes.la 58733965Sjdp ;; 58833965Sjdpesac 58933965Sjdp 59033965SjdpAC_SUBST(OPCODES_LIB) 59133965Sjdp 59260517SobrienAC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}", [Target alias.]) 59360517SobrienAC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}", [Canonical target.]) 59460517SobrienAC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}", [Target CPU.]) 59560517SobrienAC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}", [Target vendor.]) 59660517SobrienAC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}", [Target OS.]) 59733965Sjdp 59833965SjdpAC_PROG_CC 59933965Sjdp 60038891SjdpAC_PROG_YACC 60160517SobrienAM_PROG_LEX 60238891Sjdp 603218822SdimALL_LINGUAS="fr tr es rw" 604218822SdimZW_GNU_GETTEXT_SISTER_DIR 605218822SdimAM_PO_SUBDIRS 60660517Sobrien 60738891SjdpAM_MAINTAINER_MODE 608218822SdimAM_CONDITIONAL(GENINSRC_NEVER, false) 60960517SobrienAC_EXEEXT 61038891Sjdp 61133965SjdpAC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h) 61233965Sjdp 61333965Sjdp# Put this here so that autoconf's "cross-compiling" message doesn't confuse 61433965Sjdp# people who are not cross-compiling but are compiling cross-assemblers. 61533965SjdpAC_MSG_CHECKING(whether compiling a cross-assembler) 61633965Sjdpif test "${host}" = "${target}"; then 61733965Sjdp cross_gas=no 61833965Sjdpelse 61933965Sjdp cross_gas=yes 62060517Sobrien AC_DEFINE(CROSS_COMPILE, 1, [Compiling cross-assembler?]) 62133965Sjdpfi 62233965SjdpAC_MSG_RESULT($cross_gas) 62333965Sjdp 62433965Sjdpdnl ansidecl.h will deal with const 62533965Sjdpdnl AC_CONST 62633965SjdpAC_FUNC_ALLOCA 62733965SjdpAC_C_INLINE 62833965Sjdp 62933965Sjdp# VMS doesn't have unlink. 63033965SjdpAC_CHECK_FUNCS(unlink remove, break) 63133965Sjdp 63233965Sjdp# Some systems don't have sbrk(). 63333965SjdpAC_CHECK_FUNCS(sbrk) 63433965Sjdp 63577310Sobrien# do we need the math library? 63677310Sobriencase "${need_libm}" in 637218822Sdimyes) 63877310Sobrien AC_CHECK_LIBM 63977310Sobrien AC_SUBST(LIBM) 64077310Sobrien ;; 64177310Sobrienesac 64277310Sobrien 64333965Sjdp# Some non-ANSI preprocessors botch requoting inside strings. That's bad 64433965Sjdp# enough, but on some of those systems, the assert macro relies on requoting 64533965Sjdp# working properly! 64633965SjdpGAS_WORKING_ASSERT 64733965Sjdp 64833965Sjdp# On some systems, the system header files may not declare malloc, realloc, 64933965Sjdp# and free. There are places where gas needs these functions to have been 65033965Sjdp# declared -- such as when taking their addresses. 65133965Sjdpgas_test_headers=" 65233965Sjdp#ifdef HAVE_MEMORY_H 65333965Sjdp#include <memory.h> 65433965Sjdp#endif 65533965Sjdp#ifdef HAVE_STRING_H 65633965Sjdp#include <string.h> 65733965Sjdp#else 65833965Sjdp#ifdef HAVE_STRINGS_H 65933965Sjdp#include <strings.h> 66033965Sjdp#endif 66133965Sjdp#endif 66233965Sjdp#ifdef HAVE_STDLIB_H 66333965Sjdp#include <stdlib.h> 66433965Sjdp#endif 66533965Sjdp#ifdef HAVE_UNISTD_H 66633965Sjdp#include <unistd.h> 66733965Sjdp#endif 66833965Sjdp" 66933965Sjdp 67033965Sjdp# Does errno.h declare errno, or do we have to add a separate declaration 67133965Sjdp# for it? 67233965SjdpGAS_CHECK_DECL_NEEDED(errno, f, int f, [ 67333965Sjdp#ifdef HAVE_ERRNO_H 67433965Sjdp#include <errno.h> 67533965Sjdp#endif 67633965Sjdp]) 67733965Sjdp 678218822SdimAC_MSG_CHECKING(for a known getopt prototype in unistd.h) 679218822SdimAC_CACHE_VAL(gas_cv_decl_getopt_unistd_h, 680218822Sdim[AC_TRY_COMPILE([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);], 681218822Sdimgas_cv_decl_getopt_unistd_h=yes, gas_cv_decl_getopt_unistd_h=no)]) 682218822SdimAC_MSG_RESULT($gas_cv_decl_getopt_unistd_h) 683218822Sdimif test $gas_cv_decl_getopt_unistd_h = yes; then 684218822Sdim AC_DEFINE([HAVE_DECL_GETOPT], 1, 685218822Sdim [Is the prototype for getopt in <unistd.h> in the expected format?]) 686218822Sdimfi 687218822Sdim 688218822SdimGAS_CHECK_DECL_NEEDED(environ, f, char **f, $gas_test_headers) 689218822SdimGAS_CHECK_DECL_NEEDED(ffs, f, int (*f)(int), $gas_test_headers) 690218822SdimGAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers) 691218822SdimGAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers) 692218822SdimGAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers) 693218822SdimGAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers) 694218822Sdim 695218822SdimAC_CHECK_DECLS([vsnprintf]) 696218822Sdim 697218822SdimBFD_BINARY_FOPEN 698218822Sdim 699218822Sdimdnl Required for html and install-html targets. 700218822SdimAC_SUBST(datarootdir) 701218822SdimAC_SUBST(docdir) 702218822SdimAC_SUBST(htmldir) 703218822Sdim 70433965Sjdpdnl This must come last. 70533965Sjdp 70633965Sjdpdnl We used to make symlinks to files in the source directory, but now 70733965Sjdpdnl we just use the right name for .c files, and create .h files in 70833965Sjdpdnl the build directory which include the right .h file. Make sure 70933965Sjdpdnl the old symlinks don't exist, so that a reconfigure in an existing 71033965Sjdpdnl directory behaves reasonably. 71133965Sjdp 712130570SobrienAC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in) 713130570SobrienAC_CONFIG_COMMANDS([default], 71433965Sjdp[rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h 71533965Sjdp echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h 71633965Sjdp echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h 71733965Sjdp echo '#include "te-'"${te_file}"'.h"' > targ-env.h 71833965Sjdp echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h 71960517Sobrien if test "x$cgen_cpu_prefix" != x ; then 72060517Sobrien echo '#include "opcodes/'"${cgen_cpu_prefix}"'-desc.h"' > cgen-desc.h 721218822Sdim fi], 72233965Sjdp[target_cpu_type=${target_cpu_type} 72360517Sobrien cgen_cpu_prefix=${cgen_cpu_prefix} 72433965Sjdp obj_format=${obj_format} 72533965Sjdp te_file=${te_file}]) 726130570Sobrien 727130570SobrienAC_OUTPUT 728