Remove a layer of indirection from hash_table
[gcc.git] / gcc / config.gcc
index 64302a7bb392392210c96b9e4d7fcc347d46dea1..93961be7d7a0fd478c503a1f43e36868d9d7f51d 100644 (file)
@@ -1,5 +1,5 @@
 # GCC target-specific configuration file.
-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
 
 #This file is part of GCC.
 
 #  gas                 Set to yes or no depending on whether the target
 #                      system normally uses GNU as.
 #
-#  need_64bit_hwint    Set to yes if HOST_WIDE_INT must be 64 bits wide
-#                      for this target.  This is true if this target
-#                      supports "long" or "wchar_t" wider than 32 bits,
-#                      or BITS_PER_WORD is wider than 32 bits.
-#                      The setting made here must match the one made in
-#                      other locations such as libcpp/configure.ac
-#
 #  configure_default_options
 #                      Set to an initializer for configure_default_options
 #                      in configargs.h, based on --with-cpu et cetera.
@@ -233,7 +226,6 @@ gnu_ld="$gnu_ld_flag"
 default_use_cxa_atexit=no
 default_gnu_indirect_function=no
 target_gtfiles=
-need_64bit_hwint=
 need_64bit_isa=
 native_system_header_dir=/usr/include
 target_type_format_char='@'
@@ -286,8 +278,8 @@ case ${target} in
  | *-*-rtemsaout*                      \
  | *-*-rtemscoff*                      \
  | *-*-solaris2                                \
- | *-*-solaris2.[0-8]                  \
- | *-*-solaris2.[0-8].*                        \
+ | *-*-solaris2.[0-9]                  \
+ | *-*-solaris2.[0-9].*                        \
  | *-*-sysv*                           \
  | vax-*-vms*                          \
  )
@@ -310,22 +302,24 @@ m32c*-*-*)
         ;;
 aarch64*-*-*)
        cpu_type=aarch64
-       need_64bit_hwint=yes
-       extra_headers="arm_neon.h"
-       extra_objs="aarch64-builtins.o"
+       extra_headers="arm_neon.h arm_acle.h"
+       extra_objs="aarch64-builtins.o aarch-common.o"
        target_has_targetm_common=yes
        ;;
 alpha*-*-*)
        cpu_type=alpha
-       need_64bit_hwint=yes
        extra_options="${extra_options} g.opt"
        ;;
 am33_2.0-*-linux*)
        cpu_type=mn10300
        ;;
+arc*-*-*)
+       cpu_type=arc
+       ;;
 arm*-*-*)
        cpu_type=arm
-       extra_headers="mmintrin.h arm_neon.h"
+       extra_objs="aarch-common.o"
+       extra_headers="mmintrin.h arm_neon.h arm_acle.h"
        target_type_format_char='%'
        c_target_objs="arm-c.o"
        cxx_target_objs="arm-c.o"
@@ -358,7 +352,6 @@ i[34567]86-*-*)
        cpu_type=i386
        c_target_objs="i386-c.o"
        cxx_target_objs="i386-c.o"
-       need_64bit_hwint=yes
        extra_options="${extra_options} fused-madd.opt"
        extra_headers="cpuid.h mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h
                       pmmintrin.h tmmintrin.h ammintrin.h smmintrin.h
@@ -366,9 +359,12 @@ i[34567]86-*-*)
                       immintrin.h x86intrin.h avxintrin.h xopintrin.h
                       ia32intrin.h cross-stdarg.h lwpintrin.h popcntintrin.h
                       lzcntintrin.h bmiintrin.h bmi2intrin.h tbmintrin.h
-                      avx2intrin.h fmaintrin.h f16cintrin.h rtmintrin.h
-                      xtestintrin.h rdseedintrin.h prfchwintrin.h adxintrin.h
-                      fxsrintrin.h xsaveintrin.h xsaveoptintrin.h"
+                      avx2intrin.h avx512fintrin.h fmaintrin.h f16cintrin.h
+                      rtmintrin.h xtestintrin.h rdseedintrin.h prfchwintrin.h
+                      adxintrin.h fxsrintrin.h xsaveintrin.h xsaveoptintrin.h
+                      avx512cdintrin.h avx512erintrin.h avx512pfintrin.h
+                      shaintrin.h clflushoptintrin.h xsavecintrin.h
+                      xsavesintrin.h"
        ;;
 x86_64-*-*)
        cpu_type=i386
@@ -381,14 +377,15 @@ x86_64-*-*)
                       immintrin.h x86intrin.h avxintrin.h xopintrin.h
                       ia32intrin.h cross-stdarg.h lwpintrin.h popcntintrin.h
                       lzcntintrin.h bmiintrin.h tbmintrin.h bmi2intrin.h
-                      avx2intrin.h fmaintrin.h f16cintrin.h rtmintrin.h
-                      xtestintrin.h rdseedintrin.h prfchwintrin.h adxintrin.h
-                      fxsrintrin.h xsaveintrin.h xsaveoptintrin.h"
-       need_64bit_hwint=yes
+                      avx2intrin.h avx512fintrin.h fmaintrin.h f16cintrin.h
+                      rtmintrin.h xtestintrin.h rdseedintrin.h prfchwintrin.h
+                      adxintrin.h fxsrintrin.h xsaveintrin.h xsaveoptintrin.h
+                      avx512cdintrin.h avx512erintrin.h avx512pfintrin.h
+                      shaintrin.h clflushoptintrin.h xsavecintrin.h
+                      xsavesintrin.h"
        ;;
 ia64-*-*)
        extra_headers=ia64intrin.h
-       need_64bit_hwint=yes
        extra_options="${extra_options} g.opt fused-madd.opt"
        ;;
 hppa*-*-*)
@@ -411,17 +408,23 @@ microblaze*-*-*)
         ;;
 mips*-*-*)
        cpu_type=mips
-       need_64bit_hwint=yes
        extra_headers="loongson.h"
        extra_options="${extra_options} g.opt mips/mips-tables.opt"
        ;;
+nds32*)
+       cpu_type=nds32
+       extra_headers="nds32_intrinsic.h"
+       ;;
+nios2-*-*)
+       cpu_type=nios2
+       extra_options="${extra_options} g.opt"
+       ;;      
 picochip-*-*)
         cpu_type=picochip
         ;;
 powerpc*-*-*)
        cpu_type=rs6000
-       extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h"
-       need_64bit_hwint=yes
+       extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h htmintrin.h htmxlintrin.h"
        case x$with_cpu in
            xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345678]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|Xe6500)
                cpu_is_64bit=yes
@@ -430,7 +433,6 @@ powerpc*-*-*)
        extra_options="${extra_options} g.opt fused-madd.opt rs6000/rs6000-tables.opt"
        ;;
 rs6000*-*-*)
-       need_64bit_hwint=yes
        extra_options="${extra_options} g.opt fused-madd.opt rs6000/rs6000-tables.opt"
        ;;
 score*-*-*)
@@ -442,22 +444,20 @@ sparc*-*-*)
        c_target_objs="sparc-c.o"
        cxx_target_objs="sparc-c.o"
        extra_headers="visintrin.h"
-       need_64bit_hwint=yes
        ;;
 spu*-*-*)
        cpu_type=spu
-       need_64bit_hwint=yes
        ;;
 s390*-*-*)
        cpu_type=s390
-       need_64bit_hwint=yes
        extra_options="${extra_options} fused-madd.opt"
+       extra_headers="s390intrin.h htmintrin.h htmxlintrin.h"
        ;;
 # Note the 'l'; we need to be able to match e.g. "shle" or "shl".
 sh[123456789lbe]*-*-* | sh-*-*)
        cpu_type=sh
-       need_64bit_hwint=yes
        extra_options="${extra_options} fused-madd.opt"
+       extra_objs="${extra_objs} sh_treg_combine.o sh-mem.o sh_optimize_sett_clrt.o"
        ;;
 v850*-*-*)
        cpu_type=v850
@@ -472,11 +472,9 @@ xtensa*-*-*)
        ;;
 tilegx*-*-*)
        cpu_type=tilegx
-       need_64bit_hwint=yes
        ;;
-tilepro-*-*)
+tilepro*-*-*)
        cpu_type=tilepro
-       need_64bit_hwint=yes
        ;;
 esac
 
@@ -496,6 +494,27 @@ then
 fi
 
 case ${target} in
+aarch64*-*-*)
+       tm_p_file="${tm_p_file} arm/aarch-common-protos.h"
+       case ${with_abi} in
+       "")
+               if test "x$with_multilib_list" = xilp32; then
+                       tm_file="aarch64/biarchilp32.h ${tm_file}"
+               else
+                       tm_file="aarch64/biarchlp64.h ${tm_file}"
+               fi
+               ;;
+       ilp32)
+               tm_file="aarch64/biarchilp32.h ${tm_file}"
+               ;;
+       lp64)
+               tm_file="aarch64/biarchlp64.h ${tm_file}"
+               ;;
+       *)
+               echo "Unknown ABI used in --with-abi=$with_abi"
+               exit 1
+       esac
+       ;;
 i[34567]86-*-*)
        if test "x$with_abi" != x; then
                echo "This target does not support --with-abi."
