This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Target tools detection cleanup, fixing cross Ada builds [was Re: RTEMS GCC Status Report]



Here is the updated version of the patch.

Which also included some (clearly identifiable) hunks that did not belong in the patch. They are not triggered without toplevel bootstrap, but here is the patch without them.


I have been using this patch daily for weeks (even though I don't build Ada, so the original bug does not show up for me and most other people using unified trees). I would be okay also with approval for 4.2 and a later backport, since the branch is going to happen RSN. Though, let me recall that Joel Sherrill has also tested this patch quite heavily.

Paolo
2005-11-05  Paolo Bonzini  <bonzini@gnu.org>

        * configure.in (CONFIGURED_BISON, CONFIGURED_YACC, CONFIGURED_M4,
        CONFIGURED_FLEX, CONFIGURED_LEX, CONFIGURED_MAKEINFO): Remove
        "CONFIGURED_" from the AC_CHECK_PROGS invocation.  Move below.
        Find in-tree tools if available.
        (EXPECT, RUNTEST, LIPO, STRIP): Find them and substitute them.
        (CONFIGURED_*_FOR_TARGET): Don't set nor substitute.
        (*_FOR_TARGET): Set them with GCC_TARGET_TOOL.
        (COMPILER_*_FOR_TARGET): New.
        * Makefile.tpl (HOST_EXPORTS): Add *_FOR_TARGET symbols that gcc needs.
        (EXTRA_HOST_FLAGS): Pass LIPO and STRIP.
        (BASE_TARGET_EXPORTS, EXTRA_TARGET_FLAGS): Use COMPILER_*_FOR_TARGET
	symbols.
        (CONFIGURED_*, USUAL_*): Remove.
        (BISON, YACC, FLEX, LEX, M4, MAKEINFO, EXPECT, RUNTEST, LIPO,
        STRIP): Use autoconf substitutions.
        (COMPILER_AS_FOR_TARGET, COMPILER_LD_FOR_TARGET,
        COMPILER_NM_FOR_TARGET): New.

        (all): Make all-host and all-target in parallel.  When bootstrapping,
	invoke stage3-bubble.
        (stage[+id+]-bubble): Likewise, and invoke the comparison at the end.
        ([+bootstrap-target+]): Inline most of the `all' target.

config:
2005-11-05  Paolo Bonzini  <bonzini@gnu.org>

        * acx.m4 (GCC_TARGET_TOOL): New.

Index: Makefile.tpl
===================================================================
--- Makefile.tpl	(revision 107191)
+++ Makefile.tpl	(working copy)
@@ -136,7 +136,8 @@ HOST_CONFIGARGS = @host_configargs@
 # with srcdir=..
 HOST_SUBDIR = @host_subdir@
 # This is the list of variables to export in the environment when
-# configuring subdirectories for the host system.
+# configuring subdirectories for the host system.  We need to pass
+# some to the GCC configure because of its hybrid host/target nature.
 HOST_EXPORTS = \
 	$(BASE_EXPORTS) \
 	CC="$(CC)"; export CC; \
@@ -155,6 +156,13 @@ HOST_EXPORTS = \
 	WINDRES="$(WINDRES)"; export WINDRES; \
 	OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
 	OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
+	AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
+	AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
+	GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
+	LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
+	NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
+	OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
+	RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
 	TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
 	GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
 	GMPINC="$(HOST_GMPINC)"; export GMPINC; \
@@ -186,7 +194,7 @@ TARGET_CONFIGARGS = @target_configargs@ 
 BASE_TARGET_EXPORTS = \
 	$(BASE_EXPORTS) \
 	AR="$(AR_FOR_TARGET)"; export AR; \
-	AS="$(AS_FOR_TARGET)"; export AS; \
+	AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
 	CC="$(CC_FOR_TARGET)"; export CC; \
 	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
@@ -195,10 +203,10 @@ BASE_TARGET_EXPORTS = \
 	GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
 	GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \
 	DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
-	LD="$(LD_FOR_TARGET)"; export LD; \
+	LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
 	LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
 	LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
-	NM="$(NM_FOR_TARGET)"; export NM; \
+	NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
 	OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
 	RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
 	STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
@@ -248,47 +256,14 @@ BUILD_PREFIX_1 = @BUILD_PREFIX_1@
 # here so that they can be overridden by Makefile fragments.
 BOOT_CFLAGS= -g -O2
 
-CONFIGURED_BISON = @CONFIGURED_BISON@
-BISON = `if [ -f $$r/$(BUILD_SUBDIR)/bison/tests/bison ] ; then \
-	    echo $$r/$(BUILD_SUBDIR)/bison/tests/bison ; \
-	 else \
-	    echo ${CONFIGURED_BISON} ; \
-	 fi`
-
-CONFIGURED_YACC = @CONFIGURED_YACC@
-YACC = `if [ -f $$r/$(BUILD_SUBDIR)/bison/tests/bison ] ; then \
-	    echo $$r/$(BUILD_SUBDIR)/bison/tests/bison -y ; \
-	elif [ -f $$r/$(BUILD_SUBDIR)/byacc/byacc ] ; then \
-	    echo $$r/$(BUILD_SUBDIR)/byacc/byacc ; \
-	else \
-	    echo ${CONFIGURED_YACC} ; \
-	fi`
-
-CONFIGURED_FLEX = @CONFIGURED_FLEX@
-FLEX = `if [ -f $$r/$(BUILD_SUBDIR)/flex/flex ] ; \
-	then echo $$r/$(BUILD_SUBDIR)/flex/flex ; \
-	else echo ${CONFIGURED_FLEX} ; fi`
-
-CONFIGURED_LEX = @CONFIGURED_LEX@
-LEX = `if [ -f $$r/$(BUILD_SUBDIR)/flex/flex ] ; \
-	then echo $$r/$(BUILD_SUBDIR)/flex/flex ; \
-	else echo ${CONFIGURED_LEX} ; fi`
-
-CONFIGURED_M4 = @CONFIGURED_M4@
-M4 = `if [ -f $$r/$(BUILD_SUBDIR)/m4/m4 ] ; \
-	then echo $$r/$(BUILD_SUBDIR)/m4/m4 ; \
-	else echo ${CONFIGURED_M4} ; fi`
-
-# For an installed makeinfo, we require it to be from texinfo 4.2 or
-# higher, else we use the "missing" dummy.  We also pass the subdirectory
-# makeinfo even if only the Makefile is there, because Texinfo builds its
-# manual when made, and it requires its own version.
-CONFIGURED_MAKEINFO = @CONFIGURED_MAKEINFO@
-MAKEINFO = `if [ -f $$r/$(BUILD_SUBDIR)/texinfo/makeinfo/Makefile ] ; \
-	then echo $$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo ; \
-	else if (${CONFIGURED_MAKEINFO} --version \
-	  | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])') >/dev/null 2>&1; \
-        then echo ${CONFIGURED_MAKEINFO}; else echo $$s/missing makeinfo; fi; fi`
+BISON = @BISON@
+YACC = @YACC@
+FLEX = @FLEX@
+LEX = @LEX@
+M4 = @M4@
+MAKEINFO = @MAKEINFO@
+EXPECT = @EXPECT@
+RUNTEST = @RUNTEST@
 
 # This just becomes part of the MAKEINFO definition passed down to
 # sub-makes.  It lets flags be given on the command line while still
