+ $(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 --with-abi=64) \
+ $(if $(CONFIG_GCC_VERSION_LLVM),--enable-llvm=$(BUILD_DIR_BASE)/host/llvm) \
+ $(if $(CONFIG_GCC_VERSION_4_3_3_CS)$(CONFIG_GCC_VERSION_4_4_1_CS)$(CONFIG_GCC_VERSION_4_4_3_CS),--enable-poison-system-directories)
+
+ifneq ($(CONFIG_GCC_VERSION_4_3)$(CONFIG_GCC_VERSION_4_4)$(CONFIG_GCC_VERSION_4_5),)
+ GCC_BUILD_TARGET_LIBGCC:=y
+ GCC_CONFIGURE+= \
+ --with-gmp=$(TOPDIR)/staging_dir/host \
+ --with-mpfr=$(TOPDIR)/staging_dir/host \
+ --disable-decimal-float
+endif
+
+ifneq ($(CONFIG_GCC_VERSION_4_5),)
+ GCC_BUILD_TARGET_LIBGCC:=y
+ GCC_CONFIGURE+= \
+ --with-gmp=$(TOPDIR)/staging_dir/host \
+ --with-mpc=$(TOPDIR)/staging_dir/host \
+ --with-mpfr=$(TOPDIR)/staging_dir/host \
+ --disable-decimal-float
+endif
+
+ifneq ($(CONFIG_SSP_SUPPORT),)
+ GCC_CONFIGURE+= \
+ --enable-libssp
+else
+ GCC_CONFIGURE+= \
+ --disable-libssp
+endif
+
+ifneq ($(CONFIG_EXTRA_TARGET_ARCH),)
+ GCC_CONFIGURE+= \
+ --enable-biarch \
+ --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX)
+endif
+
+ifeq ($(LIBC),uClibc)
+ GCC_CONFIGURE+= \
+ --disable-__cxa_atexit
+else
+ GCC_CONFIGURE+= \
+ --enable-__cxa_atexit
+endif
+
+GCC_CONFIGURE_STAGE0:= \
+ $(GCC_CONFIGURE) \
+ --with-newlib \
+ --without-headers \
+ --enable-languages=c \
+ --disable-libssp \
+ --disable-shared \
+ --disable-threads \
+
+GCC_CONFIGURE_STAGE1:= \
+ $(GCC_CONFIGURE) \
+ --with-newlib \
+ --with-sysroot=$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev \
+ --enable-languages=c \
+ --disable-shared \
+ --disable-threads \
+
+GCC_CONFIGURE_STAGE2:= \
+ $(GCC_CONFIGURE) \
+ --enable-languages=$(TARGET_LANGUAGES) \
+ --enable-shared \
+ --enable-threads \
+ --with-slibdir=$(TOOLCHAIN_DIR)/lib
+
+ifneq ($(CONFIG_GCC_VERSION_4_5),)
+ GCC_CONFIGURE_STAGE2+= \
+ --enable-lto \
+ --with-libelf=$(TOPDIR)/staging_dir/host
+endif
+
+ifneq ($(CONFIG_TLS_SUPPORT),)
+ GCC_CONFIGURE_STAGE2+= \
+ --enable-tls
+else
+ GCC_CONFIGURE_STAGE2+= \
+ --disable-tls
+endif
+
+ifdef CONFIG_powerpc
+ TARGET_CFLAGS := $(patsubst -Os,-O2,$(TARGET_CFLAGS))
+endif
+
+GCC_MAKE:= \
+ export SHELL="$(BASH)"; \
+ $(MAKE) \
+ CFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
+ CXXFLAGS_FOR_TARGET="$(TARGET_CFLAGS)"
+
+define Host/SetToolchainInfo
+ $(SED) 's,TARGET_CROSS=.*,TARGET_CROSS=$(REAL_GNU_TARGET_NAME)-,' $(TOOLCHAIN_DIR)/info.mk
+ $(SED) 's,GCC_VERSION=.*,GCC_VERSION=$(GCC_VERSION),' $(TOOLCHAIN_DIR)/info.mk
+endef
+
+
+define Stage0/Configure
+ mkdir -p $(HOST_BUILD_DIR0)
+ (cd $(HOST_BUILD_DIR0); rm -f config.cache; \
+ $(GCC_CONFIGURE_STAGE0) \
+ );
+endef
+
+define Stage0/Compile
+ $(GCC_MAKE) -C $(HOST_BUILD_DIR0) all-gcc
+endef
+
+define Stage0/Install
+ $(GCC_MAKE) -C $(HOST_BUILD_DIR0) install-gcc
+endef
+
+
+define Stage1/Configure
+ mkdir -p $(HOST_BUILD_DIR1)
+ (cd $(HOST_BUILD_DIR1); rm -f config.cache; \
+ $(GCC_CONFIGURE_STAGE1) \