@@ -536,6 +555,13 @@ x86_64-*-*)
        fi
        tm_file="vxworks-dummy.h ${tm_file}"
        ;;
+arm*-*-*)
+       tm_p_file="${tm_p_file} arm/aarch-common-protos.h"
+       tm_file="vxworks-dummy.h ${tm_file}"
+       ;;
+mips*-*-* | sh*-*-* | sparc*-*-*)
+       tm_file="vxworks-dummy.h ${tm_file}"
+       ;;
 esac
 
 # On a.out targets, we need to use collect2.
@@ -548,6 +574,24 @@ esac
 # Common C libraries.
 tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
 
+# 32-bit x86 processors supported by --with-arch=.  Each processor
+# MUST be separated by exactly one space.
+x86_archs="athlon athlon-4 athlon-fx athlon-mp athlon-tbird \
+athlon-xp k6 k6-2 k6-3 geode c3 c3-2 winchip-c6 winchip2 i386 i486 \
+i586 i686 pentium pentium-m pentium-mmx pentium2 pentium3 pentium3m \
+pentium4 pentium4m pentiumpro prescott"
+
+# 64-bit x86 processors supported by --with-arch=.  Each processor
+# MUST be separated by exactly one space.
+x86_64_archs="amdfam10 athlon64 athlon64-sse3 barcelona bdver1 bdver2 \
+bdver3 bdver4 btver1 btver2 k8 k8-sse3 opteron opteron-sse3 nocona \
+core2 corei7 corei7-avx core-avx-i core-avx2 atom slm nehalem westmere \
+sandybridge ivybridge haswell broadwell bonnell silvermont x86-64 native"
+
+# Additional x86 processors supported by --with-cpu=.  Each processor
+# MUST be separated by exactly one space.
+x86_cpus="generic intel"
+
 # Common parts for widely ported systems.
 case ${target} in
 *-*-darwin*)
@@ -577,6 +621,26 @@ case ${target} in
     "" | yes | posix) thread_file='posix' ;;
   esac
   ;;
+*-*-dragonfly*)
+  gas=yes
+  gnu_ld=yes
+  tmake_file="t-slibgcc"
+  case ${enable_threads} in
+    "" | yes | posix)
+      thread_file='posix'
+      ;;
+    no | single)
+      # Let these non-posix thread selections fall through if requested
+      ;;
+    *)
+      echo 'Unknown thread configuration for DragonFly BSD'
+      exit 1
+      ;;
+  esac
+  extra_options="$extra_options rpath.opt dragonfly.opt"
+  default_use_cxa_atexit=yes
+  use_gcc_stdint=wrap
+  ;;
 *-*-freebsd*)
   # This is the generic ELF configuration of FreeBSD.  Later
   # machine-specific sections may refine and add to this
@@ -618,7 +682,6 @@ case ${target} in
     *)
       default_use_cxa_atexit=yes;;
   esac
-  # need_64bit_hwint=yes # system compiler has this for all arch!
   use_gcc_stdint=wrap
   ;;
 *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
@@ -636,11 +699,15 @@ case ${target} in
       native_system_header_dir=/include
       ;;
   esac
-  # glibc / uclibc / bionic switch.
+  # Linux C libraries selection switch: glibc / uclibc / bionic.
   # uclibc and bionic aren't usable for GNU/Hurd and neither for GNU/k*BSD.
   case $target in
     *linux*)
-      extra_options="$extra_options linux.opt";;
+      tm_p_file="${tm_p_file} linux-protos.h"
+      tmake_file="${tmake_file} t-linux"
+      extra_objs="${extra_objs} linux.o"
+      extra_options="${extra_options} linux.opt"
+      ;;
   esac
   case $target in
     *-*-*android*)
@@ -658,13 +725,6 @@ case ${target} in
   default_use_cxa_atexit=yes
   use_gcc_tgmath=no
   use_gcc_stdint=wrap
-  # Add Android userspace support to Linux targets.
-  case $target in
-    *linux*)
-      tm_file="$tm_file linux-android.h"
-      extra_options="$extra_options linux-android.opt"
-      ;;
-  esac
   # Enable compilation for Android by default for *android* targets.
   case $target in
     *-*-*android*)
@@ -730,7 +790,9 @@ case ${target} in
   case ${enable_threads} in
     yes) thread_file='rtems' ;;
   esac
+  tmake_file="${tmake_file} t-rtems"
   extra_options="${extra_options} rtems.opt"
+  default_use_cxa_atexit=yes
   use_gcc_stdint=wrap
   ;;
 *-*-uclinux*)
@@ -744,16 +806,10 @@ case ${target} in
 *-*-solaris2*)
   # i?86-*-solaris2* needs to insert headers between cpu default and
   # Solaris 2 specific ones.
-  sol2_tm_file="dbxelf.h elfos.h ${cpu_type}/sysv4.h sol2.h ${cpu_type}/sol2.h"
-  case ${target} in
-    *-*-solaris2.1[0-9]*)
-      sol2_tm_file="${sol2_tm_file} sol2-10.h"
-      use_gcc_stdint=wrap
-      ;;
-    *)
-      use_gcc_stdint=provide
-      ;;
-  esac
+  sol2_tm_file_head="dbxelf.h elfos.h ${cpu_type}/sysv4.h"
+  sol2_tm_file_tail="${cpu_type}/sol2.h sol2.h"
+  sol2_tm_file="${sol2_tm_file_head} ${sol2_tm_file_tail}"
+  use_gcc_stdint=wrap
   if test x$gnu_ld = xyes; then
     tm_file="usegld.h ${tm_file}"
   fi
@@ -795,14 +851,14 @@ case ${target} in
   tmake_file=t-vxworks
   xm_defines=POSIX
   extra_options="${extra_options} vxworks.opt"
-  extra_objs=vxworks.o
+  extra_objs="$extra_objs vxworks.o"
   case ${enable_threads} in
     no) ;;
     "" | yes | vxworks) thread_file='vxworks' ;;
     *) echo 'Unknown thread configuration for VxWorks'; exit 1 ;;
   esac
   ;;
-*-*-elf)
+*-*-elf|arc*-*-elf*)
   # Assume that newlib is being used and so __cxa_atexit is provided.
   default_use_cxa_atexit=yes
   use_gcc_stdint=wrap
@@ -820,6 +876,22 @@ aarch64*-*-elf)
                tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
                ;;
        esac
+       aarch64_multilibs="${with_multilib_list}"
+       if test "$aarch64_multilibs" = "default"; then
+               aarch64_multilibs="lp64,ilp32"
+       fi
+       aarch64_multilibs=`echo $aarch64_multilibs | sed -e 's/,/ /g'`
+       for aarch64_multilib in ${aarch64_multilibs}; do
+               case ${aarch64_multilib} in
+               ilp32 | lp64 )
+                       TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG},${aarch64_multilib}"
+                       ;;
+               *)
+                       echo "--with-multilib-list=${aarch64_multilib} not supported."
+                       exit 1
+               esac
+       done
+       TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
        ;;
 aarch64*-*-linux*)
        tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h"
@@ -830,6 +902,24 @@ aarch64*-*-linux*)
                tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
                ;;
        esac
+       aarch64_multilibs="${with_multilib_list}"
+       if test "$aarch64_multilibs" = "default"; then
+               # TODO: turn on ILP32 multilib build after its support is mature.
+               # aarch64_multilibs="lp64,ilp32"
+               aarch64_multilibs="lp64"
+       fi
+       aarch64_multilibs=`echo $aarch64_multilibs | sed -e 's/,/ /g'`
+       for aarch64_multilib in ${aarch64_multilibs}; do
+               case ${aarch64_multilib} in
+               ilp32 | lp64 )
+                       TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG},${aarch64_multilib}"
+                       ;;
+               *)
+                       echo "--with-multilib-list=${aarch64_multilib} not supported."
+                       exit 1
+               esac
+       done
+       TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
        ;;
 alpha*-*-linux*)
        tm_file="elfos.h ${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h glibc-stdint.h"
@@ -855,47 +945,88 @@ alpha*-dec-*vms*)
        tm_file="${tm_file} vms/vms.h alpha/vms.h"
        tmake_file="${tmake_file} alpha/t-vms"
        ;;