@@ -296,43 +271,28 @@ MAKEINFO = `if [ -f $$r/$(BUILD_SUBDIR)/
 # (Default to avoid splitting info files by setting the threshold high.)
 MAKEINFOFLAGS = --split-size=5000000
 
-# FIXME: expect may become a build tool?
-EXPECT = `if [ -f $$r/$(HOST_SUBDIR)/expect/expect ] ; \
-	then echo $$r/$(HOST_SUBDIR)/expect/expect ; \
-	else echo expect ; fi`
-
-RUNTEST = `if [ -f $$s/dejagnu/runtest ] ; \
-	then echo $$s/dejagnu/runtest ; \
-	else echo runtest ; fi`
-
 # ---------------------------------------------
 # Programs producing files for the HOST machine
 # ---------------------------------------------
 
 AS = @AS@
-
 AR = @AR@
 AR_FLAGS = rc
-
 CC = @CC@
-CFLAGS = @CFLAGS@
-LIBCFLAGS = $(CFLAGS)
-
 CXX = @CXX@
-CXXFLAGS = @CXXFLAGS@
-LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
-
 DLLTOOL = @DLLTOOL@
-
-NM = @NM@
-
 LD = @LD@
-LDFLAGS = 
-
+LIPO = @LIPO@
+NM = @NM@
 RANLIB = @RANLIB@
-
+STRIP = @STRIP@
 WINDRES = @WINDRES@
 
+CFLAGS = @CFLAGS@
+LDFLAGS = 
+LIBCFLAGS = $(CFLAGS)
+CXXFLAGS = @CXXFLAGS@
+LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
 PICFLAG = 
 
 # -----------------------------------------------
@@ -342,242 +302,42 @@ PICFLAG = 
 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
 
 AR_FOR_TARGET=@AR_FOR_TARGET@
-CONFIGURED_AR_FOR_TARGET=@CONFIGURED_AR_FOR_TARGET@
-USUAL_AR_FOR_TARGET = ` \
-  if [ -f $$r/$(HOST_SUBDIR)/binutils/ar ] ; then \
-    echo $$r/$(HOST_SUBDIR)/binutils/ar ; \
-  else \
-    if [ '$(host)' = '$(target)' ] ; then \
-      echo $(AR); \
-    else \
-      echo $(CONFIGURED_AR_FOR_TARGET) ; \
-    fi; \
-  fi`
-
 AS_FOR_TARGET=@AS_FOR_TARGET@
-CONFIGURED_AS_FOR_TARGET=@CONFIGURED_AS_FOR_TARGET@
-USUAL_AS_FOR_TARGET = ` \
-  if [ -f $$r/$(HOST_SUBDIR)/gas/as-new ] ; then \
-    echo $$r/$(HOST_SUBDIR)/gas/as-new ; \
-  elif [ -f $$r/$(HOST_SUBDIR)/gcc/as ]; then \
-    echo $$r/$(HOST_SUBDIR)/gcc/as ; \
-  else \
-    if [ '$(host)' = '$(target)' ] ; then \
-      echo $(AS); \
-    else \
-      echo $(CONFIGURED_AS_FOR_TARGET) ; \
-    fi; \
-  fi`
-
 CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
-CONFIGURED_CC_FOR_TARGET=@CONFIGURED_CC_FOR_TARGET@
-USUAL_CC_FOR_TARGET = ` \
-  if [ -f $$r/$(HOST_SUBDIR)/gcc/xgcc ] ; then \
-    echo $$r/$(HOST_SUBDIR)/gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/ ; \
-  else \
-    if [ '$(host)' = '$(target)' ] ; then \
-      echo $(CC); \
-    else \
-      echo $(CONFIGURED_CC_FOR_TARGET) ; \
-    fi; \
-  fi`
-
-# During gcc bootstrap, if we use some random cc for stage1 then
-# CFLAGS will be just -g.  We want to ensure that TARGET libraries
-# (which we know are built with gcc) are built with optimizations so
-# prepend -O2 when setting CFLAGS_FOR_TARGET.
-CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
-SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
 
 # If GCC_FOR_TARGET is not overriden on the command line, then this
 # variable is passed down to the gcc Makefile, where it is used to
 # build libgcc2.a.  We define it here so that it can itself be
 # overridden on the command line.
-GCC_FOR_TARGET=@GCC_FOR_TARGET@
-CONFIGURED_GCC_FOR_TARGET=@CONFIGURED_GCC_FOR_TARGET@
-USUAL_GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) \
-  $$r/$(HOST_SUBDIR)/gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/ $(FLAGS_FOR_TARGET)
-LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
-
+GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
 CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
-CONFIGURED_CXX_FOR_TARGET=@CONFIGURED_CXX_FOR_TARGET@
-USUAL_CXX_FOR_TARGET = ` \
-  if [ -f $$r/$(HOST_SUBDIR)/gcc/g++ ] ; then \
-    (echo $$r/$(HOST_SUBDIR)/gcc/g++ -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++; \
-    test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes; \
-    echo -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs) | tr '\015\012' '  '; \
-  else \
-    if [ '$(host)' = '$(target)' ] ; then \
-      echo $(CXX); \
-    else \
-      echo $(CONFIGURED_CXX_FOR_TARGET) ; \
-    fi; \
-  fi`
-
 RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
-USUAL_RAW_CXX_FOR_TARGET = ` \
-  if [ -f $$r/$(HOST_SUBDIR)/gcc/xgcc ] ; then \
-    echo $$r/$(HOST_SUBDIR)/gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs; \
-  else \
-    if [ '$(host)' = '$(target)' ] ; then \
-      echo $(CXX); \
-    else \
-      echo $(CONFIGURED_CXX_FOR_TARGET) ; \
-    fi; \
-  fi`
-
-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
-LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
-
 GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
-CONFIGURED_GCJ_FOR_TARGET=@CONFIGURED_GCJ_FOR_TARGET@
-USUAL_GCJ_FOR_TARGET = ` \
-  if [ -f $$r/$(HOST_SUBDIR)/gcc/gcj ] ; then \
-    echo $$r/$(HOST_SUBDIR)/gcc/gcj -B$$r/$(HOST_SUBDIR)/gcc ; \
-  else \
-    if [ '$(host)' = '$(target)' ] ; then \
-      echo $(GCJ); \
-    else \
-      echo $(CONFIGURED_GCJ_FOR_TARGET) ; \
-    fi; \
-  fi`
-
 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET)
-CONFIGURED_GFORTRAN_FOR_TARGET=@CONFIGURED_GFORTRAN_FOR_TARGET@
-USUAL_GFORTRAN_FOR_TARGET = ` \
-  if [ -f $$r/$(HOST_SUBDIR)/gcc/gfortran ] ; then \
-    echo $$r/$(HOST_SUBDIR)/gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc ; \
-  else \
-    if [ '$(host)' = '$(target)' ] ; then \
-      echo $(GFORTRAN); \
-    else \
-      echo $(CONFIGURED_GFORTRAN_FOR_TARGET) ; \
-    fi; \
-  fi`
-
-
 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
-CONFIGURED_DLLTOOL_FOR_TARGET=@CONFIGURED_DLLTOOL_FOR_TARGET@
-USUAL_DLLTOOL_FOR_TARGET = ` \
-  if [ -f $$r/$(HOST_SUBDIR)/binutils/dlltool ] ; then \
-    echo $$r/$(HOST_SUBDIR)/binutils/dlltool ; \
-  else \
-    if [ '$(host)' = '$(target)' ] ; then \
-      echo $(DLLTOOL); \
-    else \
-      echo $(CONFIGURED_DLLTOOL_FOR_TARGET) ; \
-    fi; \
-  fi`
-
 LD_FOR_TARGET=@LD_FOR_TARGET@
-CONFIGURED_LD_FOR_TARGET=@CONFIGURED_LD_FOR_TARGET@
-USUAL_LD_FOR_TARGET = ` \
-  if [ -f $$r/$(HOST_SUBDIR)/ld/ld-new ] ; then \
-    echo $$r/$(HOST_SUBDIR)/ld/ld-new ; \
-  elif [ -f $$r/$(HOST_SUBDIR)/gcc/collect-ld ]; then \
-    echo $$r/$(HOST_SUBDIR)/gcc/collect-ld ; \
-  else \
-    if [ '$(host)' = '$(target)' ] ; then \
-      echo $(LD); \
-    else \
-      echo $(CONFIGURED_LD_FOR_TARGET) ; \
-    fi; \
-  fi`
-
-LDFLAGS_FOR_TARGET = 
 
 LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
-CONFIGURED_LIPO_FOR_TARGET=@CONFIGURED_LIPO_FOR_TARGET@
-USUAL_LIPO_FOR_TARGET = ` \
-  if [ '$(host)' = '$(target)' ] ; then \
-    if [ x'$(LIPO)' != x ]; then \
-       echo $(LIPO); \
-    else \
-       echo lipo; \
-    fi; \
-  else \
-    echo $(CONFIGURED_LIPO_FOR_TARGET) ; \
-  fi`
-
 NM_FOR_TARGET=@NM_FOR_TARGET@
-CONFIGURED_NM_FOR_TARGET=@CONFIGURED_NM_FOR_TARGET@
-USUAL_NM_FOR_TARGET = ` \
-  if [ -f $$r/$(HOST_SUBDIR)/binutils/nm-new ] ; then \
-    echo $$r/$(HOST_SUBDIR)/binutils/nm-new ; \
-  elif [ -f $$r/$(HOST_SUBDIR)/gcc/nm ]; then \
-    echo $$r/$(HOST_SUBDIR)/gcc/nm ; \
-  else \
-    if [ '$(host)' = '$(target)' ] ; then \
-      echo $(NM); \
-    else \
-      echo $(CONFIGURED_NM_FOR_TARGET) ; \
-    fi; \
-  fi`
-
 OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
-CONFIGURED_OBJDUMP_FOR_TARGET=@CONFIGURED_OBJDUMP_FOR_TARGET@
-USUAL_OBJDUMP_FOR_TARGET = ` \
-  if [ -f $$r/$(HOST_SUBDIR)/binutils/objdump ] ; then \
-    echo $$r/$(HOST_SUBDIR)/binutils/objdump ; \
-  else \
-    if [ '$(host)' = '$(target)' ] ; then \
-      if [ x'$(OBJDUMP)' != x ]; then \
-         echo $(OBJDUMP); \
-      else \
-         echo objdump; \
-      fi; \
-    else \
-      echo $(CONFIGURED_OBJDUMP_FOR_TARGET) ; \
-    fi; \
-  fi`
-
 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
-CONFIGURED_RANLIB_FOR_TARGET=@CONFIGURED_RANLIB_FOR_TARGET@
-USUAL_RANLIB_FOR_TARGET = ` \
-  if [ -f $$r/$(HOST_SUBDIR)/binutils/ranlib ] ; then \
-    echo $$r/$(HOST_SUBDIR)/binutils/ranlib ; \
-  else \
-    if [ '$(host)' = '$(target)' ] ; then \
-      if [ x'$(RANLIB)' != x ]; then \
-         echo $(RANLIB); \
-      else \
-         echo ranlib; \
-      fi; \
-    else \
-      echo $(CONFIGURED_RANLIB_FOR_TARGET) ; \
-    fi; \
-  fi`
-
 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
-CONFIGURED_STRIP_FOR_TARGET=@CONFIGURED_STRIP_FOR_TARGET@
-USUAL_STRIP_FOR_TARGET = ` \
-  if [ -f $$r/$(HOST_SUBDIR)/binutils/strip ] ; then \
-    echo $$r/$(HOST_SUBDIR)/binutils/strip ; \
-  else \
-    if [ '$(host)' = '$(target)' ] ; then \
-      if [ x'$(STRIP)' != x ]; then \
-         echo $(STRIP); \
-      else \
-         echo strip; \
-      fi; \
-    else \
-      echo $(CONFIGURED_STRIP_FOR_TARGET) ; \
-    fi; \
-  fi`
-
 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
-CONFIGURED_WINDRES_FOR_TARGET=@CONFIGURED_WINDRES_FOR_TARGET@
-USUAL_WINDRES_FOR_TARGET = ` \
-  if [ -f $$r/$(HOST_SUBDIR)/binutils/windres ] ; then \
-    echo $$r/$(HOST_SUBDIR)/binutils/windres ; \
-  else \
-    if [ '$(host)' = '$(target)' ] ; then \
-      echo $(WINDRES); \
-    else \
-      echo $(CONFIGURED_WINDRES_FOR_TARGET) ; \
-    fi; \
-  fi`
 
+COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
+COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
+COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
+
+# During gcc bootstrap, if we use some random cc for stage1 then
+# CFLAGS will be just -g.  We want to ensure that TARGET libraries
+# (which we know are built with gcc) are built with optimizations so
+# prepend -O2 when setting CFLAGS_FOR_TARGET.
+CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
+SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
+CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
+LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
+LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
+LDFLAGS_FOR_TARGET = 
 PICFLAG_FOR_TARGET = 
 
 # ------------------------------------
@@ -644,8 +404,10 @@ EXTRA_HOST_FLAGS = \
 	'CXX=$(CXX)' \
 	'DLLTOOL=$(DLLTOOL)' \
 	'LD=$(LD)' \
+	'LIPO=$(LIPO)' \
 	'NM=$(NM)' \
 	'RANLIB=$(RANLIB)' \
+	'STRIP=$(STRIP)' \
 	'WINDRES=$(WINDRES)'
 
 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
@@ -667,17 +429,17 @@ X11_FLAGS_TO_PASS = \
 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.
 EXTRA_TARGET_FLAGS = \
 	'AR=$$(AR_FOR_TARGET)' \
-	'AS=$$(AS_FOR_TARGET)' \
+	'AS=$$(COMPILER_AS_FOR_TARGET)' \
 	'CC=$$(CC_FOR_TARGET)' \
 	'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
 	'CXX=$$(CXX_FOR_TARGET)' \
 	'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
 	'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
-	'LD=$$(LD_FOR_TARGET)' \
+	'LD=$$(COMPILER_LD_FOR_TARGET)' \
 	'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
 	'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
 	'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
-	'NM=$$(NM_FOR_TARGET)' \
+	'NM=$$(COMPILER_NM_FOR_TARGET)' \
 	'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
 	'RANLIB=$$(RANLIB_FOR_TARGET)' \
 	'WINDRES=$$(WINDRES_FOR_TARGET)'
@@ -721,26 +483,16 @@ configure-target: [+
 @if gcc-bootstrap
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	if [ ! -f stage_last ]; then \
-	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) bootstrap; \
-	fi
+	$(MAKE) $(RECURSE_FLAGS_TO_PASS) stage3-bubble; \
 @endif gcc-bootstrap
 	@$(unstage)
-@if gcc-no-bootstrap
-	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(MAKE) $(RECURSE_FLAGS_TO_PASS) all-prebootstrap
-@endif gcc-no-bootstrap
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	if [ -f stage_last ]; then \
-	  $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host; \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
 	else \
-	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host; \
+	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \
 	fi
-	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(MAKE) $(RECURSE_FLAGS_TO_PASS) all-target
 	@$(stage)
 
 .PHONY: all-build
@@ -1548,7 +1301,8 @@ stage[+id+]-bubble:: [+ IF prev +]stage[
 	else \
 	  $(MAKE) stage[+id+]-start; \
 	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
-	fi
+	fi[+ IF compare-target +]
+	$(MAKE) [+compare-target+][+ ENDIF compare-target +]
 
 .PHONY: all-stage[+id+] clean-stage[+id+]
 do-clean: clean-stage[+id+]
@@ -1594,9 +1348,15 @@ do-clean: clean-stage[+id+]
 
 [+ IF bootstrap-target +]
 .PHONY: [+bootstrap-target+]
-[+bootstrap-target+]: stage[+id+]-bubble
-	[+ IF compare-target +]$(MAKE) [+compare-target+]
-	[+ ENDIF compare-target +]$(MAKE) $(RECURSE_FLAGS_TO_PASS) all
+[+bootstrap-target+]:
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
+	@$(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
+	@$(stage)
 [+ ENDIF bootstrap-target +]
 
 # Rules to wipe a stage and all the following ones, also used for cleanstrap
Index: configure.in
===================================================================
--- configure.in	(revision 107191)
+++ configure.in	(working copy)
@@ -1611,17 +1611,6 @@ esac
 tooldir='${exec_prefix}'/${target_alias}
 build_tooldir=${tooldir}
 
-# Generate default definitions for YACC, M4, LEX and other programs that run
-# on the build machine.  These are used if the Makefile can't locate these
-# programs in objdir.
-MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
-AC_CHECK_PROGS([CONFIGURED_BISON], [bison], [$MISSING bison])
-AC_CHECK_PROGS([CONFIGURED_YACC], ['bison -y' byacc yacc], [$MISSING bison -y])
-AC_CHECK_PROGS([CONFIGURED_M4], [gm4 gnum4 m4], [$MISSING m4])
-AC_CHECK_PROGS([CONFIGURED_FLEX], [flex], [$MISSING flex])
-AC_CHECK_PROGS([CONFIGURED_LEX], [flex lex], [$MISSING flex])
-AC_CHECK_PROGS([CONFIGURED_MAKEINFO], makeinfo, [$MISSING makeinfo])
-
 # Create a .gdbinit file which runs the one in srcdir
 # and tells GDB to look there for source files.
 
@@ -2099,13 +2088,81 @@ AC_SUBST(target_configdirs)
 AC_SUBST(CC_FOR_BUILD)
 AC_SUBST(config_shell)
 
+# Generate default definitions for YACC, M4, LEX and other programs that run
+# on the build machine.  These are used if the Makefile can't locate these
+# programs in objdir.
+MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
+
+AC_CHECK_PROGS([YACC], ['bison -y' byacc yacc], [$MISSING bison -y])
+case " $build_configdirs " in
+  *" bison "*) YACC='$$r/$(BUILD_SUBDIR)/bison/tests/bison -y' ;;
+  *" byacc "*) YACC='$$r/$(BUILD_SUBDIR)/byacc/byacc' ;;
+esac
+
+AC_CHECK_PROGS([BISON], [bison], [$MISSING bison])
+case " $build_configdirs " in
+  *" bison "*) BISON='$$r/$(BUILD_SUBDIR)/bison/tests/bison' ;;
+esac
+
+AC_CHECK_PROGS([M4], [gm4 gnum4 m4], [$MISSING m4])
+case " $build_configdirs " in
+  *" m4 "*) M4='$$r/$(BUILD_SUBDIR)/m4/m4' ;;
+esac
+
+AC_CHECK_PROGS([LEX], [flex lex], [$MISSING flex])
+case " $build_configdirs " in
+  *" flex "*) LEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
+  *" lex "*) LEX='$$r/$(BUILD_SUBDIR)/lex/lex' ;;
+esac
+
+AC_CHECK_PROGS([FLEX], [flex], [$MISSING flex])
+case " $build_configdirs " in
+  *" flex "*) FLEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
+esac
+
+AC_CHECK_PROGS([MAKEINFO], makeinfo, [$MISSING makeinfo])
+case " $build_configdirs " in
+  *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
+  *)
+changequote(,)
+    # For an installed makeinfo, we require it to be from texinfo 4.2 or
+    # higher, else we use the "missing" dummy.
+    if ${MAKEINFO} --version \
+       | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])' >/dev/null 2>&1; then
+      :
+    else
+      MAKEINFO="$MISSING makeinfo"
+    fi
+    ;;
+changequote([,])
+esac
+
+# FIXME: expect and dejagnu may become build tools?
+
+AC_CHECK_PROGS(EXPECT, expect, expect)
+case " $configdirs " in
+  *" expect "*)
+    test $host = $build && EXPECT='$$r/$(HOST_SUBDIR)/expect/expect'
+    ;;
+esac
+
+AC_CHECK_PROGS(RUNTEST, runtest, runtest)
+case " $configdirs " in
+  *" dejagnu "*)
+    test $host = $build && RUNTEST='$$r/$(HOST_SUBDIR)/dejagnu/runtest'
+    ;;
+esac
+
+
 # Host tools.
 NCN_STRICT_CHECK_TOOLS(AR, ar)
 NCN_STRICT_CHECK_TOOLS(AS, as)
 NCN_STRICT_CHECK_TOOLS(DLLTOOL, dlltool)
 NCN_STRICT_CHECK_TOOLS(LD, ld)
+NCN_STRICT_CHECK_TOOLS(LIPO, lipo)
 NCN_STRICT_CHECK_TOOLS(NM, nm)
 NCN_STRICT_CHECK_TOOLS(RANLIB, ranlib, :)
+NCN_STRICT_CHECK_TOOLS(STRIP, strip, :)
 NCN_STRICT_CHECK_TOOLS(WINDRES, windres)
 NCN_STRICT_CHECK_TOOLS(OBJCOPY, objcopy)
 NCN_STRICT_CHECK_TOOLS(OBJDUMP, objdump)
@@ -2115,8 +2172,7 @@ AC_SUBST(CFLAGS)
 AC_SUBST(CFLAGS_FOR_BUILD)
 AC_SUBST(CXXFLAGS)
 
-# Target tools.  Do the tests using the names they may have passed in
-# the environment, then move it to CONFIGURED_*_FOR_TARGET.
+# Target tools.
 NCN_STRICT_CHECK_TARGET_TOOLS(AR_FOR_TARGET, ar)
 NCN_STRICT_CHECK_TARGET_TOOLS(AS_FOR_TARGET, as)
 NCN_STRICT_CHECK_TARGET_TOOLS(CC_FOR_TARGET, cc gcc)
@@ -2133,83 +2189,32 @@ NCN_STRICT_CHECK_TARGET_TOOLS(RANLIB_FOR
 NCN_STRICT_CHECK_TARGET_TOOLS(STRIP_FOR_TARGET, strip)
 NCN_STRICT_CHECK_TARGET_TOOLS(WINDRES_FOR_TARGET, windres)
 
-CONFIGURED_AR_FOR_TARGET="$AR_FOR_TARGET"
-CONFIGURED_AS_FOR_TARGET="$AS_FOR_TARGET"
-CONFIGURED_CC_FOR_TARGET="$CC_FOR_TARGET"
-CONFIGURED_CXX_FOR_TARGET="$CXX_FOR_TARGET"
-CONFIGURED_DLLTOOL_FOR_TARGET="$DLLTOOL_FOR_TARGET"
-CONFIGURED_GCC_FOR_TARGET="$GCC_FOR_TARGET"
-CONFIGURED_GCJ_FOR_TARGET="$GCJ_FOR_TARGET"
-CONFIGURED_GFORTRAN_FOR_TARGET="$GFORTRAN_FOR_TARGET"
-CONFIGURED_LD_FOR_TARGET="$LD_FOR_TARGET"
-CONFIGURED_LIPO_FOR_TARGET="$LIPO_FOR_TARGET"
-CONFIGURED_NM_FOR_TARGET="$NM_FOR_TARGET"
-CONFIGURED_OBJDUMP_FOR_TARGET="$OBJDUMP_FOR_TARGET"
-CONFIGURED_RANLIB_FOR_TARGET="$RANLIB_FOR_TARGET"
-CONFIGURED_STRIP_FOR_TARGET="$STRIP_FOR_TARGET"
-CONFIGURED_WINDRES_FOR_TARGET="$WINDRES_FOR_TARGET"
-
-AC_SUBST(CONFIGURED_AR_FOR_TARGET)dnl
-AC_SUBST(CONFIGURED_AS_FOR_TARGET)dnl
-AC_SUBST(CONFIGURED_CC_FOR_TARGET)dnl
-AC_SUBST(CONFIGURED_CXX_FOR_TARGET)dnl
-AC_SUBST(CONFIGURED_DLLTOOL_FOR_TARGET)dnl
-AC_SUBST(CONFIGURED_GCC_FOR_TARGET)dnl
-AC_SUBST(CONFIGURED_GCJ_FOR_TARGET)dnl
-AC_SUBST(CONFIGURED_GFORTRAN_FOR_TARGET)dnl
-AC_SUBST(CONFIGURED_LD_FOR_TARGET)dnl
-AC_SUBST(CONFIGURED_LIPO_FOR_TARGET)dnl
-AC_SUBST(CONFIGURED_NM_FOR_TARGET)dnl
-AC_SUBST(CONFIGURED_OBJDUMP_FOR_TARGET)dnl
-AC_SUBST(CONFIGURED_RANLIB_FOR_TARGET)dnl
-AC_SUBST(CONFIGURED_STRIP_FOR_TARGET)dnl
-AC_SUBST(CONFIGURED_WINDRES_FOR_TARGET)dnl
-AC_SUBST(FLAGS_FOR_TARGET)
+RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
 
-# Fix up target tools.
-if test "x${build}" = "x${host}" ; then
-  # In this case, the newly built tools can and should be used,
-  # so we override the results of the autoconf tests.
-  # This should really only happen when the tools are actually being built,
-  # but that's a further refinement.  The new build scheme, where
-  # tools are built into a structure paralleling where they're installed,
-  # should also eliminate all of this cleanly.
-  AR_FOR_TARGET="\$(USUAL_AR_FOR_TARGET)"
-  AS_FOR_TARGET="\$(USUAL_AS_FOR_TARGET)"
-  CC_FOR_TARGET="\$(USUAL_CC_FOR_TARGET)"
-  CXX_FOR_TARGET="\$(USUAL_CXX_FOR_TARGET)"
-  RAW_CXX_FOR_TARGET="\$(USUAL_RAW_CXX_FOR_TARGET)"
-  DLLTOOL_FOR_TARGET="\$(USUAL_DLLTOOL_FOR_TARGET)"
-  GCC_FOR_TARGET="\$(USUAL_GCC_FOR_TARGET)"
-  GCJ_FOR_TARGET="\$(USUAL_GCJ_FOR_TARGET)"
-  GFORTRAN_FOR_TARGET="\$(USUAL_GFORTRAN_FOR_TARGET)"
-  LD_FOR_TARGET="\$(USUAL_LD_FOR_TARGET)"
-  LIPO_FOR_TARGET="\$(USUAL_LIPO_FOR_TARGET)"
-  NM_FOR_TARGET="\$(USUAL_NM_FOR_TARGET)"
-  OBJDUMP_FOR_TARGET="\$(USUAL_OBJDUMP_FOR_TARGET)"
-  RANLIB_FOR_TARGET="\$(USUAL_RANLIB_FOR_TARGET)"
-  STRIP_FOR_TARGET="\$(USUAL_STRIP_FOR_TARGET)"
-  WINDRES_FOR_TARGET="\$(USUAL_WINDRES_FOR_TARGET)"
-else
-  # Just use the ones we found.
-  AR_FOR_TARGET="\$(CONFIGURED_AR_FOR_TARGET)"
-  AS_FOR_TARGET="\$(CONFIGURED_AS_FOR_TARGET)"
-  CC_FOR_TARGET="\$(CONFIGURED_CC_FOR_TARGET)"
-  CXX_FOR_TARGET="\$(CONFIGURED_CXX_FOR_TARGET)"
-  RAW_CXX_FOR_TARGET="\$(CONFIGURED_CXX_FOR_TARGET)"
-  DLLTOOL_FOR_TARGET="\$(CONFIGURED_DLLTOOL_FOR_TARGET)"
-  GCC_FOR_TARGET="\$(CONFIGURED_GCC_FOR_TARGET)"
-  GCJ_FOR_TARGET="\$(CONFIGURED_GCJ_FOR_TARGET)"
-  GFORTRAN_FOR_TARGET="\$(CONFIGURED_GFORTRAN_FOR_TARGET)"
-  LD_FOR_TARGET="\$(CONFIGURED_LD_FOR_TARGET)"
-  LIPO_FOR_TARGET="\$(CONFIGURED_LIPO_FOR_TARGET)"
-  NM_FOR_TARGET="\$(CONFIGURED_NM_FOR_TARGET)"
-  OBJDUMP_FOR_TARGET="\$(CONFIGURED_OBJDUMP_FOR_TARGET)"
-  RANLIB_FOR_TARGET="\$(CONFIGURED_RANLIB_FOR_TARGET)"
-  STRIP_FOR_TARGET="\$(CONFIGURED_STRIP_FOR_TARGET)"
-  WINDRES_FOR_TARGET="\$(CONFIGURED_WINDRES_FOR_TARGET)"  
-fi
+GCC_TARGET_TOOL(ar, AR_FOR_TARGET, AR, [binutils/ar])
+GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new])
+GCC_TARGET_TOOL(cc, CC_FOR_TARGET, CC, [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
+GCC_TARGET_TOOL(c++, CXX_FOR_TARGET, CXX,
+		[gcc/g++ -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ `test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs],
+		c++)
+GCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX,
+		[gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs],
+		c++)
+GCC_TARGET_TOOL(dlltool, DLLTOOL_FOR_TARGET, DLLTOOL, [binutils/dlltool])
+GCC_TARGET_TOOL(gcc, GCC_FOR_TARGET, , [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
+GCC_TARGET_TOOL(gcj, GCJ_FOR_TARGET, GCJ,
+		[gcc/gcj -B$$r/$(HOST_SUBDIR)/gcc/], java)
+GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN,
+		[gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran)
+GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new])
+GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
+GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
+GCC_TARGET_TOOL(objdump, OBJDUMP_FOR_TARGET, OBJDUMP, [binutils/objdump])
+GCC_TARGET_TOOL(ranlib, RANLIB_FOR_TARGET, RANLIB, [binutils/ranlib])
+GCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, STRIP, [binutils/strip])
+GCC_TARGET_TOOL(windres, WINDRES_FOR_TARGET, WINDRES, [binutils/windres])
 