+arc*-*-elf*)
+       extra_headers="arc-simd.h"
+       tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
+       tmake_file="arc/t-arc-newlib arc/t-arc"
+       case x"${with_cpu}" in
+         xarc600|xarc601|xarc700)
+               target_cpu_default="TARGET_CPU_$with_cpu"
+               ;;
+       esac
+       if test x${with_endian} = x; then
+               case ${target} in
+               arc*be-*-* | arc*eb-*-*)        with_endian=big ;;
+               *)                              with_endian=little ;;
+               esac
+       fi
+       case ${with_endian} in
+       big|little)             ;;
+       *)      echo "with_endian=${with_endian} not supported."; exit 1 ;;
+       esac
+       case ${with_endian} in
+       big*)   tm_defines="DRIVER_ENDIAN_SELF_SPECS=\\\"%{!EL:%{!mlittle-endian:-mbig-endian}}\\\" ${tm_defines}"
+       esac
+       ;;
+arc*-*-linux-uclibc*)
+       extra_headers="arc-simd.h"
+       tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file}"
+       tmake_file="${tmake_file} arc/t-arc-uClibc arc/t-arc"
+       tm_defines="${tm_defines} TARGET_SDATA_DEFAULT=0"
+       tm_defines="${tm_defines} TARGET_MMEDIUM_CALLS_DEFAULT=1"
+       case x"${with_cpu}" in
+         xarc600|xarc601|xarc700)
+               target_cpu_default="TARGET_CPU_$with_cpu"
+               ;;
+       esac
+       if test x${with_endian} = x; then
+               case ${target} in
+               arc*be-*-* | arc*eb-*-*)        with_endian=big ;;
+               *)                              with_endian=little ;;
+               esac
+       fi
+       case ${with_endian} in
+       big|little)             ;;
+       *)      echo "with_endian=${with_endian} not supported."; exit 1 ;;
+       esac
+       case ${with_endian} in
+       big*)   tm_defines="DRIVER_ENDIAN_SELF_SPECS=\\\"%{!EL:%{!mlittle-endian:-mbig-endian}}\\\" ${tm_defines}"
+       esac
+        ;;
 arm-wrs-vxworks)
        tm_file="elfos.h arm/elf.h arm/aout.h ${tm_file} vx-common.h vxworks.h arm/vxworks.h"
        extra_options="${extra_options} arm/vxworks.opt"
        tmake_file="${tmake_file} arm/t-arm arm/t-vxworks"
        ;;
 arm*-*-netbsdelf*)
-       tm_file="dbxelf.h elfos.h netbsd.h netbsd-elf.h arm/elf.h arm/aout.h arm/arm.h arm/netbsd-elf.h"
+       tm_file="dbxelf.h elfos.h netbsd.h netbsd-elf.h arm/elf.h arm/aout.h ${tm_file} arm/netbsd-elf.h"
        extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
        tmake_file="${tmake_file} arm/t-arm"
        ;;
 arm*-*-linux-*)                        # ARM GNU/Linux with ELF
        tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
+       extra_options="${extra_options} linux-android.opt"
        case $target in
        arm*b-*-linux*)
            tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
            ;;
        esac
        tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
-       tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h arm/aout.h arm/arm.h"
+       tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h arm/aout.h vxworks-dummy.h arm/arm.h"
        # Define multilib configuration for arm-linux-androideabi.
        case ${target} in
        *-androideabi)
            tmake_file="$tmake_file arm/t-linux-androideabi"
            ;;
        esac
-       # The BPABI long long divmod functions return a 128-bit value in
-       # registers r0-r3.  Correctly modeling that requires the use of
-       # TImode.
-       need_64bit_hwint=yes
        # The EABI requires the use of __cxa_atexit.
        default_use_cxa_atexit=yes
        with_tls=${with_tls:-gnu}
        ;;
 arm*-*-uclinux*eabi*)          # ARM ucLinux
        tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/linux-gas.h arm/uclinux-elf.h glibc-stdint.h"
-       tmake_file="arm/t-arm arm/t-arm-elf arm/t-bpabi"
-       tm_file="$tm_file arm/bpabi.h arm/uclinux-eabi.h arm/aout.h arm/arm.h"
-       # The BPABI long long divmod functions return a 128-bit value in
-       # registers r0-r3.  Correctly modeling that requires the use of
-       # TImode.
-       need_64bit_hwint=yes
+       tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf arm/t-bpabi"
+       tm_file="$tm_file arm/bpabi.h arm/uclinux-eabi.h arm/aout.h vxworks-dummy.h arm/arm.h"
        # The EABI requires the use of __cxa_atexit.
        default_use_cxa_atexit=yes
        ;;
@@ -904,13 +1035,9 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*)
        arm*eb-*-eabi*)
          tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
        esac
-       # The BPABI long long divmod functions return a 128-bit value in
-       # registers r0-r3.  Correctly modeling that requires the use of
-       # TImode.
-       need_64bit_hwint=yes
        default_use_cxa_atexit=yes
        tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/bpabi.h"
-       tmake_file="arm/t-arm arm/t-arm-elf"
+       tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf"
        case ${target} in
        arm*-*-eabi*)
          tm_file="$tm_file newlib-stdint.h"
@@ -919,7 +1046,7 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*)
          ;;
        arm*-*-rtems*)
          tm_file="${tm_file} rtems.h arm/rtems-eabi.h newlib-stdint.h"
-         tmake_file="${tmake_file} arm/t-bpabi t-rtems arm/t-rtems-eabi"
+         tmake_file="${tmake_file} arm/t-bpabi arm/t-rtems-eabi"
          ;;
        arm*-*-symbianelf*)
          tm_file="${tm_file} arm/symbian.h"
@@ -928,11 +1055,11 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*)
          tmake_file="${tmake_file} arm/t-symbian"
          ;;
        esac
-       tm_file="${tm_file} arm/aout.h arm/arm.h"
+       tm_file="${tm_file} arm/aout.h vxworks-dummy.h arm/arm.h"
        ;;
 avr-*-rtems*)
        tm_file="elfos.h avr/elf.h avr/avr-arch.h avr/avr.h dbxelf.h avr/rtems.h rtems.h newlib-stdint.h"
-       tmake_file="avr/t-avr avr/t-multilib t-rtems avr/t-rtems"
+       tmake_file="${tmake_file} avr/t-avr avr/t-multilib avr/t-rtems"
        extra_gcc_objs="driver-avr.o avr-devices.o"
        extra_objs="avr-devices.o avr-log.o"
        ;;
@@ -942,7 +1069,7 @@ avr-*-*)
            tm_file="${tm_file} ${cpu_type}/avrlibc.h"
            tm_defines="${tm_defines} WITH_AVRLIBC"
        fi
-       tmake_file="avr/t-avr avr/t-multilib"
+       tmake_file="${tmake_file} avr/t-avr avr/t-multilib"
        use_gcc_stdint=wrap
        extra_gcc_objs="driver-avr.o avr-devices.o"
        extra_objs="avr-devices.o avr-log.o"
@@ -959,12 +1086,12 @@ bfin*-uclinux*)
        ;;
 bfin*-linux-uclibc*)
        tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h gnu-user.h linux.h glibc-stdint.h bfin/linux.h ./linux-sysroot-suffix.h"
-       tmake_file="bfin/t-bfin-linux t-slibgcc"
+       tmake_file="bfin/t-bfin-linux t-slibgcc t-linux"
        use_collect2=no
        ;;
 bfin*-rtems*)
        tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h bfin/rtems.h rtems.h newlib-stdint.h"
-       tmake_file="t-rtems bfin/t-rtems"
+       tmake_file="${tmake_file} bfin/t-rtems"
        ;;
 bfin*-*)
        tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h bfin/elf.h"
@@ -994,7 +1121,7 @@ cris-*-elf | cris-*-none)
 crisv32-*-linux* | cris-*-linux*)
        tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h glibc-stdint.h cris/linux.h"
        # We need to avoid using t-linux, so override default tmake_file
-       tmake_file="cris/t-cris cris/t-linux t-slibgcc"
+       tmake_file="cris/t-cris cris/t-linux t-slibgcc t-linux"
        extra_options="${extra_options} cris/linux.opt"
        case $target in
          cris-*-*)
@@ -1038,11 +1165,11 @@ moxie-*-uclinux*)
        tmake_file="${tmake_file} moxie/t-moxie"
        ;;
 moxie-*-rtems*)
-       tmake_file="${tmake_file} moxie/t-moxie t-rtems"
+       tmake_file="${tmake_file} moxie/t-moxie"
        tm_file="moxie/moxie.h dbxelf.h elfos.h moxie/rtems.h rtems.h newlib-stdint.h"
        ;;
 h8300-*-rtems*)
-       tmake_file="h8300/t-h8300 t-rtems h8300/t-rtems"
+       tmake_file="${tmake_file} h8300/t-h8300 h8300/t-rtems"
        tm_file="h8300/h8300.h dbxelf.h elfos.h h8300/elf.h h8300/rtems.h rtems.h newlib-stdint.h"
        ;;
 h8300-*-elf*)
@@ -1054,9 +1181,7 @@ hppa*64*-*-linux*)
        tm_file="pa/pa64-start.h ${tm_file} dbxelf.h elfos.h gnu-user.h linux.h \
                 glibc-stdint.h pa/pa-linux.h pa/pa64-regs.h pa/pa-64.h \
                 pa/pa64-linux.h"
-       tmake_file="${tmake_file} pa/t-linux"
        gas=yes gnu_ld=yes
-       need_64bit_hwint=yes
        ;;
 hppa*-*-linux*)
        target_cpu_default="MASK_PA_11|MASK_NO_SPACE_REGS"
@@ -1068,7 +1193,6 @@ hppa*-*-openbsd*)
        target_cpu_default="MASK_PA_11"
        tm_file="${tm_file} dbxelf.h elfos.h openbsd.h openbsd-stdint.h openbsd-libpthread.h \
                 pa/pa-openbsd.h pa/pa32-regs.h pa/pa32-openbsd.h"
-       tmake_file="${tmake_file} pa/t-openbsd"
        extra_options="${extra_options} openbsd.opt"
        gas=yes
        gnu_ld=yes
@@ -1132,7 +1256,6 @@ hppa*64*-*-hpux11*)
        esac
        extra_options="${extra_options} pa/pa-hpux.opt \
                       pa/pa-hpux1010.opt pa/pa64-hpux.opt hpux11.opt"
-       need_64bit_hwint=yes
        tmake_file="t-slibgcc"
        case x${enable_threads} in
        x | xyes | xposix )
@@ -1218,6 +1341,14 @@ x86_64-*-rdos*)
     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rdos.h i386/rdos64.h"
     tmake_file="i386/t-i386elf t-svr4"
     ;;
+i[34567]86-*-dragonfly*)
+       tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/dragonfly.h"
+       tmake_file="${tmake_file} i386/t-crtstuff"
+       ;;
+x86_64-*-dragonfly*)
+       tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/x86-64.h i386/dragonfly.h"
+       tmake_file="${tmake_file} i386/t-crtstuff"
+       ;;
 i[34567]86-*-freebsd*)
        tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
        ;;
@@ -1260,7 +1391,8 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i
        tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h gnu-user.h glibc-stdint.h"
        case ${target} in
        i[34567]86-*-linux*)
-               tm_file="${tm_file} linux.h"
+               tm_file="${tm_file} linux.h linux-android.h"
+               extra_options="${extra_options} linux-android.opt"
                # Assume modern glibc
                default_gnu_indirect_function=yes
                if test x$enable_targets = xall; then
@@ -1284,20 +1416,21 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i
                        done
                        TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
                        need_64bit_isa=yes
-                       case X"${with_cpu}" in
-                       Xgeneric|Xatom|Xcore2|Xcorei7|Xcorei7-avx|Xnocona|Xx86-64|Xbdver3|Xbdver2|Xbdver1|Xbtver2|Xbtver1|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx|Xathlon64-sse3|Xk8-sse3|Xopteron-sse3)                 
-                               ;;
-                       X)
+                       if test x$with_cpu = x; then
                                if test x$with_cpu_64 = x; then
                                        with_cpu_64=generic
                                fi
-                               ;;
-                       *)
-                               echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2
-                               echo "generic atom core2 corei7 corei7-avx nocona x86-64 bdver3 bdver2 bdver1 btver2 btver1 amdfam10 barcelona k8 opteron athlon64 athlon-fx athlon64-sse3 k8-sse3 opteron-sse3" 1>&2
-                               exit 1
-                               ;;
-                       esac
+                       else
+                               case " $x86_cpus $x86_archs $x86_64_archs " in
+                               *" $with_cpu "*)
+                                       ;;
+                               *)
+                                       echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2
+                                       echo "$x86_cpus $x86_archs $x86_64_archs " 1>&2
+                                       exit 1
+                                       ;;
+                               esac
+                       fi
                else
                        tm_file="${tm_file} i386/gnu-user-common.h i386/gnu-user.h i386/linux-common.h i386/linux.h"
                fi
@@ -1321,7 +1454,8 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
                 i386/x86-64.h i386/gnu-user-common.h i386/gnu-user64.h"
        case ${target} in
        x86_64-*-linux*)
-               tm_file="${tm_file} linux.h i386/linux-common.h i386/linux64.h"
+               tm_file="${tm_file} linux.h linux-android.h i386/linux-common.h i386/linux64.h"
+               extra_options="${extra_options} linux-android.opt"
                # Assume modern glibc
                default_gnu_indirect_function=yes
                ;;
@@ -1383,44 +1517,32 @@ i[34567]86-*-nto-qnx*)
        ;;
 i[34567]86-*-rtems*)
        tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h i386/rtemself.h rtems.h newlib-stdint.h"
-       tmake_file="${tmake_file} i386/t-rtems t-rtems"
+       tmake_file="${tmake_file} i386/t-rtems"
        ;;
 i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
-       tm_file="${tm_file} i386/unix.h i386/att.h ${sol2_tm_file}"
        # Set default arch_32 to pentium4, tune_32 to generic like the other
        # i386 targets, although config.guess defaults to i386-pc-solaris2*.
-       case ${target} in
-       *-*-solaris2.9*)
-               # Solaris 9/x86 cannot execute SSE/SSE2 instructions by default.
-               with_arch_32=${with_arch_32:-pentiumpro}
-               ;;
-       *)
-               with_arch_32=${with_arch_32:-pentium4}
-               ;;
-       esac
+       with_arch_32=${with_arch_32:-pentium4}
        with_tune_32=${with_tune_32:-generic}
-       case ${target} in
-       *-*-solaris2.1[0-9]*)
-               tm_file="${tm_file} i386/x86-64.h i386/sol2-bi.h sol2-bi.h"
-               tm_defines="${tm_defines} TARGET_BI_ARCH=1"
-               tmake_file="$tmake_file i386/t-sol2-64"
-               need_64bit_isa=yes
-               case X"${with_cpu}" in
-               Xgeneric|Xatom|Xcore2|Xcorei7|Xcorei7-avx|Xnocona|Xx86-64|Xbdver3|Xbdver2|Xbdver1|Xbtver2|Xbtver1|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx|Xathlon64-sse3|Xk8-sse3|Xopteron-sse3)
-                       ;;
-               X)
-                       if test x$with_cpu_64 = x; then
-                               with_cpu_64=generic
-                       fi
+       tm_file="${tm_file} i386/unix.h i386/att.h ${sol2_tm_file_head} i386/x86-64.h ${sol2_tm_file_tail}"
+       tm_defines="${tm_defines} TARGET_BI_ARCH=1"
+       tmake_file="$tmake_file i386/t-sol2"
+       need_64bit_isa=yes
+       if test x$with_cpu = x; then
+               if test x$with_cpu_64 = x; then
+                       with_cpu_64=generic
+               fi
+       else
+               case " $x86_cpus $x86_archs $x86_64_archs " in
+               *" $with_cpu "*)
                        ;;
                *)
                        echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2
-                       echo "generic atom core2 corei7 corei7-avx nocona x86-64 bdver3 bdver2 bdver1 btver2 btver1 amdfam10 barcelona k8 opteron athlon64 athlon-fx athlon64-sse3 k8-sse3 opteron-sse3" 1>&2
+                       echo "$x86_cpus $x86_archs $x86_64_archs" 1>&2
                        exit 1
                        ;;
                esac
-               ;;
-       esac
+       fi
        ;;
 i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae)
        tm_file="${tm_file} i386/unix.h i386/att.h elfos.h vx-common.h"
@@ -1449,9 +1571,28 @@ i[34567]86-*-cygwin*)
        fi
        use_gcc_stdint=wrap
        ;;
+x86_64-*-cygwin*)
+       need_64bit_isa=yes
+       tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/cygwin.h i386/cygwin-w64.h i386/cygwin-stdint.h"
+       xm_file=i386/xm-cygwin.h
+       tmake_file="${tmake_file} i386/t-cygming t-slibgcc i386/t-cygwin-w64"
+       target_gtfiles="\$(srcdir)/config/i386/winnt.c"
+       extra_options="${extra_options} i386/cygming.opt"
+       extra_objs="winnt.o winnt-stubs.o"
+       c_target_objs="${c_target_objs} msformat-c.o"
+       cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
+       if test x$enable_threads = xyes; then
+               thread_file='posix'
+       fi
+       use_gcc_stdint=wrap
+       tm_defines="${tm_defines} TARGET_CYGWIN64=1"
+       ;;
 i[34567]86-*-mingw* | x86_64-*-mingw*)
        tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h"
        xm_file=i386/xm-mingw32.h
+       c_target_objs="${c_target_objs} winnt-c.o"
+       cxx_target_objs="${cxx_target_objs} winnt-c.o"
+       target_has_targetcm="yes"
        case ${target} in
                x86_64-*-* | *-w64-*)
                        need_64bit_isa=yes
@@ -1471,27 +1612,28 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
                        tm_file="${tm_file} i386/mingw-w64.h"
                        if test x$enable_targets = xall; then
                                tm_defines="${tm_defines} TARGET_BI_ARCH=1"
-                               case X"${with_cpu}" in
-                               Xgeneric|Xatom|Xcore2|Xcorei7|Xcorei7-avx|Xnocona|Xx86-64|Xbdver3|Xbdver2|Xbdver1|Xbtver2|Xbtver1|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx|Xathlon64-sse3|Xk8-sse3|Xopteron-sse3)
-                                       ;;
-                               X)
+                               if test x$with_cpu = x; then
                                        if test x$with_cpu_64 = x; then
                                                with_cpu_64=generic
                                        fi