+AC_SUBST(FLAGS_FOR_TARGET)
 AC_SUBST(RAW_CXX_FOR_TARGET)
 
 # Certain tools may need extra flags.
@@ -2217,6 +2222,25 @@ AR_FOR_TARGET=${AR_FOR_TARGET}${extra_ar
 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target}
 NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
 
+# When building target libraries, except in a Canadian cross, we use
+# the same toolchain as the compiler we just built.
+COMPILER_AS_FOR_TARGET='$(AS_FOR_TARGET)'
+COMPILER_LD_FOR_TARGET='$(LD_FOR_TARGET)'
+COMPILER_NM_FOR_TARGET='$(NM_FOR_TARGET)'
+if test $host = $build; then
+  case " $configdirs " in
+    *" gcc "*)
+      COMPILER_AS_FOR_TARGET='$$r/gcc/as'
+      COMPILER_LD_FOR_TARGET='$$r/gcc/collect-ld'
+      COMPILER_NM_FOR_TARGET='$$r/gcc/nm'${extra_nmflags_for_target}
+      ;;
+  esac
+fi
+
+AC_SUBST(COMPILER_AS_FOR_TARGET)
+AC_SUBST(COMPILER_LD_FOR_TARGET)
+AC_SUBST(COMPILER_NM_FOR_TARGET)
+
 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
 AC_ARG_ENABLE(maintainer-mode,
 [  --enable-maintainer-mode enable make rules and dependencies not useful
Index: config/acx.m4
===================================================================
--- config/acx.m4	(revision 107191)
+++ config/acx.m4	(working copy)
@@ -296,3 +296,34 @@ fi
 AC_SUBST(LN)dnl
 ])
 
+dnl GCC_TARGET_TOOL(PROGRAM, TARGET-VAR, HOST-VAR, IN-TREE-TOOL, LANGUAGE)
+AC_DEFUN([GCC_TARGET_TOOL],
+[AC_MSG_CHECKING(where to find the target $1)
+if test "x${build}" != "x${host}" ; then
+  # Canadian cross, just use what we found
+  AC_MSG_RESULT(pre-installed)
+else
+  ifelse([$4],,,
+  [ok=yes
+  case " ${configdirs} " in
+    *" patsubst([$4], [/.*], []) "*) ;;
+    *) ok=no ;;
+  esac
+  ifelse([$5],,, 
+  [case ,${enable_languages}, in
+    *,$5,*) ;;
+    *) ok=no ;;
+  esac])
+  if test $ok = yes; then
+    # An in-tree tool is available and we can use it
+    $2='$$r/$(HOST_SUBDIR)/$4'
+    AC_MSG_RESULT(just compiled)
+  el])if test "x$target" = "x$host"; then
+    # We can use an host tool
+    $2='$($3)'
+    AC_MSG_RESULT(host tool)
+  else
+    # We need a cross tool
+    AC_MSG_RESULT(pre-installed)
+  fi
+fi])

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]