-                                       ;;
-                               *)
-                                       echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2
-                                       echo "generic atom core2 corei7 Xcorei7-avx nocona x86-64 bdver3 bdver2 bdver1 btver2 btver1 amdfam10 barcelona k8 opteron athlon64 athlon-fx athlon64-sse3 k8-sse3 opteron-sse3" 1>&2
-                                       exit 1
-                                       ;;
-                               esac
+                               else
+                                       case " $x86_cpus $x86_archs $x86_64_archs " in
+                                       *" $with_cpu "*)
+                                               ;;
+                                       *)
+                                               echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2
+                                               echo "$x86_cpus $x86_archs $x86_64_archs" 1>&2
+                                               exit 1
+                                               ;;
+                                       esac
+                               fi
                        fi
                        ;;
                *)
                        ;;
        esac
        tm_file="${tm_file} i386/mingw-stdint.h"
-       tmake_file="${tmake_file} i386/t-cygming t-slibgcc"
+       tmake_file="${tmake_file} t-winnt i386/t-cygming t-slibgcc"
         case ${target} in
                x86_64-w64-*)
                                tmake_file="${tmake_file} i386/t-mingw-w64"
@@ -1612,7 +1754,6 @@ lm32-*-elf*)
 lm32-*-rtems*)
        tm_file="dbxelf.h elfos.h ${tm_file} lm32/rtems.h rtems.h newlib-stdint.h"
        tmake_file="${tmake_file} lm32/t-lm32"
-       tmake_file="${tmake_file} t-rtems"
        tmake_file="${tmake_file} lm32/t-rtems"
          ;;
 lm32-*-uclinux*)
@@ -1627,12 +1768,11 @@ m32rle-*-elf*)
        ;;
 m32r-*-rtems*)
        tm_file="dbxelf.h elfos.h ${tm_file} m32r/rtems.h rtems.h newlib-stdint.h"
-       tmake_file="m32r/t-m32r t-rtems"
+       tmake_file="${tmake_file} m32r/t-m32r"
        ;;
 m32r-*-linux*)
        tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} m32r/linux.h"
-       # We override the tmake_file for linux -- why?
-       tmake_file="m32r/t-linux t-slibgcc"
+       tmake_file="${tmake_file} m32r/t-linux t-slibgcc"
        gnu_ld=yes
        if test x$enable_threads = xyes; then
                thread_file='posix'
@@ -1640,8 +1780,7 @@ m32r-*-linux*)
        ;;
 m32rle-*-linux*)
        tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h m32r/little.h ${tm_file} m32r/linux.h"
-       # We override the tmake_file for linux -- why?
-       tmake_file="m32r/t-linux t-slibgcc"
+       tmake_file="${tmake_file} m32r/t-linux t-slibgcc"
        gnu_ld=yes
        if test x$enable_threads = xyes; then
                thread_file='posix'
@@ -1720,7 +1859,7 @@ m68k-*-linux*)                    # Motorola m68k's running GNU/Linux
 m68k-*-rtems*)
        default_m68k_cpu=68020
        default_cf_cpu=5206
-       tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-crtstuff t-rtems m68k/t-rtems m68k/t-mlibs"
+       tmake_file="${tmake_file} m68k/t-floatlib m68k/t-m68kbare m68k/t-crtstuff m68k/t-rtems m68k/t-mlibs"
        tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/m68kemb.h m68k/m68020-elf.h m68k/rtemself.h rtems.h newlib-stdint.h"
        tm_defines="${tm_defines} MOTOROLA=1"
        ;;
@@ -1757,12 +1896,20 @@ microblaze*-linux*)
        tmake_file="${tmake_file} microblaze/t-microblaze-linux"
        ;;
 microblaze*-*-rtems*)
+       case $target in
+               microblazeel-*)
+                       tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=0"
+                       ;;
+               microblaze-*)
+                       tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=4321"
+                       ;;
+       esac
        tm_file="${tm_file} dbxelf.h"
        tm_file="${tm_file} microblaze/rtems.h rtems.h newlib-stdint.h"
        c_target_objs="${c_target_objs} microblaze-c.o"
        cxx_target_objs="${cxx_target_objs} microblaze-c.o"
        tmake_file="${tmake_file} microblaze/t-microblaze"
-       tmake_file="${tmake_file} t-rtems microblaze/t-rtems"
+       tmake_file="${tmake_file} microblaze/t-rtems"
         ;;
 microblaze*-*-elf)
        case $target in
@@ -1784,15 +1931,16 @@ mips*-*-netbsd*)                        # NetBSD/mips, either endian.
        extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
        ;;
 mips*-mti-linux*)
-       tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h mips/linux-common.h mips/mti-linux.h"
+       tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h mips/linux-common.h mips/mti-linux.h"
+       extra_options="${extra_options} linux-android.opt"
        tmake_file="${tmake_file} mips/t-mti-linux"
        tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33 MIPS_ABI_DEFAULT=ABI_32"
        gnu_ld=yes
        gas=yes
-       test x$with_llsc != x || with_llsc=yes
        ;;
 mips64*-*-linux* | mipsisa64*-*-linux*)
-       tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h mips/linux-common.h"
+       tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h mips/linux-common.h"
+       extra_options="${extra_options} linux-android.opt"
        tmake_file="${tmake_file} mips/t-linux64"
        tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32"
        case ${target} in
@@ -1810,10 +1958,10 @@ mips64*-*-linux* | mipsisa64*-*-linux*)
        esac
        gnu_ld=yes
        gas=yes
-       test x$with_llsc != x || with_llsc=yes
        ;;
 mips*-*-linux*)                                # Linux MIPS, either endian.
-        tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h"
+       tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h"
+       extra_options="${extra_options} linux-android.opt"
        if test x$enable_targets = xall; then
                tm_file="${tm_file} mips/gnu-user64.h mips/linux64.h"
                tmake_file="${tmake_file} mips/t-linux64"
@@ -1826,15 +1974,14 @@ mips*-*-linux*)                         # Linux MIPS, either endian.
         mipsisa32*)
                tm_defines="${tm_defines} MIPS_ISA_DEFAULT=32"
         esac
-       test x$with_llsc != x || with_llsc=yes
        ;;
 mips*-mti-elf*)
-       tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/sde.h mips/mti-elf.h"
+       tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/n32-elf.h mips/sde.h mips/mti-elf.h"
        tmake_file="mips/t-mti-elf"
        tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33 MIPS_ABI_DEFAULT=ABI_32"
        ;;
 mips*-sde-elf*)
-       tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/sde.h"
+       tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/n32-elf.h mips/sde.h"
        tmake_file="mips/t-sde"
        extra_options="${extra_options} mips/sde.opt"
        case "${with_newlib}" in
@@ -1904,23 +2051,25 @@ mipsisa64r2-*-elf* | mipsisa64r2el-*-elf*)
 mipsisa64sr71k-*-elf*)
         tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h"
         tmake_file=mips/t-sr71k
-       target_cpu_default="MASK_64BIT|MASK_FLOAT64"
        tm_defines="${tm_defines} MIPS_ISA_DEFAULT=64 MIPS_CPU_STRING_DEFAULT=\\\"sr71000\\\" MIPS_ABI_DEFAULT=ABI_EABI"
         ;;
 mipsisa64sb1-*-elf* | mipsisa64sb1el-*-elf*)
        tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h"
        tmake_file="mips/t-elf mips/t-sb1"
-       target_cpu_default="MASK_64BIT|MASK_FLOAT64"
        tm_defines="${tm_defines} MIPS_ISA_DEFAULT=64 MIPS_CPU_STRING_DEFAULT=\\\"sb1\\\" MIPS_ABI_DEFAULT=ABI_O64"
        ;;
-mips-*-elf* | mipsel-*-elf*)
+mips-*-elf* | mipsel-*-elf* | mipsr5900-*-elf* | mipsr5900el-*-elf*)
        tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h"
        tmake_file="mips/t-elf"
        ;;
+mips64r5900-*-elf* | mips64r5900el-*-elf*)
+       tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/n32-elf.h"
+       tmake_file="mips/t-elf"
+       tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_N32"
+       ;;
 mips64-*-elf* | mips64el-*-elf*)
        tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h"
        tmake_file="mips/t-elf"
-       target_cpu_default="MASK_64BIT|MASK_FLOAT64"
        tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_O64"
        ;;
 mips64vr-*-elf* | mips64vrel-*-elf*)
@@ -1931,12 +2080,11 @@ mips64vr-*-elf* | mips64vrel-*-elf*)
 mips64orion-*-elf* | mips64orionel-*-elf*)
        tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elforion.h mips/elf.h"
        tmake_file="mips/t-elf"
-       target_cpu_default="MASK_64BIT|MASK_FLOAT64"
        tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_O64"
        ;;
 mips*-*-rtems*)
        tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/rtems.h rtems.h"
-       tmake_file="mips/t-elf t-rtems mips/t-rtems"
+       tmake_file="${tmake_file} mips/t-elf mips/t-rtems"
        ;;
 mips-wrs-vxworks)
        tm_file="elfos.h ${tm_file} mips/elf.h vx-common.h vxworks.h mips/vxworks.h"
@@ -1948,7 +2096,6 @@ mipstx39-*-elf* | mipstx39el-*-elf*)
        ;;
 mmix-knuth-mmixware)
        tm_file="${tm_file} newlib-stdint.h"
-       need_64bit_hwint=yes
        use_gcc_stdint=wrap
        ;;
 mn10300-*-*)
@@ -1960,6 +2107,37 @@ mn10300-*-*)
        use_collect2=no
        use_gcc_stdint=wrap
        ;;
+msp430*-*-*)
+       tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
+       c_target_objs="msp430-c.o"
+       cxx_target_objs="msp430-c.o"
+       tmake_file="${tmake_file} msp430/t-msp430"
+       ;;
+nds32le-*-*)
+       target_cpu_default="0"
+       tm_defines="${tm_defines}"
+       tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
+       tmake_file="nds32/t-mlibs"
+       ;;
+nds32be-*-*)
+       target_cpu_default="0|MASK_BIG_ENDIAN"
+       tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
+       tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
+       tmake_file="nds32/t-mlibs"
+       ;;
+nios2-*-*)
+       tm_file="elfos.h ${tm_file}"
+        tmake_file="${tmake_file} nios2/t-nios2"
+        case ${target} in
+        nios2-*-linux*)
+                tm_file="${tm_file} gnu-user.h linux.h glibc-stdint.h nios2/linux.h "
+                ;;
+       nios2-*-elf*)
+               tm_file="${tm_file} newlib-stdint.h nios2/elf.h"
+               extra_options="${extra_options} nios2/elf.opt"
+               ;;
+        esac
+       ;;
 pdp11-*-*)
        tm_file="${tm_file} newlib-stdint.h"
        use_gcc_stdint=wrap
@@ -2061,22 +2239,27 @@ powerpc-*-eabi*)
 powerpc-*-rtems*)
        tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/rtems.h rtems.h"
        extra_options="${extra_options} rs6000/sysv4.opt"
-       tmake_file="rs6000/t-fprules rs6000/t-rtems t-rtems rs6000/t-ppccomm"
+       tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-rtems rs6000/t-ppccomm"
        ;;
-powerpc-*-linux* | powerpc64-*-linux*)
+powerpc*-*-linux*)
        tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h"
        extra_options="${extra_options} rs6000/sysv4.opt"
        tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
+       extra_objs="$extra_objs rs6000-linux.o"
+       case ${target} in
+           powerpc*le-*-*)
+               tm_file="${tm_file} rs6000/sysv4le.h" ;;
+       esac
        maybe_biarch=yes
        case ${target} in
-           powerpc64-*-linux*spe* | powerpc64-*-linux*paired*)
+           powerpc64*-*-linux*spe* | powerpc64*-*-linux*paired*)
                echo "*** Configuration ${target} not supported" 1>&2
                exit 1
                ;;
-           powerpc-*-linux*spe* | powerpc-*-linux*paired*)
+           powerpc*-*-linux*spe* | powerpc*-*-linux*paired*)
                maybe_biarch=
                ;;
-           powerpc64-*-linux*)
+           powerpc64*-*-linux*)
                test x$with_cpu != x || cpu_is_64bit=yes
                maybe_biarch=always
                ;;
@@ -2088,6 +2271,19 @@ powerpc-*-linux* | powerpc64-*-linux*)
                fi
                tm_file="rs6000/biarch64.h ${tm_file} rs6000/linux64.h glibc-stdint.h"
                tmake_file="$tmake_file rs6000/t-linux64"
+               case ${target} in
+                   powerpc*le-*-*)
+                       tmake_file="$tmake_file rs6000/t-linux64le"
+                       case ${enable_targets} in
+                           all | *powerpc64-* | *powerpc-*)
+                               tmake_file="$tmake_file rs6000/t-linux64lebe" ;;
+                       esac ;;
+                   *)
+                       case ${enable_targets} in
+                           all | *powerpc64le-* | *powerpcle-*)
+                               tmake_file="$tmake_file rs6000/t-linux64bele" ;;
+                       esac ;;
+               esac
                extra_options="${extra_options} rs6000/linux64.opt"
                ;;
            *)
@@ -2117,7 +2313,7 @@ powerpc-wrs-vxworks|powerpc-wrs-vxworksae)
        extra_headers=ppc-asm.h
        case ${target} in
          *-vxworksae*)
-           tm_file="${tm_file} vx-common.h vxworksae.h rs6000/vxworks.h rs6000/e500.h"
+           tm_file="${tm_file} vx-common.h vxworksae.h rs6000/vxworks.h rs6000/e500.h rs6000/vxworksae.h"
            tmake_file="${tmake_file} rs6000/t-vxworksae"
            ;;
          *-vxworks*)
@@ -2217,7 +2413,7 @@ s390-*-linux*)
 s390x-*-linux*)
        default_gnu_indirect_function=yes
        tm_file="s390/s390x.h s390/s390.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h s390/linux.h"
-       tm_p_file=s390/s390-protos.h
+       tm_p_file="linux-protos.h s390/s390-protos.h"
        md_file=s390/s390.md
        extra_modes=s390/s390-modes.def
        out_file=s390/s390.c
@@ -2414,7 +2610,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
        tmake_file="$tmake_file t-sysroot-suffix"
        ;;
 sh-*-rtems*)
-       tmake_file="sh/t-sh t-rtems sh/t-rtems"
+       tmake_file="${tmake_file} sh/t-sh sh/t-rtems"
        tm_file="${tm_file} dbxelf.h elfos.h sh/elf.h sh/embed-elf.h sh/rtemself.h rtems.h newlib-stdint.h"
        ;;
 sh-wrs-vxworks)
@@ -2437,7 +2633,7 @@ sparc-*-elf*)
        ;;
 sparc-*-rtems*)
        tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp-elf.h sparc/rtemself.h rtems.h newlib-stdint.h"
-       tmake_file="sparc/t-sparc sparc/t-elf sparc/t-rtems t-rtems"
+       tmake_file="${tmake_file} sparc/t-sparc sparc/t-elf sparc/t-rtems"
        ;;
 sparc-*-linux*)
        tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/tso.h"
@@ -2468,7 +2664,7 @@ sparc-*-netbsdelf*)
        tmake_file="${tmake_file} sparc/t-sparc"
        ;;
 sparc*-*-solaris2*)
-       tm_file="sparc/biarch64.h ${tm_file} ${sol2_tm_file} sol2-bi.h sparc/tso.h"
+       tm_file="sparc/biarch64.h ${tm_file} ${sol2_tm_file} sparc/tso.h"
        case ${target} in
            sparc64-*-* | sparcv9-*-*)
                tm_file="sparc/default-64.h ${tm_file}"
@@ -2477,7 +2673,7 @@ sparc*-*-solaris2*)
                test x$with_cpu != x || with_cpu=v9
                ;;
        esac
-       tmake_file="${tmake_file} sparc/t-sparc sparc/t-sol2-64"
+       tmake_file="${tmake_file} sparc/t-sparc sparc/t-sol2"
        ;;
 sparc-wrs-vxworks)
        tm_file="${tm_file} elfos.h sparc/sysv4.h vx-common.h vxworks.h sparc/vxworks.h"
@@ -2491,7 +2687,7 @@ sparc64-*-elf*)
 sparc64-*-rtems*)
        tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h sparc/sysv4.h sparc/sp64-elf.h sparc/rtemself.h rtems.h"
        extra_options="${extra_options}"
-       tmake_file="${tmake_file} sparc/t-sparc sparc/t-rtems-64 t-rtems"
+       tmake_file="${tmake_file} sparc/t-sparc sparc/t-rtems-64"
        ;;
 sparc64-*-linux*)
        tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/default-64.h sparc/linux64.h sparc/tso.h"
@@ -2547,18 +2743,23 @@ tic6x-*-uclinux)
        tmake_file="${tmake_file} c6x/t-c6x c6x/t-c6x-elf c6x/t-c6x-uclinux"
        use_collect2=no
        ;;
-tilegx-*-linux*)
+tilegx*-*-linux*)
        tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h tilegx/linux.h ${tm_file}"
         tmake_file="${tmake_file} tilegx/t-tilegx"
-       extra_objs="mul-tables.o"
+       extra_objs="${extra_objs} mul-tables.o"
        c_target_objs="${c_target_objs} tilegx-c.o"
        cxx_target_objs="${cxx_target_objs} tilegx-c.o"
        extra_headers="feedback.h"
+       case $target in
+       tilegxbe-*)
+               tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
+               ;;
+       esac
        ;;
-tilepro-*-linux*)
+tilepro*-*-linux*)
        tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h tilepro/linux.h ${tm_file}"
         tmake_file="${tmake_file} tilepro/t-tilepro"
-       extra_objs="mul-tables.o"
+       extra_objs="${extra_objs} mul-tables.o"
        c_target_objs="${c_target_objs} tilepro-c.o"
        cxx_target_objs="${cxx_target_objs} tilepro-c.o"
        extra_headers="feedback.h"
@@ -2568,7 +2769,7 @@ v850-*-rtems*)
        tm_file="dbxelf.h elfos.h v850/v850.h"
        tm_file="${tm_file} rtems.h v850/rtems.h newlib-stdint.h"
        tmake_file="${tmake_file} v850/t-v850"
-       tmake_file="${tmake_file} t-rtems v850/t-rtems"
+       tmake_file="${tmake_file} v850/t-rtems"
        use_collect2=no
        c_target_objs="v850-c.o"
        cxx_target_objs="v850-c.o"
@@ -2641,7 +2842,6 @@ am33_2.0-*-linux*)
        ;;
 m32c-*-rtems*)
        tm_file="dbxelf.h elfos.h ${tm_file} m32c/rtems.h rtems.h newlib-stdint.h"
-       tmake_file="${tmake_file} t-rtems"
        c_target_objs="m32c-pragma.o"
        cxx_target_objs="m32c-pragma.o"
        ;;
@@ -2746,6 +2946,10 @@ case ${target} in
     ;;
   i686-*-* | i786-*-*)
     case ${target_noncanonical} in
+      bdver4-*)
+        arch=bdver4
+        cpu=bdver4
+        ;;
       bdver3-*)
         arch=bdver3
         cpu=bdver3
@@ -2820,6 +3024,10 @@ case ${target} in
        arch=atom
        cpu=atom
        ;;
+      slm-*)
+       arch=slm
+       cpu=slm
+       ;;
       core2-*)
        arch=core2
        cpu=core2
@@ -2851,6 +3059,10 @@ case ${target} in
     ;;
   x86_64-*-*)
     case ${target_noncanonical} in
+      bdver4-*)
+        arch=bdver4
+        cpu=bdver4
+        ;;
       bdver3-*)
         arch=bdver3
         cpu=bdver3
@@ -2891,6 +3103,10 @@ case ${target} in
        arch=atom
        cpu=atom
        ;;
+      slm-*)
+       arch=slm
+       cpu=slm
+       ;;
       core2-*)
        arch=core2
        cpu=core2
@@ -2945,9 +3161,6 @@ if test x$with_cpu = x ; then
          ;;
       esac
       ;;
-    mips*-*-vxworks)
-      with_arch=mips2
-      ;;
     powerpc*-*-*spe*)
       if test x$enable_e500_double = xyes; then
          with_cpu=8548
@@ -2955,11 +3168,18 @@ if test x$with_cpu = x ; then
          with_cpu=8540
       fi       
       ;;
-    sparc-leon*-*)
-      with_cpu=v8;
-      ;;
     sparc*-*-*)
-      with_cpu="`echo ${target} | sed 's/-.*$//'`"
+      case ${target} in
+       *-leon-*)
+         with_cpu=leon
+         ;;
+       *-leon[3-9]*)
+         with_cpu=leon3
+         ;;
+       *)
+         with_cpu="`echo ${target} | sed 's/-.*$//'`"
+         ;;
+      esac
       ;;
   esac
 
@@ -3008,6 +3228,12 @@ if test x$with_arch = x ; then
     x86_64-*-*)
       with_arch=$arch
       ;;
+    mips64r5900-*-* | mips64r5900el-*-* | mipsr5900-*-* | mipsr5900el-*-*)
+      with_arch=r5900
+      ;;
+    mips*-*-vxworks)
+      with_arch=mips2
+      ;;
   esac
 
   # Avoid overriding --with-arch-32 and --with-arch-64 values.
@@ -3042,6 +3268,27 @@ if test x$with_arch = x ; then
   esac
 fi
 
+# Infer a default setting for --with-float.
+if test x$with_float = x; then
+  case ${target} in
+    mips64r5900-*-* | mips64r5900el-*-* | mipsr5900-*-* | mipsr5900el-*-*)
+      # The R5900 doesn't support 64-bit float.  32-bit float doesn't
+      # comply with IEEE 754.
+      with_float=soft
+      ;;
+  esac
+fi
+
+# Infer a default setting for --with-fpu.
+if test x$with_fpu = x; then
+  case ${target} in
+    mips64r5900-*-* | mips64r5900el-*-* | mipsr5900-*-* | mipsr5900el-*-*)
+      # The R5900 FPU only supports single precision.
+      with_fpu=single
+      ;;
+  esac
+fi
+
 # Support --with-fpmath.
 if test x$with_fpmath != x; then
   case ${target} in
@@ -3076,6 +3323,20 @@ if test x$with_schedule = x; then
        esac
 fi
 
+# Infer a default setting for --with-llsc.
+if test x$with_llsc = x; then
+  case ${target} in
+    mips64r5900-*-* | mips64r5900el-*-* | mipsr5900-*-* | mipsr5900el-*-*)
+      # The R5900 doesn't support LL(D) and SC(D).
+      with_llsc=no
+      ;;
+    mips*-*-linux*)
+      # The kernel emulates LL and SC where necessary.
+      with_llsc=yes
+      ;;
+  esac
+fi
+
 # Validate and mark as valid any --with options supported
 # by this target.  In order to use a particular --with option
 # you must list it in supported_defaults; validating the value
@@ -3085,7 +3346,7 @@ fi
 supported_defaults=
 case "${target}" in
        aarch64*-*-*)
-               supported_defaults="cpu arch"
+               supported_defaults="abi cpu arch"
                for which in cpu arch; do
 
                        eval "val=\$with_$which"
@@ -3114,6 +3375,11 @@ case "${target}" in
                                  ${srcdir}/config/aarch64/$def | \
                                  sed -e 's/^[^,]*,[    ]*//' | \
                                  sed -e 's/,.*$//'`
+                               # Extract the architecture flags from aarch64-arches.def
+                               ext_mask=`grep "^$pattern(\"$base_val\"," \
+                                  ${srcdir}/config/aarch64/$def | \
+                                  sed -e 's/)$//' | \
+                                  sed -e 's/^.*,//'`
                          else
                                base_id=`grep "^$pattern(\"$base_val\"," \
                                  ${srcdir}/config/aarch64/$def | \
@@ -3188,6 +3454,17 @@ case "${target}" in
                done
                ;;
 
+       arc*-*-*) # was:        arc*-*-linux-uclibc)
+               supported_defaults="cpu"
+               case $with_cpu in
+                 arc600|arc601|arc700)
+                       ;;
+                 *) echo "Unknown cpu type"
+                       exit 1
+                       ;;
+               esac
+               ;;
+
        arm*-*-*)
                supported_defaults="arch cpu float tune fpu abi mode tls"
                for which in cpu tune; do
@@ -3211,19 +3488,17 @@ case "${target}" in
                        fi
                done
 
-               case "$with_arch" in
-               "" \
-               | armv[23456] | armv2a | armv3m | armv4t | armv5t \
-               | armv5te | armv6j |armv6k | armv6z | armv6zk | armv6-m \
-               | armv7 | armv7-a | armv7-r | armv7-m | armv8-a \
-               | iwmmxt | ep9312)
-                       # OK
-                       ;;
-               *)
-                       echo "Unknown arch used in --with-arch=$with_arch" 1>&2
-                       exit 1
-                       ;;
-               esac
+               # See if it matches any of the entries in arm-arches.def
+               if [ x"$with_arch" = x ] \
+                   || grep "^ARM_ARCH(\"$with_arch\"," \
+                           ${srcdir}/config/arm/arm-arches.def \
+                           > /dev/null; then
+                 # OK
+                 true
+               else
+                 echo "Unknown arch used in --with-arch=$with_arch" 1>&2
+                 exit 1
+               fi
 
                case "$with_float" in
                "" \
@@ -3287,6 +3562,43 @@ case "${target}" in
                if test "x$with_arch" != x && test "x$with_cpu" != x; then
                        echo "Warning: --with-arch overrides --with-cpu=$with_cpu" 1>&2
                fi
+
+               # Add extra multilibs
+               if test "x$with_multilib_list" != x; then
+                       arm_multilibs=`echo $with_multilib_list | sed -e 's/,/ /g'`
+                       for arm_multilib in ${arm_multilibs}; do
+                               case ${arm_multilib} in
+                               aprofile)
+                               # Note that arm/t-aprofile is a
+                               # stand-alone make file fragment to be
+                               # used only with itself.  We do not
+                               # specifically use the
+                               # TM_MULTILIB_OPTION framework because
+                               # this shorthand is more
+                               # pragmatic. Additionally it is only
+                               # designed to work without any
+                               # with-cpu, with-arch with-mode
+                               # with-fpu or with-float options.
+                                       if test "x$with_arch" != x \
+                                           || test "x$with_cpu" != x \
+                                           || test "x$with_float" != x \
+                                           || test "x$with_fpu" != x \
+                                           || test "x$with_mode" != x ; then
+                                           echo "Error: You cannot use any of --with-arch/cpu/fpu/float/mode with --with-multilib-list=aprofile" 1>&2
+                                           exit 1
+                                       fi
+                                       tmake_file="${tmake_file} arm/t-aprofile"
+                                       break
+                                       ;;
+                               default)
+                                       ;;
+                               *)
+                                       echo "Error: --with-multilib-list=${with_multilib_list} not supported." 1>&2
+                                       exit 1
+                                       ;;
+                               esac
+                       done
+               fi
                ;;
 
        fr*-*-*linux*)
@@ -3369,13 +3681,8 @@ case "${target}" in
                supported_defaults="abi arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64"
                for which in arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64; do
                        eval "val=\$with_$which"
-                       case ${val} in
-                       i386 | i486 \
-                       | i586 | pentium | pentium-mmx | winchip-c6 | winchip2 \
-                       | c3 | c3-2 | i686 | pentiumpro | pentium2 | pentium3 \
-                       | pentium4 | k6 | k6-2 | k6-3 | athlon | athlon-tbird \
-                       | athlon-4 | athlon-xp | athlon-mp | geode \
-                       | prescott | pentium-m | pentium4m | pentium3m)
+                       case " $x86_archs " in
+                       *" ${val} "*)
                                case "${target}" in
                                  x86_64-*-*)
                                      case "x$which" in
@@ -3390,23 +3697,41 @@ case "${target}" in
                                esac
                                # OK
                                ;;
-                       "" | x86-64 | generic | native \
-                       | k8 | k8-sse3 | athlon64 | athlon64-sse3 | opteron \
-                       | opteron-sse3 | athlon-fx | bdver3 | bdver2 | bdver1 | btver2 \
-                       | btver1 | amdfam10 | barcelona | nocona | core2 | corei7 \
-                       | corei7-avx | core-avx-i | core-avx2 | atom)
-                               # OK
-                               ;;
                        *)
-                               echo "Unknown CPU given in --with-$which=$val." 1>&2
-                               exit 1
+                               if test x${val} != x; then
+                                       case " $x86_64_archs " in
+                                       *" ${val} "*)
+                                               # OK
+                                               ;;
+                                       *)
+                                               # Allow $x86_cpus --with-cpu=/--with-tune=
+                                               case "x$which" in
+                                               xcpu*|xtune*)
+                                                       case " $x86_cpus " in
+                                                       *" ${val} "*)
+                                                               # OK
+                                                               ;;
+                                                       *)
+                                                               echo "Unknown CPU given in --with-$which=$val." 1>&2
+                                                               exit 1
+                                                               ;;
+                                                       esac
+                                                       ;;
+                                               *)
+                                                       echo "Unknown CPU given in --with-$which=$val." 1>&2
+                                                       exit 1
+                                                       ;;
+                                               esac
+                                       ;;
+                                       esac
+                               fi
                                ;;
                        esac
                done
                ;;
 
        mips*-*-*)
-               supported_defaults="abi arch arch_32 arch_64 float tune tune_32 tune_64 divide llsc mips-plt synci"
+               supported_defaults="abi arch arch_32 arch_64 float fpu nan tune tune_32 tune_64 divide llsc mips-plt synci"
 
                case ${with_float} in
                "" | soft | hard)
@@ -3418,6 +3743,26 @@ case "${target}" in
                        ;;
                esac
 
+               case ${with_fpu} in
+               "" | single | double)
+                       # OK
+                       ;;
+               *)
+                       echo "Unknown fpu type used in --with-fpu=$with_fpu" 1>&2
+                       exit 1
+                       ;;
+               esac
+
+               case ${with_nan} in
+               "" | 2008 | legacy)
+                       # OK
+                       ;;
+               *)
+                       echo "Unknown NaN encoding used in --with-nan=$with_nan" 1>&2
+                       exit 1
+                       ;;
+               esac
+
                case ${with_abi} in
                "" | 32 | o64 | n32 | 64 | eabi)
                        # OK
@@ -3485,8 +3830,41 @@ case "${target}" in
                esac
                ;;
 
+       nds32*-*-*)
+               supported_defaults="arch nds32_lib"
+
+               # process --with-arch
+               case "${with_arch}" in
+               "" | v2 | v3 | v3m)
+                       # OK
+                       ;;
+               *)
+                       echo "Cannot accept --with-arch=$with_arch, available values are: v2 v3 v3m" 1>&2
+                       exit 1
+                       ;;
+               esac
+
+               # process --with-nds32-lib
+               case "${with_nds32_lib}" in
+               "")
+                       # the default library is newlib
+                       with_nds32_lib=newlib
+                       ;;
+               newlib)
+                       # OK
+                       ;;
+               mculib)
+                       # OK
+                       ;;
+               *)
+                       echo "Cannot accept --with-nds32-lib=$with_nds32_lib, available values are: newlib mculib" 1>&2
+                       exit 1
+                       ;;
+               esac
+               ;;
+
        powerpc*-*-* | rs6000-*-*)
-               supported_defaults="cpu cpu_32 cpu_64 float tune tune_32 tune_64"
+               supported_defaults="abi cpu cpu_32 cpu_64 float tune tune_32 tune_64"
 
                for which in cpu cpu_32 cpu_64 tune tune_32 tune_64; do
                        eval "val=\$with_$which"
@@ -3507,7 +3885,7 @@ case "${target}" in
                                tm_defines="${tm_defines} CONFIG_PPC405CR"
                                eval "with_$which=405"
                                ;;
-                       "" | common \
+                       "" | common | native \
                        | power | power[2345678] | power6x | powerpc | powerpc64 \
                        | rios | rios1 | rios2 | rsc | rsc1 | rs64a \
                        | 401 | 403 | 405 | 405fp | 440 | 440fp | 464 | 464fp \
@@ -3523,6 +3901,16 @@ case "${target}" in
                                ;;
                        esac
                done
+
+               case "$with_abi" in
+               "" | elfv1 | elfv2 )
+                       #OK
+                       ;;
+               *)
+                       echo "Unknown ABI used in --with-abi=$with_abi"
+                       exit 1
+                       ;;
+               esac
                ;;
 
        s390*-*-*)
@@ -3579,7 +3967,7 @@ case "${target}" in
                        case ${val} in
                        "" | sparc | sparcv9 | sparc64 \
                        | v7 | cypress \
-                       | v8 | supersparc | hypersparc | leon \
+                       | v8 | supersparc | hypersparc | leon | leon3 \
                        | sparclite | f930 | f934 | sparclite86x \
                        | sparclet | tsc701 \
                        | v9 | ultrasparc | ultrasparc3 | niagara | niagara2 \
@@ -3653,10 +4041,8 @@ esac
 target_cpu_default2=
 case ${target} in
        aarch64*-*-*)
-               if test x$target_cpu_cname = x
+               if test x"$target_cpu_cname" != x
                then
-                       target_cpu_default2=TARGET_CPU_generic
-               else
                        target_cpu_default2=$target_cpu_cname
                fi
                ;;
@@ -3671,10 +4057,9 @@ case ${target} in
                ;;
 
        hppa*-*-*)
-               target_cpu_default2="MASK_BIG_SWITCH"
                if test x$gas = xyes
                then
-                       target_cpu_default2="${target_cpu_default2}|MASK_GAS|MASK_JUMP_IN_DELAY"
+                       target_cpu_default2="MASK_GAS|MASK_JUMP_IN_DELAY"
                fi
                ;;
 
@@ -3699,7 +4084,11 @@ case ${target} in
                ;;
        i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
                ;;
-       i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw*)
+       i[34567]86-*-cygwin* | x86_64-*-cygwin*)
+               ;;
+       i[34567]86-*-mingw* | x86_64-*-mingw*)
+               ;;
+       i[34567]86-*-dragonfly* | x86_64-*-dragonfly*)
                ;;
        i[34567]86-*-freebsd* | x86_64-*-freebsd*)
                ;;
@@ -3737,15 +4126,6 @@ case ${target} in
                cxx_target_objs="${cxx_target_objs} sh-c.o"
                ;;
 
-       sparc-leon*-*)
-               if test x$with_tune = x ; then
-                 with_tune=leon;
-               fi
-
-               # The SPARC port checks this value at compile-time.
-               target_cpu_default2="TARGET_CPU_$with_cpu"
-               ;;
-
        sparc*-*-*)
                # Some standard aliases.
                case x$with_cpu in
@@ -3757,6 +4137,17 @@ case ${target} in
                        ;;
                esac
 
+               if test x$with_tune = x ; then
+                     case ${target} in
+                     *-leon-*)
+                         with_tune=leon
+                         ;;
+                     *-leon[3-9]*)
+                         with_tune=leon3
+                         ;;
+                     esac
+               fi
+
                # The SPARC port checks this value at compile-time.
                target_cpu_default2="TARGET_CPU_$with_cpu"
                ;;
@@ -3776,7 +4167,7 @@ case ${target} in
 esac
 
 t=
-all_defaults="abi cpu cpu_32 cpu_64 arch arch_32 arch_64 tune tune_32 tune_64 schedule float mode fpu divide llsc mips-plt synci tls"
+all_defaults="abi cpu cpu_32 cpu_64 arch arch_32 arch_64 tune tune_32 tune_64 schedule float mode fpu nan divide llsc mips-plt synci tls"
 for option in $all_defaults
 do
        eval "val=\$with_"`echo $option | sed s/-/_/g`