OSDN Git Service

* config/xtensa/xtensa.h (TRAMPOLINE_TEMPLATE): Use "no-transform"
[pf3gnuchains/gcc-fork.git] / Makefile.in
index d979b84..a6d28ac 100644 (file)
@@ -149,6 +149,9 @@ SUBDIRS = @configdirs@
 # This is set by the configure script to the arguments to use when configuring
 # directories built for the host system.
 HOST_CONFIGARGS = @host_configargs@
+# Host programs are put under this directory, which is . except if building
+# with srcdir=..
+HOST_SUBDIR = @host_subdir@
 # This is the list of variables to export in the environment when
 # configuring subdirectories for the host system.
 HOST_EXPORTS = \
@@ -178,8 +181,12 @@ HOST_EXPORTS = \
 # Similar, for later GCC stages.
 STAGE_HOST_EXPORTS = \
        $(HOST_EXPORTS) \
-       CC="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
-       CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC_FOR_BUILD;
+       CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
+         -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
+       CC_FOR_BUILD="$(STAGE_CC_WRAPPER) \
+         $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
+         -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
+         -B$(build_tooldir)/bin/"; export CC_FOR_BUILD;
 
 # This is set by the configure script to the list of directories which
 # should be built using the target tools.
@@ -198,7 +205,7 @@ BASE_TARGET_EXPORTS = \
        CC="$(CC_FOR_TARGET)"; export CC; \
        CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
        CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
-       CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
+       CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
        CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
        GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
        GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \
@@ -302,8 +309,9 @@ MAKEINFO = `if [ -f $$r/$(BUILD_SUBDIR)/texinfo/makeinfo/Makefile ] ; \
 # (Default to avoid splitting info files by setting the threshold high.)
 MAKEINFOFLAGS = --split-size=5000000
 
-EXPECT = `if [ -f $$r/expect/expect ] ; \
-       then echo $$r/expect/expect ; \
+# 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 ] ; \
@@ -316,7 +324,7 @@ RUNTEST = `if [ -f $$s/dejagnu/runtest ] ; \
 
 # This is the list of directories that may be needed in RPATH_ENVVAR
 # so that programs built for the host machine work.
-HOST_LIB_PATH = $$r/bfd:$$r/opcodes
+HOST_LIB_PATH = $$r/$(HOST_SUBDIR)/bfd:$$r/$(HOST_SUBDIR)/opcodes
 
 AS = @AS@
 
@@ -357,8 +365,8 @@ 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/binutils/ar ] ; then \
-    echo $$r/binutils/ar ; \
+  if [ -f $$r/$(HOST_SUBDIR)/binutils/ar ] ; then \
+    echo $$r/$(HOST_SUBDIR)/binutils/ar ; \
   else \
     if [ '$(host)' = '$(target)' ] ; then \
       echo $(AR); \
@@ -370,9 +378,9 @@ USUAL_AR_FOR_TARGET = ` \
 AS_FOR_TARGET=@AS_FOR_TARGET@
 CONFIGURED_AS_FOR_TARGET=@CONFIGURED_AS_FOR_TARGET@
 USUAL_AS_FOR_TARGET = ` \
-  if [ -f $$r/gas/as-new ] ; then \
-    echo $$r/gas/as-new ; \
-  elif [ -f $$r/gcc/xgcc ]; then \
+  if [ -f $$r/$(HOST_SUBDIR)/gas/as-new ] ; then \
+    echo $$r/$(HOST_SUBDIR)/gas/as-new ; \
+  elif [ -f $$r/$(HOST_SUBDIR)/gcc/xgcc ]; then \
     $(CC_FOR_TARGET) -print-prog-name=as ; \
   else \
     if [ '$(host)' = '$(target)' ] ; then \
@@ -393,7 +401,8 @@ CFLAGS_FOR_TARGET = -O2 $(CFLAGS)
 # build libgcc2.a.  We define it here so that it can itself be
 # overridden on the command line.
 GCC_FOR_TARGET=@GCC_FOR_TARGET@
-USUAL_GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_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)
 
 CXX_FOR_TARGET = @CXX_FOR_TARGET@
@@ -406,8 +415,8 @@ LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
 CONFIGURED_DLLTOOL_FOR_TARGET=@CONFIGURED_DLLTOOL_FOR_TARGET@
 USUAL_DLLTOOL_FOR_TARGET = ` \
-  if [ -f $$r/binutils/dlltool ] ; then \
-    echo $$r/binutils/dlltool ; \
+  if [ -f $$r/$(HOST_SUBDIR)/binutils/dlltool ] ; then \
+    echo $$r/$(HOST_SUBDIR)/binutils/dlltool ; \
   else \
     if [ '$(host)' = '$(target)' ] ; then \
       echo $(DLLTOOL); \
@@ -422,9 +431,9 @@ GFORTRAN_FOR_TARGET = @GFORTRAN_FOR_TARGET@
 LD_FOR_TARGET=@LD_FOR_TARGET@
 CONFIGURED_LD_FOR_TARGET=@CONFIGURED_LD_FOR_TARGET@
 USUAL_LD_FOR_TARGET = ` \
-  if [ -f $$r/ld/ld-new ] ; then \
-    echo $$r/ld/ld-new ; \
-  elif [ -f $$r/gcc/xgcc ]; then \
+  if [ -f $$r/$(HOST_SUBDIR)/ld/ld-new ] ; then \
+    echo $$r/$(HOST_SUBDIR)/ld/ld-new ; \
+  elif [ -f $$r/$(HOST_SUBDIR)/gcc/xgcc ]; then \
     $(CC_FOR_TARGET) -print-prog-name=ld ; \
   else \
     if [ '$(host)' = '$(target)' ] ; then \
@@ -439,9 +448,9 @@ LDFLAGS_FOR_TARGET =
 NM_FOR_TARGET=@NM_FOR_TARGET@
 CONFIGURED_NM_FOR_TARGET=@CONFIGURED_NM_FOR_TARGET@
 USUAL_NM_FOR_TARGET = ` \
-  if [ -f $$r/binutils/nm-new ] ; then \
-    echo $$r/binutils/nm-new ; \
-  elif [ -f $$r/gcc/xgcc ]; then \
+  if [ -f $$r/$(HOST_SUBDIR)/binutils/nm-new ] ; then \
+    echo $$r/$(HOST_SUBDIR)/binutils/nm-new ; \
+  elif [ -f $$r/$(HOST_SUBDIR)/gcc/xgcc ]; then \
     $(CC_FOR_TARGET) -print-prog-name=nm ; \
   else \
     if [ '$(host)' = '$(target)' ] ; then \
@@ -454,8 +463,8 @@ USUAL_NM_FOR_TARGET = ` \
 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
 CONFIGURED_RANLIB_FOR_TARGET=@CONFIGURED_RANLIB_FOR_TARGET@
 USUAL_RANLIB_FOR_TARGET = ` \
-  if [ -f $$r/binutils/ranlib ] ; then \
-    echo $$r/binutils/ranlib ; \
+  if [ -f $$r/$(HOST_SUBDIR)/binutils/ranlib ] ; then \
+    echo $$r/$(HOST_SUBDIR)/binutils/ranlib ; \
   else \
     if [ '$(host)' = '$(target)' ] ; then \
       if [ x'$(RANLIB)' != x ]; then \
@@ -471,8 +480,8 @@ USUAL_RANLIB_FOR_TARGET = ` \
 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
 CONFIGURED_WINDRES_FOR_TARGET=@CONFIGURED_WINDRES_FOR_TARGET@
 USUAL_WINDRES_FOR_TARGET = ` \
-  if [ -f $$r/binutils/windres ] ; then \
-    echo $$r/binutils/windres ; \
+  if [ -f $$r/$(HOST_SUBDIR)/binutils/windres ] ; then \
+    echo $$r/$(HOST_SUBDIR)/binutils/windres ; \
   else \
     if [ '$(host)' = '$(target)' ] ; then \
       echo $(WINDRES); \
@@ -552,6 +561,7 @@ BASE_FLAGS_TO_PASS = \
        "AS_FOR_TARGET=$(AS_FOR_TARGET)" \
        "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
        "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
+       "CPPFLAGS_FOR_TARGET=$(CPPFLAGS_FOR_TARGET)" \
        "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
        "CXXFLAGS_FOR_TARGET=$(CXXFLAGS_FOR_TARGET)" \
        "DLLTOOL_FOR_TARGET=$(DLLTOOL_FOR_TARGET)" \
@@ -714,7 +724,8 @@ configure-host:  \
     maybe-configure-guile \
     maybe-configure-tk \
     maybe-configure-libtermcap \
-    maybe-configure-utils
+    maybe-configure-utils \
+    maybe-configure-gnattools
 .PHONY: configure-target
 configure-target:  \
     maybe-configure-target-libstdc++-v3 \
@@ -816,7 +827,8 @@ all-host:  \
     maybe-all-guile \
     maybe-all-tk \
     maybe-all-libtermcap \
-    maybe-all-utils
+    maybe-all-utils \
+    maybe-all-gnattools
 .PHONY: all-target
 all-target:  \
     maybe-all-target-libstdc++-v3 \
@@ -913,7 +925,8 @@ info-host:  \
     maybe-info-guile \
     maybe-info-tk \
     maybe-info-libtermcap \
-    maybe-info-utils
+    maybe-info-utils \
+    maybe-info-gnattools
 
 .PHONY: info-target
 info-target:  \
@@ -1006,7 +1019,8 @@ dvi-host:  \
     maybe-dvi-guile \
     maybe-dvi-tk \
     maybe-dvi-libtermcap \
-    maybe-dvi-utils
+    maybe-dvi-utils \
+    maybe-dvi-gnattools
 
 .PHONY: dvi-target
 dvi-target:  \
@@ -1099,7 +1113,8 @@ html-host:  \
     maybe-html-guile \
     maybe-html-tk \
     maybe-html-libtermcap \
-    maybe-html-utils
+    maybe-html-utils \
+    maybe-html-gnattools
 
 .PHONY: html-target
 html-target:  \
@@ -1192,7 +1207,8 @@ TAGS-host:  \
     maybe-TAGS-guile \
     maybe-TAGS-tk \
     maybe-TAGS-libtermcap \
-    maybe-TAGS-utils
+    maybe-TAGS-utils \
+    maybe-TAGS-gnattools
 
 .PHONY: TAGS-target
 TAGS-target:  \
@@ -1285,7 +1301,8 @@ install-info-host:  \
     maybe-install-info-guile \
     maybe-install-info-tk \
     maybe-install-info-libtermcap \
-    maybe-install-info-utils
+    maybe-install-info-utils \
+    maybe-install-info-gnattools
 
 .PHONY: install-info-target
 install-info-target:  \
@@ -1378,7 +1395,8 @@ installcheck-host:  \
     maybe-installcheck-guile \
     maybe-installcheck-tk \
     maybe-installcheck-libtermcap \
-    maybe-installcheck-utils
+    maybe-installcheck-utils \
+    maybe-installcheck-gnattools
 
 .PHONY: installcheck-target
 installcheck-target:  \
@@ -1471,7 +1489,8 @@ mostlyclean-host:  \
     maybe-mostlyclean-guile \
     maybe-mostlyclean-tk \
     maybe-mostlyclean-libtermcap \
-    maybe-mostlyclean-utils
+    maybe-mostlyclean-utils \
+    maybe-mostlyclean-gnattools
 
 .PHONY: mostlyclean-target
 mostlyclean-target:  \
@@ -1564,7 +1583,8 @@ clean-host:  \
     maybe-clean-guile \
     maybe-clean-tk \
     maybe-clean-libtermcap \
-    maybe-clean-utils
+    maybe-clean-utils \
+    maybe-clean-gnattools
 
 .PHONY: clean-target
 clean-target:  \
@@ -1657,7 +1677,8 @@ distclean-host:  \
     maybe-distclean-guile \
     maybe-distclean-tk \
     maybe-distclean-libtermcap \
-    maybe-distclean-utils
+    maybe-distclean-utils \
+    maybe-distclean-gnattools
 
 .PHONY: distclean-target
 distclean-target:  \
@@ -1750,7 +1771,8 @@ maintainer-clean-host:  \
     maybe-maintainer-clean-guile \
     maybe-maintainer-clean-tk \
     maybe-maintainer-clean-libtermcap \
-    maybe-maintainer-clean-utils
+    maybe-maintainer-clean-utils \
+    maybe-maintainer-clean-gnattools
 
 .PHONY: maintainer-clean-target
 maintainer-clean-target:  \
@@ -1804,6 +1826,9 @@ local-distclean:
          rm -rf $(TARGET_SUBDIR); \
        else true; fi
        -rm -rf $(BUILD_SUBDIR)
+       -if [ "$(HOST_SUBDIR)" != "." ]; then \
+         rm -rf $(HOST_SUBDIR); \
+       else true; fi
        -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
        -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
        -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
@@ -1903,6 +1928,7 @@ do-check: unstage  \
     maybe-check-tk \
     maybe-check-libtermcap \
     maybe-check-utils \
+    maybe-check-gnattools \
     maybe-check-target-libstdc++-v3 \
     maybe-check-target-libmudflap \
     maybe-check-target-newlib \
@@ -2014,7 +2040,8 @@ install-host-nogcc:  \
     maybe-install-guile \
     maybe-install-tk \
     maybe-install-libtermcap \
-    maybe-install-utils
+    maybe-install-utils \
+    maybe-install-gnattools
 
 .PHONY: install-host
 install-host:  \
@@ -2083,7 +2110,8 @@ install-host:  \
     maybe-install-guile \
     maybe-install-tk \
     maybe-install-libtermcap \
-    maybe-install-utils
+    maybe-install-utils \
+    maybe-install-gnattools
 
 .PHONY: install-target
 install-target:  \
@@ -2175,36 +2203,11 @@ configure-build-libiberty:
        cd "$(BUILD_SUBDIR)/libiberty" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(BUILD_SUBDIR)/libiberty/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/libiberty "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../libiberty; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/libiberty"; \
-         libsrcdir="$$s/libiberty"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/libiberty"; \
+       libsrcdir="$$s/libiberty"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(BUILD_CONFIGARGS) $${srcdiroption} \
@@ -2239,36 +2242,11 @@ configure-build-bison:
        cd "$(BUILD_SUBDIR)/bison" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(BUILD_SUBDIR)/bison/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/bison "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../bison; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/bison"; \
-         libsrcdir="$$s/bison"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/bison"; \
+       libsrcdir="$$s/bison"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(BUILD_CONFIGARGS) $${srcdiroption} \
@@ -2303,36 +2281,11 @@ configure-build-byacc:
        cd "$(BUILD_SUBDIR)/byacc" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(BUILD_SUBDIR)/byacc/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/byacc "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../byacc; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/byacc"; \
-         libsrcdir="$$s/byacc"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/byacc"; \
+       libsrcdir="$$s/byacc"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(BUILD_CONFIGARGS) $${srcdiroption} \
@@ -2367,36 +2320,11 @@ configure-build-flex:
        cd "$(BUILD_SUBDIR)/flex" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(BUILD_SUBDIR)/flex/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/flex "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../flex; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/flex"; \
-         libsrcdir="$$s/flex"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/flex"; \
+       libsrcdir="$$s/flex"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(BUILD_CONFIGARGS) $${srcdiroption} \
@@ -2431,36 +2359,11 @@ configure-build-m4:
        cd "$(BUILD_SUBDIR)/m4" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(BUILD_SUBDIR)/m4/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/m4 "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../m4; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/m4"; \
-         libsrcdir="$$s/m4"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/m4"; \
+       libsrcdir="$$s/m4"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(BUILD_CONFIGARGS) $${srcdiroption} \
@@ -2495,36 +2398,11 @@ configure-build-texinfo:
        cd "$(BUILD_SUBDIR)/texinfo" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(BUILD_SUBDIR)/texinfo/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/texinfo "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../texinfo; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/texinfo"; \
-         libsrcdir="$$s/texinfo"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/texinfo"; \
+       libsrcdir="$$s/texinfo"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(BUILD_CONFIGARGS) $${srcdiroption} \
@@ -2559,36 +2437,11 @@ configure-build-fixincludes:
        cd "$(BUILD_SUBDIR)/fixincludes" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(BUILD_SUBDIR)/fixincludes/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/fixincludes "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../fixincludes; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/fixincludes"; \
-         libsrcdir="$$s/fixincludes"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/fixincludes"; \
+       libsrcdir="$$s/fixincludes"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(BUILD_CONFIGARGS) $${srcdiroption} \
@@ -2619,24 +2472,20 @@ maybe-configure-ash:
 @if ash
 maybe-configure-ash: configure-ash
 configure-ash:
-       @test ! -f ash/Makefile || exit 0; \
-       [ -d ash ] || mkdir ash; \
+       @test ! -f $(HOST_SUBDIR)/ash/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ash ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in ash; \
-       cd ash || exit 1; \
+       cd $(HOST_SUBDIR)/ash || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/ash"; \
-           libsrcdir="$$s/ash";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/ash"; \
-           libsrcdir="$$s/ash";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/ash/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/ash"; \
+       libsrcdir="$$s/ash"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -2652,8 +2501,8 @@ all-ash: configure-ash
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd ash && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-ash))
+       (cd $(HOST_SUBDIR)/ash && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-ash))
 @endif ash
 
 .PHONY: check-ash maybe-check-ash
@@ -2666,7 +2515,8 @@ check-ash:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd ash && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/ash && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif ash
 
@@ -2680,7 +2530,8 @@ install-ash: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd ash && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/ash && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif ash
 
@@ -2702,7 +2553,7 @@ info-ash: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in ash" ; \
-       (cd ash && \
+       (cd $(HOST_SUBDIR)/ash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -2728,7 +2579,7 @@ dvi-ash: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in ash" ; \
-       (cd ash && \
+       (cd $(HOST_SUBDIR)/ash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -2754,7 +2605,7 @@ html-ash: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in ash" ; \
-       (cd ash && \
+       (cd $(HOST_SUBDIR)/ash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -2780,7 +2631,7 @@ TAGS-ash: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in ash" ; \
-       (cd ash && \
+       (cd $(HOST_SUBDIR)/ash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -2807,7 +2658,7 @@ install-info-ash: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in ash" ; \
-       (cd ash && \
+       (cd $(HOST_SUBDIR)/ash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -2833,7 +2684,7 @@ installcheck-ash: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in ash" ; \
-       (cd ash && \
+       (cd $(HOST_SUBDIR)/ash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -2858,7 +2709,7 @@ mostlyclean-ash:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in ash" ; \
-       (cd ash && \
+       (cd $(HOST_SUBDIR)/ash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -2883,7 +2734,7 @@ clean-ash:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in ash" ; \
-       (cd ash && \
+       (cd $(HOST_SUBDIR)/ash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -2908,7 +2759,7 @@ distclean-ash:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in ash" ; \
-       (cd ash && \
+       (cd $(HOST_SUBDIR)/ash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -2933,7 +2784,7 @@ maintainer-clean-ash:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in ash" ; \
-       (cd ash && \
+       (cd $(HOST_SUBDIR)/ash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -2949,24 +2800,20 @@ maybe-configure-autoconf:
 @if autoconf
 maybe-configure-autoconf: configure-autoconf
 configure-autoconf:
-       @test ! -f autoconf/Makefile || exit 0; \
-       [ -d autoconf ] || mkdir autoconf; \
+       @test ! -f $(HOST_SUBDIR)/autoconf/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/autoconf ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in autoconf; \
-       cd autoconf || exit 1; \
+       cd $(HOST_SUBDIR)/autoconf || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/autoconf"; \
-           libsrcdir="$$s/autoconf";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/autoconf"; \
-           libsrcdir="$$s/autoconf";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/autoconf/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/autoconf"; \
+       libsrcdir="$$s/autoconf"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -2982,8 +2829,8 @@ all-autoconf: configure-autoconf
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd autoconf && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-autoconf))
+       (cd $(HOST_SUBDIR)/autoconf && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-autoconf))
 @endif autoconf
 
 .PHONY: check-autoconf maybe-check-autoconf
@@ -2996,7 +2843,8 @@ check-autoconf:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd autoconf && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/autoconf && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif autoconf
 
@@ -3010,7 +2858,8 @@ install-autoconf: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd autoconf && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/autoconf && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif autoconf
 
@@ -3032,7 +2881,7 @@ info-autoconf: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in autoconf" ; \
-       (cd autoconf && \
+       (cd $(HOST_SUBDIR)/autoconf && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3058,7 +2907,7 @@ dvi-autoconf: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in autoconf" ; \
-       (cd autoconf && \
+       (cd $(HOST_SUBDIR)/autoconf && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3084,7 +2933,7 @@ html-autoconf: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in autoconf" ; \
-       (cd autoconf && \
+       (cd $(HOST_SUBDIR)/autoconf && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3110,7 +2959,7 @@ TAGS-autoconf: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in autoconf" ; \
-       (cd autoconf && \
+       (cd $(HOST_SUBDIR)/autoconf && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3137,7 +2986,7 @@ install-info-autoconf: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in autoconf" ; \
-       (cd autoconf && \
+       (cd $(HOST_SUBDIR)/autoconf && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3163,7 +3012,7 @@ installcheck-autoconf: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in autoconf" ; \
-       (cd autoconf && \
+       (cd $(HOST_SUBDIR)/autoconf && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3188,7 +3037,7 @@ mostlyclean-autoconf:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in autoconf" ; \
-       (cd autoconf && \
+       (cd $(HOST_SUBDIR)/autoconf && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3213,7 +3062,7 @@ clean-autoconf:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in autoconf" ; \
-       (cd autoconf && \
+       (cd $(HOST_SUBDIR)/autoconf && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3238,7 +3087,7 @@ distclean-autoconf:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in autoconf" ; \
-       (cd autoconf && \
+       (cd $(HOST_SUBDIR)/autoconf && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3263,7 +3112,7 @@ maintainer-clean-autoconf:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in autoconf" ; \
-       (cd autoconf && \
+       (cd $(HOST_SUBDIR)/autoconf && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3279,24 +3128,20 @@ maybe-configure-automake:
 @if automake
 maybe-configure-automake: configure-automake
 configure-automake:
-       @test ! -f automake/Makefile || exit 0; \
-       [ -d automake ] || mkdir automake; \
+       @test ! -f $(HOST_SUBDIR)/automake/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/automake ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in automake; \
-       cd automake || exit 1; \
+       cd $(HOST_SUBDIR)/automake || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/automake"; \
-           libsrcdir="$$s/automake";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/automake"; \
-           libsrcdir="$$s/automake";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/automake/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/automake"; \
+       libsrcdir="$$s/automake"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -3312,8 +3157,8 @@ all-automake: configure-automake
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd automake && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-automake))
+       (cd $(HOST_SUBDIR)/automake && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-automake))
 @endif automake
 
 .PHONY: check-automake maybe-check-automake
@@ -3326,7 +3171,8 @@ check-automake:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd automake && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/automake && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif automake
 
@@ -3340,7 +3186,8 @@ install-automake: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd automake && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/automake && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif automake
 
@@ -3362,7 +3209,7 @@ info-automake: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in automake" ; \
-       (cd automake && \
+       (cd $(HOST_SUBDIR)/automake && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3388,7 +3235,7 @@ dvi-automake: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in automake" ; \
-       (cd automake && \
+       (cd $(HOST_SUBDIR)/automake && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3414,7 +3261,7 @@ html-automake: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in automake" ; \
-       (cd automake && \
+       (cd $(HOST_SUBDIR)/automake && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3440,7 +3287,7 @@ TAGS-automake: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in automake" ; \
-       (cd automake && \
+       (cd $(HOST_SUBDIR)/automake && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3467,7 +3314,7 @@ install-info-automake: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in automake" ; \
-       (cd automake && \
+       (cd $(HOST_SUBDIR)/automake && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3493,7 +3340,7 @@ installcheck-automake: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in automake" ; \
-       (cd automake && \
+       (cd $(HOST_SUBDIR)/automake && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3518,7 +3365,7 @@ mostlyclean-automake:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in automake" ; \
-       (cd automake && \
+       (cd $(HOST_SUBDIR)/automake && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3543,7 +3390,7 @@ clean-automake:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in automake" ; \
-       (cd automake && \
+       (cd $(HOST_SUBDIR)/automake && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3568,7 +3415,7 @@ distclean-automake:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in automake" ; \
-       (cd automake && \
+       (cd $(HOST_SUBDIR)/automake && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3593,7 +3440,7 @@ maintainer-clean-automake:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in automake" ; \
-       (cd automake && \
+       (cd $(HOST_SUBDIR)/automake && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3609,24 +3456,20 @@ maybe-configure-bash:
 @if bash
 maybe-configure-bash: configure-bash
 configure-bash:
-       @test ! -f bash/Makefile || exit 0; \
-       [ -d bash ] || mkdir bash; \
+       @test ! -f $(HOST_SUBDIR)/bash/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bash ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in bash; \
-       cd bash || exit 1; \
+       cd $(HOST_SUBDIR)/bash || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/bash"; \
-           libsrcdir="$$s/bash";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/bash"; \
-           libsrcdir="$$s/bash";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/bash/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/bash"; \
+       libsrcdir="$$s/bash"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -3642,8 +3485,8 @@ all-bash: configure-bash
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd bash && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-bash))
+       (cd $(HOST_SUBDIR)/bash && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-bash))
 @endif bash
 
 .PHONY: check-bash maybe-check-bash
@@ -3656,7 +3499,8 @@ check-bash:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd bash && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/bash && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif bash
 
@@ -3670,7 +3514,8 @@ install-bash: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd bash && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/bash && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif bash
 
@@ -3692,7 +3537,7 @@ info-bash: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in bash" ; \
-       (cd bash && \
+       (cd $(HOST_SUBDIR)/bash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3718,7 +3563,7 @@ dvi-bash: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in bash" ; \
-       (cd bash && \
+       (cd $(HOST_SUBDIR)/bash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3744,7 +3589,7 @@ html-bash: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in bash" ; \
-       (cd bash && \
+       (cd $(HOST_SUBDIR)/bash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3770,7 +3615,7 @@ TAGS-bash: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in bash" ; \
-       (cd bash && \
+       (cd $(HOST_SUBDIR)/bash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3797,7 +3642,7 @@ install-info-bash: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in bash" ; \
-       (cd bash && \
+       (cd $(HOST_SUBDIR)/bash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3823,7 +3668,7 @@ installcheck-bash: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in bash" ; \
-       (cd bash && \
+       (cd $(HOST_SUBDIR)/bash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3848,7 +3693,7 @@ mostlyclean-bash:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in bash" ; \
-       (cd bash && \
+       (cd $(HOST_SUBDIR)/bash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3873,7 +3718,7 @@ clean-bash:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in bash" ; \
-       (cd bash && \
+       (cd $(HOST_SUBDIR)/bash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3898,7 +3743,7 @@ distclean-bash:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in bash" ; \
-       (cd bash && \
+       (cd $(HOST_SUBDIR)/bash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3923,7 +3768,7 @@ maintainer-clean-bash:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in bash" ; \
-       (cd bash && \
+       (cd $(HOST_SUBDIR)/bash && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -3940,24 +3785,20 @@ maybe-configure-bfd:
 maybe-configure-bfd: configure-bfd
 configure-bfd:
        @test -f stage_last && exit 0; \
-       test ! -f bfd/Makefile || exit 0; \
-       [ -d bfd ] || mkdir bfd; \
+       test ! -f $(HOST_SUBDIR)/bfd/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bfd ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in bfd; \
-       cd bfd || exit 1; \
+       cd $(HOST_SUBDIR)/bfd || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/bfd"; \
-           libsrcdir="$$s/bfd";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/bfd"; \
-           libsrcdir="$$s/bfd";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/bfd/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/bfd"; \
+       libsrcdir="$$s/bfd"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -3974,8 +3815,8 @@ all-bfd: configure-bfd
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd bfd && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-bfd))
+       (cd $(HOST_SUBDIR)/bfd && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-bfd))
 @endif bfd
 
 .PHONY: check-bfd maybe-check-bfd
@@ -3988,7 +3829,8 @@ check-bfd:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd bfd && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/bfd && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif bfd
 
@@ -4002,7 +3844,8 @@ install-bfd: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd bfd && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/bfd && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif bfd
 
@@ -4024,7 +3867,7 @@ info-bfd: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in bfd" ; \
-       (cd bfd && \
+       (cd $(HOST_SUBDIR)/bfd && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4050,7 +3893,7 @@ dvi-bfd: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in bfd" ; \
-       (cd bfd && \
+       (cd $(HOST_SUBDIR)/bfd && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4076,7 +3919,7 @@ html-bfd: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in bfd" ; \
-       (cd bfd && \
+       (cd $(HOST_SUBDIR)/bfd && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4102,7 +3945,7 @@ TAGS-bfd: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in bfd" ; \
-       (cd bfd && \
+       (cd $(HOST_SUBDIR)/bfd && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4129,7 +3972,7 @@ install-info-bfd: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in bfd" ; \
-       (cd bfd && \
+       (cd $(HOST_SUBDIR)/bfd && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4155,7 +3998,7 @@ installcheck-bfd: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in bfd" ; \
-       (cd bfd && \
+       (cd $(HOST_SUBDIR)/bfd && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4180,7 +4023,7 @@ mostlyclean-bfd:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in bfd" ; \
-       (cd bfd && \
+       (cd $(HOST_SUBDIR)/bfd && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4205,7 +4048,7 @@ clean-bfd:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in bfd" ; \
-       (cd bfd && \
+       (cd $(HOST_SUBDIR)/bfd && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4230,7 +4073,7 @@ distclean-bfd:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in bfd" ; \
-       (cd bfd && \
+       (cd $(HOST_SUBDIR)/bfd && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4255,7 +4098,7 @@ maintainer-clean-bfd:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in bfd" ; \
-       (cd bfd && \
+       (cd $(HOST_SUBDIR)/bfd && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4272,24 +4115,20 @@ maybe-configure-opcodes:
 maybe-configure-opcodes: configure-opcodes
 configure-opcodes:
        @test -f stage_last && exit 0; \
-       test ! -f opcodes/Makefile || exit 0; \
-       [ -d opcodes ] || mkdir opcodes; \
+       test ! -f $(HOST_SUBDIR)/opcodes/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/opcodes ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in opcodes; \
-       cd opcodes || exit 1; \
+       cd $(HOST_SUBDIR)/opcodes || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/opcodes"; \
-           libsrcdir="$$s/opcodes";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/opcodes"; \
-           libsrcdir="$$s/opcodes";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/opcodes/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/opcodes"; \
+       libsrcdir="$$s/opcodes"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -4306,8 +4145,8 @@ all-opcodes: configure-opcodes
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd opcodes && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-opcodes))
+       (cd $(HOST_SUBDIR)/opcodes && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-opcodes))
 @endif opcodes
 
 .PHONY: check-opcodes maybe-check-opcodes
@@ -4320,7 +4159,8 @@ check-opcodes:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd opcodes && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/opcodes && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif opcodes
 
@@ -4334,7 +4174,8 @@ install-opcodes: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd opcodes && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/opcodes && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif opcodes
 
@@ -4356,7 +4197,7 @@ info-opcodes: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in opcodes" ; \
-       (cd opcodes && \
+       (cd $(HOST_SUBDIR)/opcodes && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4382,7 +4223,7 @@ dvi-opcodes: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in opcodes" ; \
-       (cd opcodes && \
+       (cd $(HOST_SUBDIR)/opcodes && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4408,7 +4249,7 @@ html-opcodes: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in opcodes" ; \
-       (cd opcodes && \
+       (cd $(HOST_SUBDIR)/opcodes && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4434,7 +4275,7 @@ TAGS-opcodes: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in opcodes" ; \
-       (cd opcodes && \
+       (cd $(HOST_SUBDIR)/opcodes && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4461,7 +4302,7 @@ install-info-opcodes: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in opcodes" ; \
-       (cd opcodes && \
+       (cd $(HOST_SUBDIR)/opcodes && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4487,7 +4328,7 @@ installcheck-opcodes: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in opcodes" ; \
-       (cd opcodes && \
+       (cd $(HOST_SUBDIR)/opcodes && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4512,7 +4353,7 @@ mostlyclean-opcodes:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in opcodes" ; \
-       (cd opcodes && \
+       (cd $(HOST_SUBDIR)/opcodes && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4537,7 +4378,7 @@ clean-opcodes:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in opcodes" ; \
-       (cd opcodes && \
+       (cd $(HOST_SUBDIR)/opcodes && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4562,7 +4403,7 @@ distclean-opcodes:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in opcodes" ; \
-       (cd opcodes && \
+       (cd $(HOST_SUBDIR)/opcodes && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4587,7 +4428,7 @@ maintainer-clean-opcodes:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in opcodes" ; \
-       (cd opcodes && \
+       (cd $(HOST_SUBDIR)/opcodes && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4604,24 +4445,20 @@ maybe-configure-binutils:
 maybe-configure-binutils: configure-binutils
 configure-binutils:
        @test -f stage_last && exit 0; \
-       test ! -f binutils/Makefile || exit 0; \
-       [ -d binutils ] || mkdir binutils; \
+       test ! -f $(HOST_SUBDIR)/binutils/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/binutils ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in binutils; \
-       cd binutils || exit 1; \
+       cd $(HOST_SUBDIR)/binutils || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/binutils"; \
-           libsrcdir="$$s/binutils";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/binutils"; \
-           libsrcdir="$$s/binutils";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/binutils/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/binutils"; \
+       libsrcdir="$$s/binutils"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -4638,8 +4475,8 @@ all-binutils: configure-binutils
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd binutils && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-binutils))
+       (cd $(HOST_SUBDIR)/binutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-binutils))
 @endif binutils
 
 .PHONY: check-binutils maybe-check-binutils
@@ -4652,7 +4489,8 @@ check-binutils:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd binutils && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/binutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif binutils
 
@@ -4666,7 +4504,8 @@ install-binutils: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd binutils && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/binutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif binutils
 
@@ -4688,7 +4527,7 @@ info-binutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in binutils" ; \
-       (cd binutils && \
+       (cd $(HOST_SUBDIR)/binutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4714,7 +4553,7 @@ dvi-binutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in binutils" ; \
-       (cd binutils && \
+       (cd $(HOST_SUBDIR)/binutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4740,7 +4579,7 @@ html-binutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in binutils" ; \
-       (cd binutils && \
+       (cd $(HOST_SUBDIR)/binutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4766,7 +4605,7 @@ TAGS-binutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in binutils" ; \
-       (cd binutils && \
+       (cd $(HOST_SUBDIR)/binutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4793,7 +4632,7 @@ install-info-binutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in binutils" ; \
-       (cd binutils && \
+       (cd $(HOST_SUBDIR)/binutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4819,7 +4658,7 @@ installcheck-binutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in binutils" ; \
-       (cd binutils && \
+       (cd $(HOST_SUBDIR)/binutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4844,7 +4683,7 @@ mostlyclean-binutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in binutils" ; \
-       (cd binutils && \
+       (cd $(HOST_SUBDIR)/binutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4869,7 +4708,7 @@ clean-binutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in binutils" ; \
-       (cd binutils && \
+       (cd $(HOST_SUBDIR)/binutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4894,7 +4733,7 @@ distclean-binutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in binutils" ; \
-       (cd binutils && \
+       (cd $(HOST_SUBDIR)/binutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4919,7 +4758,7 @@ maintainer-clean-binutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in binutils" ; \
-       (cd binutils && \
+       (cd $(HOST_SUBDIR)/binutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -4935,24 +4774,20 @@ maybe-configure-bison:
 @if bison
 maybe-configure-bison: configure-bison
 configure-bison:
-       @test ! -f bison/Makefile || exit 0; \
-       [ -d bison ] || mkdir bison; \
+       @test ! -f $(HOST_SUBDIR)/bison/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bison ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in bison; \
-       cd bison || exit 1; \
+       cd $(HOST_SUBDIR)/bison || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/bison"; \
-           libsrcdir="$$s/bison";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/bison"; \
-           libsrcdir="$$s/bison";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/bison/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/bison"; \
+       libsrcdir="$$s/bison"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -4968,8 +4803,8 @@ all-bison: configure-bison
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd bison && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-bison))
+       (cd $(HOST_SUBDIR)/bison && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-bison))
 @endif bison
 
 .PHONY: check-bison maybe-check-bison
@@ -4984,7 +4819,8 @@ check-bison:
          s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
          $(SET_LIB_PATH) \
          $(HOST_EXPORTS) \
-         (cd bison && $(MAKE) $(FLAGS_TO_PASS)  check); \
+         (cd $(HOST_SUBDIR)/bison && \
+           $(MAKE) $(FLAGS_TO_PASS)  check)
        fi
 
 @endif bison
@@ -4999,7 +4835,8 @@ install-bison: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd bison && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/bison && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif bison
 
@@ -5021,7 +4858,7 @@ info-bison: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in bison" ; \
-       (cd bison && \
+       (cd $(HOST_SUBDIR)/bison && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5047,7 +4884,7 @@ dvi-bison: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in bison" ; \
-       (cd bison && \
+       (cd $(HOST_SUBDIR)/bison && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5073,7 +4910,7 @@ html-bison: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in bison" ; \
-       (cd bison && \
+       (cd $(HOST_SUBDIR)/bison && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5099,7 +4936,7 @@ TAGS-bison: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in bison" ; \
-       (cd bison && \
+       (cd $(HOST_SUBDIR)/bison && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5126,7 +4963,7 @@ install-info-bison: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in bison" ; \
-       (cd bison && \
+       (cd $(HOST_SUBDIR)/bison && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5152,7 +4989,7 @@ installcheck-bison: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in bison" ; \
-       (cd bison && \
+       (cd $(HOST_SUBDIR)/bison && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5177,7 +5014,7 @@ mostlyclean-bison:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in bison" ; \
-       (cd bison && \
+       (cd $(HOST_SUBDIR)/bison && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5202,7 +5039,7 @@ clean-bison:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in bison" ; \
-       (cd bison && \
+       (cd $(HOST_SUBDIR)/bison && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5227,7 +5064,7 @@ distclean-bison:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in bison" ; \
-       (cd bison && \
+       (cd $(HOST_SUBDIR)/bison && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5252,7 +5089,7 @@ maintainer-clean-bison:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in bison" ; \
-       (cd bison && \
+       (cd $(HOST_SUBDIR)/bison && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5268,24 +5105,20 @@ maybe-configure-byacc:
 @if byacc
 maybe-configure-byacc: configure-byacc
 configure-byacc:
-       @test ! -f byacc/Makefile || exit 0; \
-       [ -d byacc ] || mkdir byacc; \
+       @test ! -f $(HOST_SUBDIR)/byacc/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/byacc ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in byacc; \
-       cd byacc || exit 1; \
+       cd $(HOST_SUBDIR)/byacc || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/byacc"; \
-           libsrcdir="$$s/byacc";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/byacc"; \
-           libsrcdir="$$s/byacc";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/byacc/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/byacc"; \
+       libsrcdir="$$s/byacc"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -5301,8 +5134,8 @@ all-byacc: configure-byacc
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd byacc && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-byacc))
+       (cd $(HOST_SUBDIR)/byacc && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-byacc))
 @endif byacc
 
 .PHONY: check-byacc maybe-check-byacc
@@ -5317,7 +5150,8 @@ check-byacc:
          s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
          $(SET_LIB_PATH) \
          $(HOST_EXPORTS) \
-         (cd byacc && $(MAKE) $(FLAGS_TO_PASS)  check); \
+         (cd $(HOST_SUBDIR)/byacc && \
+           $(MAKE) $(FLAGS_TO_PASS)  check)
        fi
 
 @endif byacc
@@ -5332,7 +5166,8 @@ install-byacc: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd byacc && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/byacc && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif byacc
 
@@ -5354,7 +5189,7 @@ info-byacc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in byacc" ; \
-       (cd byacc && \
+       (cd $(HOST_SUBDIR)/byacc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5380,7 +5215,7 @@ dvi-byacc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in byacc" ; \
-       (cd byacc && \
+       (cd $(HOST_SUBDIR)/byacc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5406,7 +5241,7 @@ html-byacc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in byacc" ; \
-       (cd byacc && \
+       (cd $(HOST_SUBDIR)/byacc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5432,7 +5267,7 @@ TAGS-byacc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in byacc" ; \
-       (cd byacc && \
+       (cd $(HOST_SUBDIR)/byacc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5459,7 +5294,7 @@ install-info-byacc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in byacc" ; \
-       (cd byacc && \
+       (cd $(HOST_SUBDIR)/byacc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5485,7 +5320,7 @@ installcheck-byacc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in byacc" ; \
-       (cd byacc && \
+       (cd $(HOST_SUBDIR)/byacc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5510,7 +5345,7 @@ mostlyclean-byacc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in byacc" ; \
-       (cd byacc && \
+       (cd $(HOST_SUBDIR)/byacc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5535,7 +5370,7 @@ clean-byacc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in byacc" ; \
-       (cd byacc && \
+       (cd $(HOST_SUBDIR)/byacc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5560,7 +5395,7 @@ distclean-byacc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in byacc" ; \
-       (cd byacc && \
+       (cd $(HOST_SUBDIR)/byacc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5585,7 +5420,7 @@ maintainer-clean-byacc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in byacc" ; \
-       (cd byacc && \
+       (cd $(HOST_SUBDIR)/byacc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5601,24 +5436,20 @@ maybe-configure-bzip2:
 @if bzip2
 maybe-configure-bzip2: configure-bzip2
 configure-bzip2:
-       @test ! -f bzip2/Makefile || exit 0; \
-       [ -d bzip2 ] || mkdir bzip2; \
+       @test ! -f $(HOST_SUBDIR)/bzip2/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bzip2 ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in bzip2; \
-       cd bzip2 || exit 1; \
+       cd $(HOST_SUBDIR)/bzip2 || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/bzip2"; \
-           libsrcdir="$$s/bzip2";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/bzip2"; \
-           libsrcdir="$$s/bzip2";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/bzip2/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/bzip2"; \
+       libsrcdir="$$s/bzip2"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -5634,8 +5465,8 @@ all-bzip2: configure-bzip2
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd bzip2 && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-bzip2))
+       (cd $(HOST_SUBDIR)/bzip2 && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-bzip2))
 @endif bzip2
 
 .PHONY: check-bzip2 maybe-check-bzip2
@@ -5648,7 +5479,8 @@ check-bzip2:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd bzip2 && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/bzip2 && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif bzip2
 
@@ -5662,7 +5494,8 @@ install-bzip2: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd bzip2 && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/bzip2 && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif bzip2
 
@@ -5684,7 +5517,7 @@ info-bzip2: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in bzip2" ; \
-       (cd bzip2 && \
+       (cd $(HOST_SUBDIR)/bzip2 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5710,7 +5543,7 @@ dvi-bzip2: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in bzip2" ; \
-       (cd bzip2 && \
+       (cd $(HOST_SUBDIR)/bzip2 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5736,7 +5569,7 @@ html-bzip2: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in bzip2" ; \
-       (cd bzip2 && \
+       (cd $(HOST_SUBDIR)/bzip2 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5762,7 +5595,7 @@ TAGS-bzip2: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in bzip2" ; \
-       (cd bzip2 && \
+       (cd $(HOST_SUBDIR)/bzip2 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5789,7 +5622,7 @@ install-info-bzip2: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in bzip2" ; \
-       (cd bzip2 && \
+       (cd $(HOST_SUBDIR)/bzip2 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5815,7 +5648,7 @@ installcheck-bzip2: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in bzip2" ; \
-       (cd bzip2 && \
+       (cd $(HOST_SUBDIR)/bzip2 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5840,7 +5673,7 @@ mostlyclean-bzip2:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in bzip2" ; \
-       (cd bzip2 && \
+       (cd $(HOST_SUBDIR)/bzip2 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5865,7 +5698,7 @@ clean-bzip2:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in bzip2" ; \
-       (cd bzip2 && \
+       (cd $(HOST_SUBDIR)/bzip2 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5890,7 +5723,7 @@ distclean-bzip2:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in bzip2" ; \
-       (cd bzip2 && \
+       (cd $(HOST_SUBDIR)/bzip2 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5915,7 +5748,7 @@ maintainer-clean-bzip2:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in bzip2" ; \
-       (cd bzip2 && \
+       (cd $(HOST_SUBDIR)/bzip2 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -5931,24 +5764,20 @@ maybe-configure-dejagnu:
 @if dejagnu
 maybe-configure-dejagnu: configure-dejagnu
 configure-dejagnu:
-       @test ! -f dejagnu/Makefile || exit 0; \
-       [ -d dejagnu ] || mkdir dejagnu; \
+       @test ! -f $(HOST_SUBDIR)/dejagnu/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/dejagnu ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in dejagnu; \
-       cd dejagnu || exit 1; \
+       cd $(HOST_SUBDIR)/dejagnu || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/dejagnu"; \
-           libsrcdir="$$s/dejagnu";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/dejagnu"; \
-           libsrcdir="$$s/dejagnu";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/dejagnu/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/dejagnu"; \
+       libsrcdir="$$s/dejagnu"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -5964,8 +5793,8 @@ all-dejagnu: configure-dejagnu
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd dejagnu && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-dejagnu))
+       (cd $(HOST_SUBDIR)/dejagnu && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-dejagnu))
 @endif dejagnu
 
 .PHONY: check-dejagnu maybe-check-dejagnu
@@ -5978,7 +5807,8 @@ check-dejagnu:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd dejagnu && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/dejagnu && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif dejagnu
 
@@ -5992,7 +5822,8 @@ install-dejagnu: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd dejagnu && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/dejagnu && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif dejagnu
 
@@ -6014,7 +5845,7 @@ info-dejagnu: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in dejagnu" ; \
-       (cd dejagnu && \
+       (cd $(HOST_SUBDIR)/dejagnu && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6040,7 +5871,7 @@ dvi-dejagnu: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in dejagnu" ; \
-       (cd dejagnu && \
+       (cd $(HOST_SUBDIR)/dejagnu && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6066,7 +5897,7 @@ html-dejagnu: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in dejagnu" ; \
-       (cd dejagnu && \
+       (cd $(HOST_SUBDIR)/dejagnu && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6092,7 +5923,7 @@ TAGS-dejagnu: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in dejagnu" ; \
-       (cd dejagnu && \
+       (cd $(HOST_SUBDIR)/dejagnu && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6119,7 +5950,7 @@ install-info-dejagnu: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in dejagnu" ; \
-       (cd dejagnu && \
+       (cd $(HOST_SUBDIR)/dejagnu && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6145,7 +5976,7 @@ installcheck-dejagnu: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in dejagnu" ; \
-       (cd dejagnu && \
+       (cd $(HOST_SUBDIR)/dejagnu && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6170,7 +6001,7 @@ mostlyclean-dejagnu:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in dejagnu" ; \
-       (cd dejagnu && \
+       (cd $(HOST_SUBDIR)/dejagnu && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6195,7 +6026,7 @@ clean-dejagnu:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in dejagnu" ; \
-       (cd dejagnu && \
+       (cd $(HOST_SUBDIR)/dejagnu && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6220,7 +6051,7 @@ distclean-dejagnu:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in dejagnu" ; \
-       (cd dejagnu && \
+       (cd $(HOST_SUBDIR)/dejagnu && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6245,7 +6076,7 @@ maintainer-clean-dejagnu:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in dejagnu" ; \
-       (cd dejagnu && \
+       (cd $(HOST_SUBDIR)/dejagnu && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6261,24 +6092,20 @@ maybe-configure-diff:
 @if diff
 maybe-configure-diff: configure-diff
 configure-diff:
-       @test ! -f diff/Makefile || exit 0; \
-       [ -d diff ] || mkdir diff; \
+       @test ! -f $(HOST_SUBDIR)/diff/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/diff ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in diff; \
-       cd diff || exit 1; \
+       cd $(HOST_SUBDIR)/diff || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/diff"; \
-           libsrcdir="$$s/diff";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/diff"; \
-           libsrcdir="$$s/diff";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/diff/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/diff"; \
+       libsrcdir="$$s/diff"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -6294,8 +6121,8 @@ all-diff: configure-diff
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd diff && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-diff))
+       (cd $(HOST_SUBDIR)/diff && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-diff))
 @endif diff
 
 .PHONY: check-diff maybe-check-diff
@@ -6308,7 +6135,8 @@ check-diff:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd diff && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/diff && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif diff
 
@@ -6322,7 +6150,8 @@ install-diff: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd diff && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/diff && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif diff
 
@@ -6344,7 +6173,7 @@ info-diff: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in diff" ; \
-       (cd diff && \
+       (cd $(HOST_SUBDIR)/diff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6370,7 +6199,7 @@ dvi-diff: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in diff" ; \
-       (cd diff && \
+       (cd $(HOST_SUBDIR)/diff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6396,7 +6225,7 @@ html-diff: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in diff" ; \
-       (cd diff && \
+       (cd $(HOST_SUBDIR)/diff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6422,7 +6251,7 @@ TAGS-diff: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in diff" ; \
-       (cd diff && \
+       (cd $(HOST_SUBDIR)/diff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6449,7 +6278,7 @@ install-info-diff: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in diff" ; \
-       (cd diff && \
+       (cd $(HOST_SUBDIR)/diff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6475,7 +6304,7 @@ installcheck-diff: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in diff" ; \
-       (cd diff && \
+       (cd $(HOST_SUBDIR)/diff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6500,7 +6329,7 @@ mostlyclean-diff:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in diff" ; \
-       (cd diff && \
+       (cd $(HOST_SUBDIR)/diff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6525,7 +6354,7 @@ clean-diff:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in diff" ; \
-       (cd diff && \
+       (cd $(HOST_SUBDIR)/diff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6550,7 +6379,7 @@ distclean-diff:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in diff" ; \
-       (cd diff && \
+       (cd $(HOST_SUBDIR)/diff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6575,7 +6404,7 @@ maintainer-clean-diff:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in diff" ; \
-       (cd diff && \
+       (cd $(HOST_SUBDIR)/diff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6591,24 +6420,20 @@ maybe-configure-dosutils:
 @if dosutils
 maybe-configure-dosutils: configure-dosutils
 configure-dosutils:
-       @test ! -f dosutils/Makefile || exit 0; \
-       [ -d dosutils ] || mkdir dosutils; \
+       @test ! -f $(HOST_SUBDIR)/dosutils/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/dosutils ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in dosutils; \
-       cd dosutils || exit 1; \
+       cd $(HOST_SUBDIR)/dosutils || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/dosutils"; \
-           libsrcdir="$$s/dosutils";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/dosutils"; \
-           libsrcdir="$$s/dosutils";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/dosutils/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/dosutils"; \
+       libsrcdir="$$s/dosutils"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -6624,8 +6449,8 @@ all-dosutils: configure-dosutils
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd dosutils && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-dosutils))
+       (cd $(HOST_SUBDIR)/dosutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-dosutils))
 @endif dosutils
 
 .PHONY: check-dosutils maybe-check-dosutils
@@ -6647,7 +6472,8 @@ install-dosutils: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd dosutils && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/dosutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif dosutils
 
@@ -6669,7 +6495,7 @@ info-dosutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in dosutils" ; \
-       (cd dosutils && \
+       (cd $(HOST_SUBDIR)/dosutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6695,7 +6521,7 @@ dvi-dosutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in dosutils" ; \
-       (cd dosutils && \
+       (cd $(HOST_SUBDIR)/dosutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6721,7 +6547,7 @@ html-dosutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in dosutils" ; \
-       (cd dosutils && \
+       (cd $(HOST_SUBDIR)/dosutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6747,7 +6573,7 @@ TAGS-dosutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in dosutils" ; \
-       (cd dosutils && \
+       (cd $(HOST_SUBDIR)/dosutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6774,7 +6600,7 @@ install-info-dosutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in dosutils" ; \
-       (cd dosutils && \
+       (cd $(HOST_SUBDIR)/dosutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6800,7 +6626,7 @@ installcheck-dosutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in dosutils" ; \
-       (cd dosutils && \
+       (cd $(HOST_SUBDIR)/dosutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6825,7 +6651,7 @@ mostlyclean-dosutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in dosutils" ; \
-       (cd dosutils && \
+       (cd $(HOST_SUBDIR)/dosutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6850,7 +6676,7 @@ clean-dosutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in dosutils" ; \
-       (cd dosutils && \
+       (cd $(HOST_SUBDIR)/dosutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6875,7 +6701,7 @@ distclean-dosutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in dosutils" ; \
-       (cd dosutils && \
+       (cd $(HOST_SUBDIR)/dosutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6900,7 +6726,7 @@ maintainer-clean-dosutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in dosutils" ; \
-       (cd dosutils && \
+       (cd $(HOST_SUBDIR)/dosutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -6916,24 +6742,20 @@ maybe-configure-etc:
 @if etc
 maybe-configure-etc: configure-etc
 configure-etc:
-       @test ! -f etc/Makefile || exit 0; \
-       [ -d etc ] || mkdir etc; \
+       @test ! -f $(HOST_SUBDIR)/etc/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/etc ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in etc; \
-       cd etc || exit 1; \
+       cd $(HOST_SUBDIR)/etc || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/etc"; \
-           libsrcdir="$$s/etc";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/etc"; \
-           libsrcdir="$$s/etc";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/etc/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/etc"; \
+       libsrcdir="$$s/etc"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -6949,8 +6771,8 @@ all-etc: configure-etc
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd etc && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-etc))
+       (cd $(HOST_SUBDIR)/etc && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-etc))
 @endif etc
 
 .PHONY: check-etc maybe-check-etc
@@ -6963,7 +6785,8 @@ check-etc:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd etc && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/etc && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif etc
 
@@ -6977,7 +6800,8 @@ install-etc: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd etc && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/etc && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif etc
 
@@ -6999,7 +6823,7 @@ info-etc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in etc" ; \
-       (cd etc && \
+       (cd $(HOST_SUBDIR)/etc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7025,7 +6849,7 @@ dvi-etc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in etc" ; \
-       (cd etc && \
+       (cd $(HOST_SUBDIR)/etc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7051,7 +6875,7 @@ html-etc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in etc" ; \
-       (cd etc && \
+       (cd $(HOST_SUBDIR)/etc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7077,7 +6901,7 @@ TAGS-etc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in etc" ; \
-       (cd etc && \
+       (cd $(HOST_SUBDIR)/etc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7104,7 +6928,7 @@ install-info-etc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in etc" ; \
-       (cd etc && \
+       (cd $(HOST_SUBDIR)/etc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7130,7 +6954,7 @@ installcheck-etc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in etc" ; \
-       (cd etc && \
+       (cd $(HOST_SUBDIR)/etc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7155,7 +6979,7 @@ mostlyclean-etc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in etc" ; \
-       (cd etc && \
+       (cd $(HOST_SUBDIR)/etc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7180,7 +7004,7 @@ clean-etc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in etc" ; \
-       (cd etc && \
+       (cd $(HOST_SUBDIR)/etc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7205,7 +7029,7 @@ distclean-etc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in etc" ; \
-       (cd etc && \
+       (cd $(HOST_SUBDIR)/etc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7230,7 +7054,7 @@ maintainer-clean-etc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in etc" ; \
-       (cd etc && \
+       (cd $(HOST_SUBDIR)/etc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7246,24 +7070,20 @@ maybe-configure-fastjar:
 @if fastjar
 maybe-configure-fastjar: configure-fastjar
 configure-fastjar:
-       @test ! -f fastjar/Makefile || exit 0; \
-       [ -d fastjar ] || mkdir fastjar; \
+       @test ! -f $(HOST_SUBDIR)/fastjar/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/fastjar ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in fastjar; \
-       cd fastjar || exit 1; \
+       cd $(HOST_SUBDIR)/fastjar || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/fastjar"; \
-           libsrcdir="$$s/fastjar";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/fastjar"; \
-           libsrcdir="$$s/fastjar";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/fastjar/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/fastjar"; \
+       libsrcdir="$$s/fastjar"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -7279,8 +7099,8 @@ all-fastjar: configure-fastjar
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd fastjar && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-fastjar))
+       (cd $(HOST_SUBDIR)/fastjar && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-fastjar))
 @endif fastjar
 
 .PHONY: check-fastjar maybe-check-fastjar
@@ -7295,7 +7115,8 @@ check-fastjar:
          s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
          $(SET_LIB_PATH) \
          $(HOST_EXPORTS) \
-         (cd fastjar && $(MAKE) $(FLAGS_TO_PASS)  check); \
+         (cd $(HOST_SUBDIR)/fastjar && \
+           $(MAKE) $(FLAGS_TO_PASS)  check)
        fi
 
 @endif fastjar
@@ -7310,7 +7131,8 @@ install-fastjar: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd fastjar && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/fastjar && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif fastjar
 
@@ -7332,7 +7154,7 @@ info-fastjar: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in fastjar" ; \
-       (cd fastjar && \
+       (cd $(HOST_SUBDIR)/fastjar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7358,7 +7180,7 @@ dvi-fastjar: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in fastjar" ; \
-       (cd fastjar && \
+       (cd $(HOST_SUBDIR)/fastjar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7384,7 +7206,7 @@ html-fastjar: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in fastjar" ; \
-       (cd fastjar && \
+       (cd $(HOST_SUBDIR)/fastjar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7410,7 +7232,7 @@ TAGS-fastjar: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in fastjar" ; \
-       (cd fastjar && \
+       (cd $(HOST_SUBDIR)/fastjar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7437,7 +7259,7 @@ install-info-fastjar: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in fastjar" ; \
-       (cd fastjar && \
+       (cd $(HOST_SUBDIR)/fastjar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7463,7 +7285,7 @@ installcheck-fastjar: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in fastjar" ; \
-       (cd fastjar && \
+       (cd $(HOST_SUBDIR)/fastjar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7488,7 +7310,7 @@ mostlyclean-fastjar:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in fastjar" ; \
-       (cd fastjar && \
+       (cd $(HOST_SUBDIR)/fastjar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7513,7 +7335,7 @@ clean-fastjar:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in fastjar" ; \
-       (cd fastjar && \
+       (cd $(HOST_SUBDIR)/fastjar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7538,7 +7360,7 @@ distclean-fastjar:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in fastjar" ; \
-       (cd fastjar && \
+       (cd $(HOST_SUBDIR)/fastjar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7563,7 +7385,7 @@ maintainer-clean-fastjar:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in fastjar" ; \
-       (cd fastjar && \
+       (cd $(HOST_SUBDIR)/fastjar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7579,24 +7401,20 @@ maybe-configure-fileutils:
 @if fileutils
 maybe-configure-fileutils: configure-fileutils
 configure-fileutils:
-       @test ! -f fileutils/Makefile || exit 0; \
-       [ -d fileutils ] || mkdir fileutils; \
+       @test ! -f $(HOST_SUBDIR)/fileutils/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/fileutils ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in fileutils; \
-       cd fileutils || exit 1; \
+       cd $(HOST_SUBDIR)/fileutils || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/fileutils"; \
-           libsrcdir="$$s/fileutils";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/fileutils"; \
-           libsrcdir="$$s/fileutils";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/fileutils/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/fileutils"; \
+       libsrcdir="$$s/fileutils"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -7612,8 +7430,8 @@ all-fileutils: configure-fileutils
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd fileutils && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-fileutils))
+       (cd $(HOST_SUBDIR)/fileutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-fileutils))
 @endif fileutils
 
 .PHONY: check-fileutils maybe-check-fileutils
@@ -7626,7 +7444,8 @@ check-fileutils:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd fileutils && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/fileutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif fileutils
 
@@ -7640,7 +7459,8 @@ install-fileutils: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd fileutils && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/fileutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif fileutils
 
@@ -7662,7 +7482,7 @@ info-fileutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in fileutils" ; \
-       (cd fileutils && \
+       (cd $(HOST_SUBDIR)/fileutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7688,7 +7508,7 @@ dvi-fileutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in fileutils" ; \
-       (cd fileutils && \
+       (cd $(HOST_SUBDIR)/fileutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7714,7 +7534,7 @@ html-fileutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in fileutils" ; \
-       (cd fileutils && \
+       (cd $(HOST_SUBDIR)/fileutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7740,7 +7560,7 @@ TAGS-fileutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in fileutils" ; \
-       (cd fileutils && \
+       (cd $(HOST_SUBDIR)/fileutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7767,7 +7587,7 @@ install-info-fileutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in fileutils" ; \
-       (cd fileutils && \
+       (cd $(HOST_SUBDIR)/fileutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7793,7 +7613,7 @@ installcheck-fileutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in fileutils" ; \
-       (cd fileutils && \
+       (cd $(HOST_SUBDIR)/fileutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7818,7 +7638,7 @@ mostlyclean-fileutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in fileutils" ; \
-       (cd fileutils && \
+       (cd $(HOST_SUBDIR)/fileutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7843,7 +7663,7 @@ clean-fileutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in fileutils" ; \
-       (cd fileutils && \
+       (cd $(HOST_SUBDIR)/fileutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7868,7 +7688,7 @@ distclean-fileutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in fileutils" ; \
-       (cd fileutils && \
+       (cd $(HOST_SUBDIR)/fileutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7893,7 +7713,7 @@ maintainer-clean-fileutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in fileutils" ; \
-       (cd fileutils && \
+       (cd $(HOST_SUBDIR)/fileutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -7909,24 +7729,20 @@ maybe-configure-findutils:
 @if findutils
 maybe-configure-findutils: configure-findutils
 configure-findutils:
-       @test ! -f findutils/Makefile || exit 0; \
-       [ -d findutils ] || mkdir findutils; \
+       @test ! -f $(HOST_SUBDIR)/findutils/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/findutils ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in findutils; \
-       cd findutils || exit 1; \
+       cd $(HOST_SUBDIR)/findutils || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/findutils"; \
-           libsrcdir="$$s/findutils";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/findutils"; \
-           libsrcdir="$$s/findutils";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/findutils/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/findutils"; \
+       libsrcdir="$$s/findutils"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -7942,8 +7758,8 @@ all-findutils: configure-findutils
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd findutils && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-findutils))
+       (cd $(HOST_SUBDIR)/findutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-findutils))
 @endif findutils
 
 .PHONY: check-findutils maybe-check-findutils
@@ -7956,7 +7772,8 @@ check-findutils:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd findutils && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/findutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif findutils
 
@@ -7970,7 +7787,8 @@ install-findutils: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd findutils && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/findutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif findutils
 
@@ -7992,7 +7810,7 @@ info-findutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in findutils" ; \
-       (cd findutils && \
+       (cd $(HOST_SUBDIR)/findutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8018,7 +7836,7 @@ dvi-findutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in findutils" ; \
-       (cd findutils && \
+       (cd $(HOST_SUBDIR)/findutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8044,7 +7862,7 @@ html-findutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in findutils" ; \
-       (cd findutils && \
+       (cd $(HOST_SUBDIR)/findutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8070,7 +7888,7 @@ TAGS-findutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in findutils" ; \
-       (cd findutils && \
+       (cd $(HOST_SUBDIR)/findutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8097,7 +7915,7 @@ install-info-findutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in findutils" ; \
-       (cd findutils && \
+       (cd $(HOST_SUBDIR)/findutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8123,7 +7941,7 @@ installcheck-findutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in findutils" ; \
-       (cd findutils && \
+       (cd $(HOST_SUBDIR)/findutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8148,7 +7966,7 @@ mostlyclean-findutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in findutils" ; \
-       (cd findutils && \
+       (cd $(HOST_SUBDIR)/findutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8173,7 +7991,7 @@ clean-findutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in findutils" ; \
-       (cd findutils && \
+       (cd $(HOST_SUBDIR)/findutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8198,7 +8016,7 @@ distclean-findutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in findutils" ; \
-       (cd findutils && \
+       (cd $(HOST_SUBDIR)/findutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8223,7 +8041,7 @@ maintainer-clean-findutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in findutils" ; \
-       (cd findutils && \
+       (cd $(HOST_SUBDIR)/findutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8239,24 +8057,20 @@ maybe-configure-find:
 @if find
 maybe-configure-find: configure-find
 configure-find:
-       @test ! -f find/Makefile || exit 0; \
-       [ -d find ] || mkdir find; \
+       @test ! -f $(HOST_SUBDIR)/find/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/find ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in find; \
-       cd find || exit 1; \
+       cd $(HOST_SUBDIR)/find || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/find"; \
-           libsrcdir="$$s/find";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/find"; \
-           libsrcdir="$$s/find";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/find/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/find"; \
+       libsrcdir="$$s/find"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -8272,8 +8086,8 @@ all-find: configure-find
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd find && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-find))
+       (cd $(HOST_SUBDIR)/find && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-find))
 @endif find
 
 .PHONY: check-find maybe-check-find
@@ -8286,7 +8100,8 @@ check-find:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd find && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/find && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif find
 
@@ -8300,7 +8115,8 @@ install-find: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd find && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/find && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif find
 
@@ -8322,7 +8138,7 @@ info-find: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in find" ; \
-       (cd find && \
+       (cd $(HOST_SUBDIR)/find && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8348,7 +8164,7 @@ dvi-find: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in find" ; \
-       (cd find && \
+       (cd $(HOST_SUBDIR)/find && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8374,7 +8190,7 @@ html-find: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in find" ; \
-       (cd find && \
+       (cd $(HOST_SUBDIR)/find && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8400,7 +8216,7 @@ TAGS-find: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in find" ; \
-       (cd find && \
+       (cd $(HOST_SUBDIR)/find && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8427,7 +8243,7 @@ install-info-find: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in find" ; \
-       (cd find && \
+       (cd $(HOST_SUBDIR)/find && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8453,7 +8269,7 @@ installcheck-find: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in find" ; \
-       (cd find && \
+       (cd $(HOST_SUBDIR)/find && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8478,7 +8294,7 @@ mostlyclean-find:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in find" ; \
-       (cd find && \
+       (cd $(HOST_SUBDIR)/find && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8503,7 +8319,7 @@ clean-find:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in find" ; \
-       (cd find && \
+       (cd $(HOST_SUBDIR)/find && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8528,7 +8344,7 @@ distclean-find:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in find" ; \
-       (cd find && \
+       (cd $(HOST_SUBDIR)/find && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8553,7 +8369,7 @@ maintainer-clean-find:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in find" ; \
-       (cd find && \
+       (cd $(HOST_SUBDIR)/find && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8569,24 +8385,20 @@ maybe-configure-fixincludes:
 @if fixincludes
 maybe-configure-fixincludes: configure-fixincludes
 configure-fixincludes:
-       @test ! -f fixincludes/Makefile || exit 0; \
-       [ -d fixincludes ] || mkdir fixincludes; \
+       @test ! -f $(HOST_SUBDIR)/fixincludes/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/fixincludes ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in fixincludes; \
-       cd fixincludes || exit 1; \
+       cd $(HOST_SUBDIR)/fixincludes || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/fixincludes"; \
-           libsrcdir="$$s/fixincludes";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/fixincludes"; \
-           libsrcdir="$$s/fixincludes";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/fixincludes/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/fixincludes"; \
+       libsrcdir="$$s/fixincludes"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -8602,8 +8414,8 @@ all-fixincludes: configure-fixincludes
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd fixincludes && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-fixincludes))
+       (cd $(HOST_SUBDIR)/fixincludes && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-fixincludes))
 @endif fixincludes
 
 .PHONY: check-fixincludes maybe-check-fixincludes
@@ -8616,7 +8428,8 @@ check-fixincludes:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd fixincludes && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/fixincludes && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif fixincludes
 
@@ -8630,7 +8443,8 @@ install-fixincludes: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd fixincludes && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/fixincludes && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif fixincludes
 
@@ -8672,7 +8486,7 @@ html-fixincludes: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in fixincludes" ; \
-       (cd fixincludes && \
+       (cd $(HOST_SUBDIR)/fixincludes && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8727,7 +8541,7 @@ mostlyclean-fixincludes:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in fixincludes" ; \
-       (cd fixincludes && \
+       (cd $(HOST_SUBDIR)/fixincludes && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8752,7 +8566,7 @@ clean-fixincludes:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in fixincludes" ; \
-       (cd fixincludes && \
+       (cd $(HOST_SUBDIR)/fixincludes && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8777,7 +8591,7 @@ distclean-fixincludes:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in fixincludes" ; \
-       (cd fixincludes && \
+       (cd $(HOST_SUBDIR)/fixincludes && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8802,7 +8616,7 @@ maintainer-clean-fixincludes:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in fixincludes" ; \
-       (cd fixincludes && \
+       (cd $(HOST_SUBDIR)/fixincludes && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8818,24 +8632,20 @@ maybe-configure-flex:
 @if flex
 maybe-configure-flex: configure-flex
 configure-flex:
-       @test ! -f flex/Makefile || exit 0; \
-       [ -d flex ] || mkdir flex; \
+       @test ! -f $(HOST_SUBDIR)/flex/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/flex ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in flex; \
-       cd flex || exit 1; \
+       cd $(HOST_SUBDIR)/flex || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/flex"; \
-           libsrcdir="$$s/flex";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/flex"; \
-           libsrcdir="$$s/flex";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/flex/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/flex"; \
+       libsrcdir="$$s/flex"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -8851,8 +8661,8 @@ all-flex: configure-flex
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd flex && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-flex))
+       (cd $(HOST_SUBDIR)/flex && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-flex))
 @endif flex
 
 .PHONY: check-flex maybe-check-flex
@@ -8867,7 +8677,8 @@ check-flex:
          s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
          $(SET_LIB_PATH) \
          $(HOST_EXPORTS) \
-         (cd flex && $(MAKE) $(FLAGS_TO_PASS)  check); \
+         (cd $(HOST_SUBDIR)/flex && \
+           $(MAKE) $(FLAGS_TO_PASS)  check)
        fi
 
 @endif flex
@@ -8882,7 +8693,8 @@ install-flex: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd flex && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/flex && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif flex
 
@@ -8904,7 +8716,7 @@ info-flex: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in flex" ; \
-       (cd flex && \
+       (cd $(HOST_SUBDIR)/flex && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8930,7 +8742,7 @@ dvi-flex: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in flex" ; \
-       (cd flex && \
+       (cd $(HOST_SUBDIR)/flex && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8956,7 +8768,7 @@ html-flex: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in flex" ; \
-       (cd flex && \
+       (cd $(HOST_SUBDIR)/flex && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -8982,7 +8794,7 @@ TAGS-flex: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in flex" ; \
-       (cd flex && \
+       (cd $(HOST_SUBDIR)/flex && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9009,7 +8821,7 @@ install-info-flex: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in flex" ; \
-       (cd flex && \
+       (cd $(HOST_SUBDIR)/flex && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9035,7 +8847,7 @@ installcheck-flex: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in flex" ; \
-       (cd flex && \
+       (cd $(HOST_SUBDIR)/flex && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9060,7 +8872,7 @@ mostlyclean-flex:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in flex" ; \
-       (cd flex && \
+       (cd $(HOST_SUBDIR)/flex && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9085,7 +8897,7 @@ clean-flex:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in flex" ; \
-       (cd flex && \
+       (cd $(HOST_SUBDIR)/flex && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9110,7 +8922,7 @@ distclean-flex:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in flex" ; \
-       (cd flex && \
+       (cd $(HOST_SUBDIR)/flex && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9135,7 +8947,7 @@ maintainer-clean-flex:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in flex" ; \
-       (cd flex && \
+       (cd $(HOST_SUBDIR)/flex && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9152,24 +8964,20 @@ maybe-configure-gas:
 maybe-configure-gas: configure-gas
 configure-gas:
        @test -f stage_last && exit 0; \
-       test ! -f gas/Makefile || exit 0; \
-       [ -d gas ] || mkdir gas; \
+       test ! -f $(HOST_SUBDIR)/gas/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gas ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in gas; \
-       cd gas || exit 1; \
+       cd $(HOST_SUBDIR)/gas || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gas"; \
-           libsrcdir="$$s/gas";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gas"; \
-           libsrcdir="$$s/gas";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gas/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gas"; \
+       libsrcdir="$$s/gas"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -9186,8 +8994,8 @@ all-gas: configure-gas
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gas && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-gas))
+       (cd $(HOST_SUBDIR)/gas && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-gas))
 @endif gas
 
 .PHONY: check-gas maybe-check-gas
@@ -9200,7 +9008,8 @@ check-gas:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gas && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/gas && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif gas
 
@@ -9214,7 +9023,8 @@ install-gas: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gas && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/gas && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif gas
 
@@ -9236,7 +9046,7 @@ info-gas: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in gas" ; \
-       (cd gas && \
+       (cd $(HOST_SUBDIR)/gas && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9262,7 +9072,7 @@ dvi-gas: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in gas" ; \
-       (cd gas && \
+       (cd $(HOST_SUBDIR)/gas && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9288,7 +9098,7 @@ html-gas: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in gas" ; \
-       (cd gas && \
+       (cd $(HOST_SUBDIR)/gas && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9314,7 +9124,7 @@ TAGS-gas: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in gas" ; \
-       (cd gas && \
+       (cd $(HOST_SUBDIR)/gas && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9341,7 +9151,7 @@ install-info-gas: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in gas" ; \
-       (cd gas && \
+       (cd $(HOST_SUBDIR)/gas && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9367,7 +9177,7 @@ installcheck-gas: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in gas" ; \
-       (cd gas && \
+       (cd $(HOST_SUBDIR)/gas && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9392,7 +9202,7 @@ mostlyclean-gas:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in gas" ; \
-       (cd gas && \
+       (cd $(HOST_SUBDIR)/gas && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9417,7 +9227,7 @@ clean-gas:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in gas" ; \
-       (cd gas && \
+       (cd $(HOST_SUBDIR)/gas && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9442,7 +9252,7 @@ distclean-gas:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in gas" ; \
-       (cd gas && \
+       (cd $(HOST_SUBDIR)/gas && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9467,7 +9277,7 @@ maintainer-clean-gas:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in gas" ; \
-       (cd gas && \
+       (cd $(HOST_SUBDIR)/gas && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9484,24 +9294,20 @@ maybe-configure-gcc:
 maybe-configure-gcc: configure-gcc
 configure-gcc:
        @test -f stage_last && exit 0; \
-       test ! -f gcc/Makefile || exit 0; \
-       [ -d gcc ] || mkdir gcc; \
+       test ! -f $(HOST_SUBDIR)/gcc/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gcc ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in gcc; \
-       cd gcc || exit 1; \
+       cd $(HOST_SUBDIR)/gcc || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gcc"; \
-           libsrcdir="$$s/gcc";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gcc"; \
-           libsrcdir="$$s/gcc";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gcc/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gcc"; \
+       libsrcdir="$$s/gcc"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -9518,8 +9324,8 @@ all-gcc: configure-gcc
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gcc && $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) \
-         $(TARGET-gcc))
+       (cd $(HOST_SUBDIR)/gcc && \
+         $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(TARGET-gcc))
 @endif gcc
 
 .PHONY: check-gcc maybe-check-gcc
@@ -9532,7 +9338,8 @@ check-gcc:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gcc && $(MAKE) $(FLAGS_TO_PASS)$(EXTRA_GCC_FLAGS) check)
+       (cd $(HOST_SUBDIR)/gcc && \
+         $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) check)
 
 @endif gcc
 
@@ -9546,7 +9353,8 @@ install-gcc: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gcc && $(MAKE) $(FLAGS_TO_PASS)$(EXTRA_GCC_FLAGS) install)
+       (cd $(HOST_SUBDIR)/gcc && \
+         $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) install)
 
 @endif gcc
 
@@ -9568,7 +9376,7 @@ info-gcc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in gcc" ; \
-       (cd gcc && \
+       (cd $(HOST_SUBDIR)/gcc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9594,7 +9402,7 @@ dvi-gcc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in gcc" ; \
-       (cd gcc && \
+       (cd $(HOST_SUBDIR)/gcc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9620,7 +9428,7 @@ html-gcc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in gcc" ; \
-       (cd gcc && \
+       (cd $(HOST_SUBDIR)/gcc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9646,7 +9454,7 @@ TAGS-gcc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in gcc" ; \
-       (cd gcc && \
+       (cd $(HOST_SUBDIR)/gcc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9673,7 +9481,7 @@ install-info-gcc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in gcc" ; \
-       (cd gcc && \
+       (cd $(HOST_SUBDIR)/gcc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9699,7 +9507,7 @@ installcheck-gcc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in gcc" ; \
-       (cd gcc && \
+       (cd $(HOST_SUBDIR)/gcc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9724,7 +9532,7 @@ mostlyclean-gcc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in gcc" ; \
-       (cd gcc && \
+       (cd $(HOST_SUBDIR)/gcc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9749,7 +9557,7 @@ clean-gcc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in gcc" ; \
-       (cd gcc && \
+       (cd $(HOST_SUBDIR)/gcc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9774,7 +9582,7 @@ distclean-gcc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in gcc" ; \
-       (cd gcc && \
+       (cd $(HOST_SUBDIR)/gcc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9799,7 +9607,7 @@ maintainer-clean-gcc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in gcc" ; \
-       (cd gcc && \
+       (cd $(HOST_SUBDIR)/gcc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9815,24 +9623,20 @@ maybe-configure-gawk:
 @if gawk
 maybe-configure-gawk: configure-gawk
 configure-gawk:
-       @test ! -f gawk/Makefile || exit 0; \
-       [ -d gawk ] || mkdir gawk; \
+       @test ! -f $(HOST_SUBDIR)/gawk/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gawk ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in gawk; \
-       cd gawk || exit 1; \
+       cd $(HOST_SUBDIR)/gawk || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gawk"; \
-           libsrcdir="$$s/gawk";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gawk"; \
-           libsrcdir="$$s/gawk";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gawk/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gawk"; \
+       libsrcdir="$$s/gawk"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -9848,8 +9652,8 @@ all-gawk: configure-gawk
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gawk && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-gawk))
+       (cd $(HOST_SUBDIR)/gawk && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-gawk))
 @endif gawk
 
 .PHONY: check-gawk maybe-check-gawk
@@ -9862,7 +9666,8 @@ check-gawk:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gawk && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/gawk && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif gawk
 
@@ -9876,7 +9681,8 @@ install-gawk: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gawk && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/gawk && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif gawk
 
@@ -9898,7 +9704,7 @@ info-gawk: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in gawk" ; \
-       (cd gawk && \
+       (cd $(HOST_SUBDIR)/gawk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9924,7 +9730,7 @@ dvi-gawk: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in gawk" ; \
-       (cd gawk && \
+       (cd $(HOST_SUBDIR)/gawk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9950,7 +9756,7 @@ html-gawk: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in gawk" ; \
-       (cd gawk && \
+       (cd $(HOST_SUBDIR)/gawk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -9976,7 +9782,7 @@ TAGS-gawk: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in gawk" ; \
-       (cd gawk && \
+       (cd $(HOST_SUBDIR)/gawk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10003,7 +9809,7 @@ install-info-gawk: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in gawk" ; \
-       (cd gawk && \
+       (cd $(HOST_SUBDIR)/gawk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10029,7 +9835,7 @@ installcheck-gawk: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in gawk" ; \
-       (cd gawk && \
+       (cd $(HOST_SUBDIR)/gawk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10054,7 +9860,7 @@ mostlyclean-gawk:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in gawk" ; \
-       (cd gawk && \
+       (cd $(HOST_SUBDIR)/gawk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10079,7 +9885,7 @@ clean-gawk:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in gawk" ; \
-       (cd gawk && \
+       (cd $(HOST_SUBDIR)/gawk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10104,7 +9910,7 @@ distclean-gawk:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in gawk" ; \
-       (cd gawk && \
+       (cd $(HOST_SUBDIR)/gawk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10129,7 +9935,7 @@ maintainer-clean-gawk:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in gawk" ; \
-       (cd gawk && \
+       (cd $(HOST_SUBDIR)/gawk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10145,24 +9951,20 @@ maybe-configure-gettext:
 @if gettext
 maybe-configure-gettext: configure-gettext
 configure-gettext:
-       @test ! -f gettext/Makefile || exit 0; \
-       [ -d gettext ] || mkdir gettext; \
+       @test ! -f $(HOST_SUBDIR)/gettext/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gettext ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in gettext; \
-       cd gettext || exit 1; \
+       cd $(HOST_SUBDIR)/gettext || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gettext"; \
-           libsrcdir="$$s/gettext";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gettext"; \
-           libsrcdir="$$s/gettext";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gettext/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gettext"; \
+       libsrcdir="$$s/gettext"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -10178,8 +9980,8 @@ all-gettext: configure-gettext
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gettext && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-gettext))
+       (cd $(HOST_SUBDIR)/gettext && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-gettext))
 @endif gettext
 
 .PHONY: check-gettext maybe-check-gettext
@@ -10192,7 +9994,8 @@ check-gettext:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gettext && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/gettext && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif gettext
 
@@ -10206,7 +10009,8 @@ install-gettext: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gettext && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/gettext && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif gettext
 
@@ -10228,7 +10032,7 @@ info-gettext: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in gettext" ; \
-       (cd gettext && \
+       (cd $(HOST_SUBDIR)/gettext && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10254,7 +10058,7 @@ dvi-gettext: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in gettext" ; \
-       (cd gettext && \
+       (cd $(HOST_SUBDIR)/gettext && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10280,7 +10084,7 @@ html-gettext: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in gettext" ; \
-       (cd gettext && \
+       (cd $(HOST_SUBDIR)/gettext && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10306,7 +10110,7 @@ TAGS-gettext: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in gettext" ; \
-       (cd gettext && \
+       (cd $(HOST_SUBDIR)/gettext && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10333,7 +10137,7 @@ install-info-gettext: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in gettext" ; \
-       (cd gettext && \
+       (cd $(HOST_SUBDIR)/gettext && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10359,7 +10163,7 @@ installcheck-gettext: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in gettext" ; \
-       (cd gettext && \
+       (cd $(HOST_SUBDIR)/gettext && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10384,7 +10188,7 @@ mostlyclean-gettext:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in gettext" ; \
-       (cd gettext && \
+       (cd $(HOST_SUBDIR)/gettext && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10409,7 +10213,7 @@ clean-gettext:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in gettext" ; \
-       (cd gettext && \
+       (cd $(HOST_SUBDIR)/gettext && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10434,7 +10238,7 @@ distclean-gettext:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in gettext" ; \
-       (cd gettext && \
+       (cd $(HOST_SUBDIR)/gettext && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10459,7 +10263,7 @@ maintainer-clean-gettext:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in gettext" ; \
-       (cd gettext && \
+       (cd $(HOST_SUBDIR)/gettext && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10475,24 +10279,20 @@ maybe-configure-gnuserv:
 @if gnuserv
 maybe-configure-gnuserv: configure-gnuserv
 configure-gnuserv:
-       @test ! -f gnuserv/Makefile || exit 0; \
-       [ -d gnuserv ] || mkdir gnuserv; \
+       @test ! -f $(HOST_SUBDIR)/gnuserv/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gnuserv ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in gnuserv; \
-       cd gnuserv || exit 1; \
+       cd $(HOST_SUBDIR)/gnuserv || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gnuserv"; \
-           libsrcdir="$$s/gnuserv";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gnuserv"; \
-           libsrcdir="$$s/gnuserv";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gnuserv/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gnuserv"; \
+       libsrcdir="$$s/gnuserv"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -10508,8 +10308,8 @@ all-gnuserv: configure-gnuserv
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gnuserv && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-gnuserv))
+       (cd $(HOST_SUBDIR)/gnuserv && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-gnuserv))
 @endif gnuserv
 
 .PHONY: check-gnuserv maybe-check-gnuserv
@@ -10522,7 +10322,8 @@ check-gnuserv:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gnuserv && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/gnuserv && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif gnuserv
 
@@ -10536,7 +10337,8 @@ install-gnuserv: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gnuserv && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/gnuserv && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif gnuserv
 
@@ -10558,7 +10360,7 @@ info-gnuserv: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in gnuserv" ; \
-       (cd gnuserv && \
+       (cd $(HOST_SUBDIR)/gnuserv && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10584,7 +10386,7 @@ dvi-gnuserv: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in gnuserv" ; \
-       (cd gnuserv && \
+       (cd $(HOST_SUBDIR)/gnuserv && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10610,7 +10412,7 @@ html-gnuserv: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in gnuserv" ; \
-       (cd gnuserv && \
+       (cd $(HOST_SUBDIR)/gnuserv && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10636,7 +10438,7 @@ TAGS-gnuserv: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in gnuserv" ; \
-       (cd gnuserv && \
+       (cd $(HOST_SUBDIR)/gnuserv && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10663,7 +10465,7 @@ install-info-gnuserv: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in gnuserv" ; \
-       (cd gnuserv && \
+       (cd $(HOST_SUBDIR)/gnuserv && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10689,7 +10491,7 @@ installcheck-gnuserv: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in gnuserv" ; \
-       (cd gnuserv && \
+       (cd $(HOST_SUBDIR)/gnuserv && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10714,7 +10516,7 @@ mostlyclean-gnuserv:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in gnuserv" ; \
-       (cd gnuserv && \
+       (cd $(HOST_SUBDIR)/gnuserv && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10739,7 +10541,7 @@ clean-gnuserv:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in gnuserv" ; \
-       (cd gnuserv && \
+       (cd $(HOST_SUBDIR)/gnuserv && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10764,7 +10566,7 @@ distclean-gnuserv:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in gnuserv" ; \
-       (cd gnuserv && \
+       (cd $(HOST_SUBDIR)/gnuserv && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10789,7 +10591,7 @@ maintainer-clean-gnuserv:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in gnuserv" ; \
-       (cd gnuserv && \
+       (cd $(HOST_SUBDIR)/gnuserv && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10805,24 +10607,20 @@ maybe-configure-gprof:
 @if gprof
 maybe-configure-gprof: configure-gprof
 configure-gprof:
-       @test ! -f gprof/Makefile || exit 0; \
-       [ -d gprof ] || mkdir gprof; \
+       @test ! -f $(HOST_SUBDIR)/gprof/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gprof ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in gprof; \
-       cd gprof || exit 1; \
+       cd $(HOST_SUBDIR)/gprof || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gprof"; \
-           libsrcdir="$$s/gprof";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gprof"; \
-           libsrcdir="$$s/gprof";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gprof/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gprof"; \
+       libsrcdir="$$s/gprof"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -10838,8 +10636,8 @@ all-gprof: configure-gprof
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gprof && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-gprof))
+       (cd $(HOST_SUBDIR)/gprof && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-gprof))
 @endif gprof
 
 .PHONY: check-gprof maybe-check-gprof
@@ -10852,7 +10650,8 @@ check-gprof:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gprof && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/gprof && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif gprof
 
@@ -10866,7 +10665,8 @@ install-gprof: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gprof && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/gprof && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif gprof
 
@@ -10888,7 +10688,7 @@ info-gprof: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in gprof" ; \
-       (cd gprof && \
+       (cd $(HOST_SUBDIR)/gprof && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10914,7 +10714,7 @@ dvi-gprof: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in gprof" ; \
-       (cd gprof && \
+       (cd $(HOST_SUBDIR)/gprof && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10940,7 +10740,7 @@ html-gprof: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in gprof" ; \
-       (cd gprof && \
+       (cd $(HOST_SUBDIR)/gprof && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10966,7 +10766,7 @@ TAGS-gprof: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in gprof" ; \
-       (cd gprof && \
+       (cd $(HOST_SUBDIR)/gprof && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -10993,7 +10793,7 @@ install-info-gprof: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in gprof" ; \
-       (cd gprof && \
+       (cd $(HOST_SUBDIR)/gprof && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11019,7 +10819,7 @@ installcheck-gprof: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in gprof" ; \
-       (cd gprof && \
+       (cd $(HOST_SUBDIR)/gprof && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11044,7 +10844,7 @@ mostlyclean-gprof:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in gprof" ; \
-       (cd gprof && \
+       (cd $(HOST_SUBDIR)/gprof && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11069,7 +10869,7 @@ clean-gprof:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in gprof" ; \
-       (cd gprof && \
+       (cd $(HOST_SUBDIR)/gprof && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11094,7 +10894,7 @@ distclean-gprof:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in gprof" ; \
-       (cd gprof && \
+       (cd $(HOST_SUBDIR)/gprof && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11119,7 +10919,7 @@ maintainer-clean-gprof:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in gprof" ; \
-       (cd gprof && \
+       (cd $(HOST_SUBDIR)/gprof && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11135,24 +10935,20 @@ maybe-configure-gzip:
 @if gzip
 maybe-configure-gzip: configure-gzip
 configure-gzip:
-       @test ! -f gzip/Makefile || exit 0; \
-       [ -d gzip ] || mkdir gzip; \
+       @test ! -f $(HOST_SUBDIR)/gzip/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gzip ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in gzip; \
-       cd gzip || exit 1; \
+       cd $(HOST_SUBDIR)/gzip || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gzip"; \
-           libsrcdir="$$s/gzip";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gzip"; \
-           libsrcdir="$$s/gzip";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gzip/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gzip"; \
+       libsrcdir="$$s/gzip"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -11168,8 +10964,8 @@ all-gzip: configure-gzip
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gzip && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-gzip))
+       (cd $(HOST_SUBDIR)/gzip && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-gzip))
 @endif gzip
 
 .PHONY: check-gzip maybe-check-gzip
@@ -11182,7 +10978,8 @@ check-gzip:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gzip && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/gzip && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif gzip
 
@@ -11196,7 +10993,8 @@ install-gzip: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gzip && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/gzip && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif gzip
 
@@ -11218,7 +11016,7 @@ info-gzip: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in gzip" ; \
-       (cd gzip && \
+       (cd $(HOST_SUBDIR)/gzip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11244,7 +11042,7 @@ dvi-gzip: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in gzip" ; \
-       (cd gzip && \
+       (cd $(HOST_SUBDIR)/gzip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11270,7 +11068,7 @@ html-gzip: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in gzip" ; \
-       (cd gzip && \
+       (cd $(HOST_SUBDIR)/gzip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11296,7 +11094,7 @@ TAGS-gzip: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in gzip" ; \
-       (cd gzip && \
+       (cd $(HOST_SUBDIR)/gzip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11323,7 +11121,7 @@ install-info-gzip: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in gzip" ; \
-       (cd gzip && \
+       (cd $(HOST_SUBDIR)/gzip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11349,7 +11147,7 @@ installcheck-gzip: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in gzip" ; \
-       (cd gzip && \
+       (cd $(HOST_SUBDIR)/gzip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11374,7 +11172,7 @@ mostlyclean-gzip:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in gzip" ; \
-       (cd gzip && \
+       (cd $(HOST_SUBDIR)/gzip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11399,7 +11197,7 @@ clean-gzip:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in gzip" ; \
-       (cd gzip && \
+       (cd $(HOST_SUBDIR)/gzip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11424,7 +11222,7 @@ distclean-gzip:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in gzip" ; \
-       (cd gzip && \
+       (cd $(HOST_SUBDIR)/gzip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11449,7 +11247,7 @@ maintainer-clean-gzip:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in gzip" ; \
-       (cd gzip && \
+       (cd $(HOST_SUBDIR)/gzip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11465,24 +11263,20 @@ maybe-configure-hello:
 @if hello
 maybe-configure-hello: configure-hello
 configure-hello:
-       @test ! -f hello/Makefile || exit 0; \
-       [ -d hello ] || mkdir hello; \
+       @test ! -f $(HOST_SUBDIR)/hello/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/hello ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in hello; \
-       cd hello || exit 1; \
+       cd $(HOST_SUBDIR)/hello || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/hello"; \
-           libsrcdir="$$s/hello";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/hello"; \
-           libsrcdir="$$s/hello";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/hello/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/hello"; \
+       libsrcdir="$$s/hello"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -11498,8 +11292,8 @@ all-hello: configure-hello
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd hello && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-hello))
+       (cd $(HOST_SUBDIR)/hello && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-hello))
 @endif hello
 
 .PHONY: check-hello maybe-check-hello
@@ -11512,7 +11306,8 @@ check-hello:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd hello && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/hello && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif hello
 
@@ -11526,7 +11321,8 @@ install-hello: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd hello && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/hello && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif hello
 
@@ -11548,7 +11344,7 @@ info-hello: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in hello" ; \
-       (cd hello && \
+       (cd $(HOST_SUBDIR)/hello && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11574,7 +11370,7 @@ dvi-hello: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in hello" ; \
-       (cd hello && \
+       (cd $(HOST_SUBDIR)/hello && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11600,7 +11396,7 @@ html-hello: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in hello" ; \
-       (cd hello && \
+       (cd $(HOST_SUBDIR)/hello && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11626,7 +11422,7 @@ TAGS-hello: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in hello" ; \
-       (cd hello && \
+       (cd $(HOST_SUBDIR)/hello && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11653,7 +11449,7 @@ install-info-hello: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in hello" ; \
-       (cd hello && \
+       (cd $(HOST_SUBDIR)/hello && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11679,7 +11475,7 @@ installcheck-hello: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in hello" ; \
-       (cd hello && \
+       (cd $(HOST_SUBDIR)/hello && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11704,7 +11500,7 @@ mostlyclean-hello:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in hello" ; \
-       (cd hello && \
+       (cd $(HOST_SUBDIR)/hello && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11729,7 +11525,7 @@ clean-hello:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in hello" ; \
-       (cd hello && \
+       (cd $(HOST_SUBDIR)/hello && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11754,7 +11550,7 @@ distclean-hello:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in hello" ; \
-       (cd hello && \
+       (cd $(HOST_SUBDIR)/hello && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11779,7 +11575,7 @@ maintainer-clean-hello:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in hello" ; \
-       (cd hello && \
+       (cd $(HOST_SUBDIR)/hello && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11795,24 +11591,20 @@ maybe-configure-indent:
 @if indent
 maybe-configure-indent: configure-indent
 configure-indent:
-       @test ! -f indent/Makefile || exit 0; \
-       [ -d indent ] || mkdir indent; \
+       @test ! -f $(HOST_SUBDIR)/indent/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/indent ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in indent; \
-       cd indent || exit 1; \
+       cd $(HOST_SUBDIR)/indent || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/indent"; \
-           libsrcdir="$$s/indent";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/indent"; \
-           libsrcdir="$$s/indent";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/indent/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/indent"; \
+       libsrcdir="$$s/indent"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -11828,8 +11620,8 @@ all-indent: configure-indent
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd indent && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-indent))
+       (cd $(HOST_SUBDIR)/indent && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-indent))
 @endif indent
 
 .PHONY: check-indent maybe-check-indent
@@ -11842,7 +11634,8 @@ check-indent:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd indent && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/indent && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif indent
 
@@ -11856,7 +11649,8 @@ install-indent: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd indent && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/indent && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif indent
 
@@ -11878,7 +11672,7 @@ info-indent: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in indent" ; \
-       (cd indent && \
+       (cd $(HOST_SUBDIR)/indent && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11904,7 +11698,7 @@ dvi-indent: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in indent" ; \
-       (cd indent && \
+       (cd $(HOST_SUBDIR)/indent && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11930,7 +11724,7 @@ html-indent: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in indent" ; \
-       (cd indent && \
+       (cd $(HOST_SUBDIR)/indent && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11956,7 +11750,7 @@ TAGS-indent: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in indent" ; \
-       (cd indent && \
+       (cd $(HOST_SUBDIR)/indent && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -11983,7 +11777,7 @@ install-info-indent: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in indent" ; \
-       (cd indent && \
+       (cd $(HOST_SUBDIR)/indent && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12009,7 +11803,7 @@ installcheck-indent: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in indent" ; \
-       (cd indent && \
+       (cd $(HOST_SUBDIR)/indent && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12034,7 +11828,7 @@ mostlyclean-indent:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in indent" ; \
-       (cd indent && \
+       (cd $(HOST_SUBDIR)/indent && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12059,7 +11853,7 @@ clean-indent:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in indent" ; \
-       (cd indent && \
+       (cd $(HOST_SUBDIR)/indent && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12084,7 +11878,7 @@ distclean-indent:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in indent" ; \
-       (cd indent && \
+       (cd $(HOST_SUBDIR)/indent && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12109,7 +11903,7 @@ maintainer-clean-indent:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in indent" ; \
-       (cd indent && \
+       (cd $(HOST_SUBDIR)/indent && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12126,24 +11920,20 @@ maybe-configure-intl:
 maybe-configure-intl: configure-intl
 configure-intl:
        @test -f stage_last && exit 0; \
-       test ! -f intl/Makefile || exit 0; \
-       [ -d intl ] || mkdir intl; \
+       test ! -f $(HOST_SUBDIR)/intl/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/intl ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in intl; \
-       cd intl || exit 1; \
+       cd $(HOST_SUBDIR)/intl || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/intl"; \
-           libsrcdir="$$s/intl";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/intl"; \
-           libsrcdir="$$s/intl";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/intl/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/intl"; \
+       libsrcdir="$$s/intl"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -12160,8 +11950,8 @@ all-intl: configure-intl
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd intl && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-intl))
+       (cd $(HOST_SUBDIR)/intl && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-intl))
 @endif intl
 
 .PHONY: check-intl maybe-check-intl
@@ -12174,7 +11964,8 @@ check-intl:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd intl && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/intl && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif intl
 
@@ -12188,7 +11979,8 @@ install-intl: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd intl && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/intl && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif intl
 
@@ -12210,7 +12002,7 @@ info-intl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in intl" ; \
-       (cd intl && \
+       (cd $(HOST_SUBDIR)/intl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12236,7 +12028,7 @@ dvi-intl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in intl" ; \
-       (cd intl && \
+       (cd $(HOST_SUBDIR)/intl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12262,7 +12054,7 @@ html-intl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in intl" ; \
-       (cd intl && \
+       (cd $(HOST_SUBDIR)/intl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12288,7 +12080,7 @@ TAGS-intl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in intl" ; \
-       (cd intl && \
+       (cd $(HOST_SUBDIR)/intl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12315,7 +12107,7 @@ install-info-intl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in intl" ; \
-       (cd intl && \
+       (cd $(HOST_SUBDIR)/intl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12341,7 +12133,7 @@ installcheck-intl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in intl" ; \
-       (cd intl && \
+       (cd $(HOST_SUBDIR)/intl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12366,7 +12158,7 @@ mostlyclean-intl:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in intl" ; \
-       (cd intl && \
+       (cd $(HOST_SUBDIR)/intl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12391,7 +12183,7 @@ clean-intl:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in intl" ; \
-       (cd intl && \
+       (cd $(HOST_SUBDIR)/intl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12416,7 +12208,7 @@ distclean-intl:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in intl" ; \
-       (cd intl && \
+       (cd $(HOST_SUBDIR)/intl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12441,7 +12233,7 @@ maintainer-clean-intl:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in intl" ; \
-       (cd intl && \
+       (cd $(HOST_SUBDIR)/intl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12457,24 +12249,20 @@ maybe-configure-tcl:
 @if tcl
 maybe-configure-tcl: configure-tcl
 configure-tcl:
-       @test ! -f tcl/Makefile || exit 0; \
-       [ -d tcl ] || mkdir tcl; \
+       @test ! -f $(HOST_SUBDIR)/tcl/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/tcl ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in tcl; \
-       cd tcl || exit 1; \
+       cd $(HOST_SUBDIR)/tcl || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/tcl"; \
-           libsrcdir="$$s/tcl";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/tcl"; \
-           libsrcdir="$$s/tcl";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/tcl/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/tcl"; \
+       libsrcdir="$$s/tcl"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -12490,8 +12278,8 @@ all-tcl: configure-tcl
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd tcl && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-tcl))
+       (cd $(HOST_SUBDIR)/tcl && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-tcl))
 @endif tcl
 
 .PHONY: check-tcl maybe-check-tcl
@@ -12504,7 +12292,8 @@ check-tcl:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd tcl && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/tcl && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif tcl
 
@@ -12518,7 +12307,8 @@ install-tcl: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd tcl && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/tcl && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif tcl
 
@@ -12540,7 +12330,7 @@ info-tcl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in tcl" ; \
-       (cd tcl && \
+       (cd $(HOST_SUBDIR)/tcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12566,7 +12356,7 @@ dvi-tcl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in tcl" ; \
-       (cd tcl && \
+       (cd $(HOST_SUBDIR)/tcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12592,7 +12382,7 @@ html-tcl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in tcl" ; \
-       (cd tcl && \
+       (cd $(HOST_SUBDIR)/tcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12618,7 +12408,7 @@ TAGS-tcl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in tcl" ; \
-       (cd tcl && \
+       (cd $(HOST_SUBDIR)/tcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12645,7 +12435,7 @@ install-info-tcl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in tcl" ; \
-       (cd tcl && \
+       (cd $(HOST_SUBDIR)/tcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12671,7 +12461,7 @@ installcheck-tcl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in tcl" ; \
-       (cd tcl && \
+       (cd $(HOST_SUBDIR)/tcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12706,7 +12496,7 @@ clean-tcl:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in tcl" ; \
-       (cd tcl && \
+       (cd $(HOST_SUBDIR)/tcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12731,7 +12521,7 @@ distclean-tcl:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in tcl" ; \
-       (cd tcl && \
+       (cd $(HOST_SUBDIR)/tcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12756,7 +12546,7 @@ maintainer-clean-tcl:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in tcl" ; \
-       (cd tcl && \
+       (cd $(HOST_SUBDIR)/tcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12772,24 +12562,20 @@ maybe-configure-itcl:
 @if itcl
 maybe-configure-itcl: configure-itcl
 configure-itcl:
-       @test ! -f itcl/Makefile || exit 0; \
-       [ -d itcl ] || mkdir itcl; \
+       @test ! -f $(HOST_SUBDIR)/itcl/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/itcl ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in itcl; \
-       cd itcl || exit 1; \
+       cd $(HOST_SUBDIR)/itcl || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/itcl"; \
-           libsrcdir="$$s/itcl";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/itcl"; \
-           libsrcdir="$$s/itcl";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/itcl/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/itcl"; \
+       libsrcdir="$$s/itcl"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -12805,8 +12591,8 @@ all-itcl: configure-itcl
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd itcl && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-itcl))
+       (cd $(HOST_SUBDIR)/itcl && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-itcl))
 @endif itcl
 
 .PHONY: check-itcl maybe-check-itcl
@@ -12819,7 +12605,8 @@ check-itcl:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd itcl && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/itcl && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif itcl
 
@@ -12833,7 +12620,8 @@ install-itcl: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd itcl && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/itcl && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif itcl
 
@@ -12855,7 +12643,7 @@ info-itcl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in itcl" ; \
-       (cd itcl && \
+       (cd $(HOST_SUBDIR)/itcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12881,7 +12669,7 @@ dvi-itcl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in itcl" ; \
-       (cd itcl && \
+       (cd $(HOST_SUBDIR)/itcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12907,7 +12695,7 @@ html-itcl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in itcl" ; \
-       (cd itcl && \
+       (cd $(HOST_SUBDIR)/itcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12933,7 +12721,7 @@ TAGS-itcl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in itcl" ; \
-       (cd itcl && \
+       (cd $(HOST_SUBDIR)/itcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12960,7 +12748,7 @@ install-info-itcl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in itcl" ; \
-       (cd itcl && \
+       (cd $(HOST_SUBDIR)/itcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -12986,7 +12774,7 @@ installcheck-itcl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in itcl" ; \
-       (cd itcl && \
+       (cd $(HOST_SUBDIR)/itcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13011,7 +12799,7 @@ mostlyclean-itcl:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in itcl" ; \
-       (cd itcl && \
+       (cd $(HOST_SUBDIR)/itcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13036,7 +12824,7 @@ clean-itcl:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in itcl" ; \
-       (cd itcl && \
+       (cd $(HOST_SUBDIR)/itcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13061,7 +12849,7 @@ distclean-itcl:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in itcl" ; \
-       (cd itcl && \
+       (cd $(HOST_SUBDIR)/itcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13086,7 +12874,7 @@ maintainer-clean-itcl:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in itcl" ; \
-       (cd itcl && \
+       (cd $(HOST_SUBDIR)/itcl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13103,24 +12891,20 @@ maybe-configure-ld:
 maybe-configure-ld: configure-ld
 configure-ld:
        @test -f stage_last && exit 0; \
-       test ! -f ld/Makefile || exit 0; \
-       [ -d ld ] || mkdir ld; \
+       test ! -f $(HOST_SUBDIR)/ld/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ld ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in ld; \
-       cd ld || exit 1; \
+       cd $(HOST_SUBDIR)/ld || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/ld"; \
-           libsrcdir="$$s/ld";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/ld"; \
-           libsrcdir="$$s/ld";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/ld/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/ld"; \
+       libsrcdir="$$s/ld"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -13137,8 +12921,8 @@ all-ld: configure-ld
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd ld && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-ld))
+       (cd $(HOST_SUBDIR)/ld && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-ld))
 @endif ld
 
 .PHONY: check-ld maybe-check-ld
@@ -13151,7 +12935,8 @@ check-ld:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd ld && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/ld && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif ld
 
@@ -13165,7 +12950,8 @@ install-ld: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd ld && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/ld && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif ld
 
@@ -13187,7 +12973,7 @@ info-ld: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in ld" ; \
-       (cd ld && \
+       (cd $(HOST_SUBDIR)/ld && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13213,7 +12999,7 @@ dvi-ld: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in ld" ; \
-       (cd ld && \
+       (cd $(HOST_SUBDIR)/ld && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13239,7 +13025,7 @@ html-ld: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in ld" ; \
-       (cd ld && \
+       (cd $(HOST_SUBDIR)/ld && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13265,7 +13051,7 @@ TAGS-ld: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in ld" ; \
-       (cd ld && \
+       (cd $(HOST_SUBDIR)/ld && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13292,7 +13078,7 @@ install-info-ld: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in ld" ; \
-       (cd ld && \
+       (cd $(HOST_SUBDIR)/ld && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13318,7 +13104,7 @@ installcheck-ld: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in ld" ; \
-       (cd ld && \
+       (cd $(HOST_SUBDIR)/ld && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13343,7 +13129,7 @@ mostlyclean-ld:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in ld" ; \
-       (cd ld && \
+       (cd $(HOST_SUBDIR)/ld && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13368,7 +13154,7 @@ clean-ld:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in ld" ; \
-       (cd ld && \
+       (cd $(HOST_SUBDIR)/ld && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13393,7 +13179,7 @@ distclean-ld:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in ld" ; \
-       (cd ld && \
+       (cd $(HOST_SUBDIR)/ld && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13418,7 +13204,7 @@ maintainer-clean-ld:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in ld" ; \
-       (cd ld && \
+       (cd $(HOST_SUBDIR)/ld && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13435,24 +13221,20 @@ maybe-configure-libcpp:
 maybe-configure-libcpp: configure-libcpp
 configure-libcpp:
        @test -f stage_last && exit 0; \
-       test ! -f libcpp/Makefile || exit 0; \
-       [ -d libcpp ] || mkdir libcpp; \
+       test ! -f $(HOST_SUBDIR)/libcpp/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcpp ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in libcpp; \
-       cd libcpp || exit 1; \
+       cd $(HOST_SUBDIR)/libcpp || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libcpp"; \
-           libsrcdir="$$s/libcpp";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libcpp"; \
-           libsrcdir="$$s/libcpp";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libcpp/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libcpp"; \
+       libsrcdir="$$s/libcpp"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -13469,8 +13251,8 @@ all-libcpp: configure-libcpp
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd libcpp && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-libcpp))
+       (cd $(HOST_SUBDIR)/libcpp && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-libcpp))
 @endif libcpp
 
 .PHONY: check-libcpp maybe-check-libcpp
@@ -13483,7 +13265,8 @@ check-libcpp:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd libcpp && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/libcpp && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif libcpp
 
@@ -13497,7 +13280,8 @@ install-libcpp: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd libcpp && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/libcpp && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif libcpp
 
@@ -13519,7 +13303,7 @@ info-libcpp: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in libcpp" ; \
-       (cd libcpp && \
+       (cd $(HOST_SUBDIR)/libcpp && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13545,7 +13329,7 @@ dvi-libcpp: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in libcpp" ; \
-       (cd libcpp && \
+       (cd $(HOST_SUBDIR)/libcpp && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13571,7 +13355,7 @@ html-libcpp: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in libcpp" ; \
-       (cd libcpp && \
+       (cd $(HOST_SUBDIR)/libcpp && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13597,7 +13381,7 @@ TAGS-libcpp: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in libcpp" ; \
-       (cd libcpp && \
+       (cd $(HOST_SUBDIR)/libcpp && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13624,7 +13408,7 @@ install-info-libcpp: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in libcpp" ; \
-       (cd libcpp && \
+       (cd $(HOST_SUBDIR)/libcpp && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13650,7 +13434,7 @@ installcheck-libcpp: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in libcpp" ; \
-       (cd libcpp && \
+       (cd $(HOST_SUBDIR)/libcpp && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13675,7 +13459,7 @@ mostlyclean-libcpp:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in libcpp" ; \
-       (cd libcpp && \
+       (cd $(HOST_SUBDIR)/libcpp && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13700,7 +13484,7 @@ clean-libcpp:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in libcpp" ; \
-       (cd libcpp && \
+       (cd $(HOST_SUBDIR)/libcpp && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13725,7 +13509,7 @@ distclean-libcpp:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in libcpp" ; \
-       (cd libcpp && \
+       (cd $(HOST_SUBDIR)/libcpp && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13750,7 +13534,7 @@ maintainer-clean-libcpp:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in libcpp" ; \
-       (cd libcpp && \
+       (cd $(HOST_SUBDIR)/libcpp && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13766,24 +13550,20 @@ maybe-configure-libgui:
 @if libgui
 maybe-configure-libgui: configure-libgui
 configure-libgui:
-       @test ! -f libgui/Makefile || exit 0; \
-       [ -d libgui ] || mkdir libgui; \
+       @test ! -f $(HOST_SUBDIR)/libgui/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libgui ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in libgui; \
-       cd libgui || exit 1; \
+       cd $(HOST_SUBDIR)/libgui || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libgui"; \
-           libsrcdir="$$s/libgui";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libgui"; \
-           libsrcdir="$$s/libgui";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libgui/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libgui"; \
+       libsrcdir="$$s/libgui"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -13799,8 +13579,8 @@ all-libgui: configure-libgui
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd libgui && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-libgui))
+       (cd $(HOST_SUBDIR)/libgui && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-libgui))
 @endif libgui
 
 .PHONY: check-libgui maybe-check-libgui
@@ -13813,7 +13593,8 @@ check-libgui:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd libgui && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/libgui && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif libgui
 
@@ -13827,7 +13608,8 @@ install-libgui: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd libgui && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/libgui && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif libgui
 
@@ -13849,7 +13631,7 @@ info-libgui: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in libgui" ; \
-       (cd libgui && \
+       (cd $(HOST_SUBDIR)/libgui && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13875,7 +13657,7 @@ dvi-libgui: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in libgui" ; \
-       (cd libgui && \
+       (cd $(HOST_SUBDIR)/libgui && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13901,7 +13683,7 @@ html-libgui: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in libgui" ; \
-       (cd libgui && \
+       (cd $(HOST_SUBDIR)/libgui && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13927,7 +13709,7 @@ TAGS-libgui: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in libgui" ; \
-       (cd libgui && \
+       (cd $(HOST_SUBDIR)/libgui && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13954,7 +13736,7 @@ install-info-libgui: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in libgui" ; \
-       (cd libgui && \
+       (cd $(HOST_SUBDIR)/libgui && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -13980,7 +13762,7 @@ installcheck-libgui: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in libgui" ; \
-       (cd libgui && \
+       (cd $(HOST_SUBDIR)/libgui && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14005,7 +13787,7 @@ mostlyclean-libgui:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in libgui" ; \
-       (cd libgui && \
+       (cd $(HOST_SUBDIR)/libgui && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14030,7 +13812,7 @@ clean-libgui:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in libgui" ; \
-       (cd libgui && \
+       (cd $(HOST_SUBDIR)/libgui && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14055,7 +13837,7 @@ distclean-libgui:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in libgui" ; \
-       (cd libgui && \
+       (cd $(HOST_SUBDIR)/libgui && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14080,7 +13862,7 @@ maintainer-clean-libgui:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in libgui" ; \
-       (cd libgui && \
+       (cd $(HOST_SUBDIR)/libgui && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14097,24 +13879,20 @@ maybe-configure-libiberty:
 maybe-configure-libiberty: configure-libiberty
 configure-libiberty:
        @test -f stage_last && exit 0; \
-       test ! -f libiberty/Makefile || exit 0; \
-       [ -d libiberty ] || mkdir libiberty; \
+       test ! -f $(HOST_SUBDIR)/libiberty/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in libiberty; \
-       cd libiberty || exit 1; \
+       cd $(HOST_SUBDIR)/libiberty || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libiberty"; \
-           libsrcdir="$$s/libiberty";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libiberty"; \
-           libsrcdir="$$s/libiberty";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libiberty/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libiberty"; \
+       libsrcdir="$$s/libiberty"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -14131,8 +13909,8 @@ all-libiberty: configure-libiberty
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd libiberty && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-libiberty))
+       (cd $(HOST_SUBDIR)/libiberty && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-libiberty))
 @endif libiberty
 
 .PHONY: check-libiberty maybe-check-libiberty
@@ -14145,7 +13923,8 @@ check-libiberty:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd libiberty && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/libiberty && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif libiberty
 
@@ -14159,7 +13938,8 @@ install-libiberty: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd libiberty && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/libiberty && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif libiberty
 
@@ -14181,7 +13961,7 @@ info-libiberty: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in libiberty" ; \
-       (cd libiberty && \
+       (cd $(HOST_SUBDIR)/libiberty && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14207,7 +13987,7 @@ dvi-libiberty: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in libiberty" ; \
-       (cd libiberty && \
+       (cd $(HOST_SUBDIR)/libiberty && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14233,7 +14013,7 @@ html-libiberty: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in libiberty" ; \
-       (cd libiberty && \
+       (cd $(HOST_SUBDIR)/libiberty && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14259,7 +14039,7 @@ TAGS-libiberty: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in libiberty" ; \
-       (cd libiberty && \
+       (cd $(HOST_SUBDIR)/libiberty && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14286,7 +14066,7 @@ install-info-libiberty: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in libiberty" ; \
-       (cd libiberty && \
+       (cd $(HOST_SUBDIR)/libiberty && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14312,7 +14092,7 @@ installcheck-libiberty: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in libiberty" ; \
-       (cd libiberty && \
+       (cd $(HOST_SUBDIR)/libiberty && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14337,7 +14117,7 @@ mostlyclean-libiberty:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in libiberty" ; \
-       (cd libiberty && \
+       (cd $(HOST_SUBDIR)/libiberty && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14362,7 +14142,7 @@ clean-libiberty:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in libiberty" ; \
-       (cd libiberty && \
+       (cd $(HOST_SUBDIR)/libiberty && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14387,7 +14167,7 @@ distclean-libiberty:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in libiberty" ; \
-       (cd libiberty && \
+       (cd $(HOST_SUBDIR)/libiberty && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14412,7 +14192,7 @@ maintainer-clean-libiberty:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in libiberty" ; \
-       (cd libiberty && \
+       (cd $(HOST_SUBDIR)/libiberty && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14428,24 +14208,20 @@ maybe-configure-libtool:
 @if libtool
 maybe-configure-libtool: configure-libtool
 configure-libtool:
-       @test ! -f libtool/Makefile || exit 0; \
-       [ -d libtool ] || mkdir libtool; \
+       @test ! -f $(HOST_SUBDIR)/libtool/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libtool ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in libtool; \
-       cd libtool || exit 1; \
+       cd $(HOST_SUBDIR)/libtool || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libtool"; \
-           libsrcdir="$$s/libtool";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libtool"; \
-           libsrcdir="$$s/libtool";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libtool/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libtool"; \
+       libsrcdir="$$s/libtool"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -14461,8 +14237,8 @@ all-libtool: configure-libtool
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd libtool && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-libtool))
+       (cd $(HOST_SUBDIR)/libtool && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-libtool))
 @endif libtool
 
 .PHONY: check-libtool maybe-check-libtool
@@ -14475,7 +14251,8 @@ check-libtool:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd libtool && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/libtool && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif libtool
 
@@ -14489,7 +14266,8 @@ install-libtool: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd libtool && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/libtool && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif libtool
 
@@ -14511,7 +14289,7 @@ info-libtool: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in libtool" ; \
-       (cd libtool && \
+       (cd $(HOST_SUBDIR)/libtool && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14537,7 +14315,7 @@ dvi-libtool: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in libtool" ; \
-       (cd libtool && \
+       (cd $(HOST_SUBDIR)/libtool && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14563,7 +14341,7 @@ html-libtool: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in libtool" ; \
-       (cd libtool && \
+       (cd $(HOST_SUBDIR)/libtool && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14589,7 +14367,7 @@ TAGS-libtool: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in libtool" ; \
-       (cd libtool && \
+       (cd $(HOST_SUBDIR)/libtool && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14616,7 +14394,7 @@ install-info-libtool: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in libtool" ; \
-       (cd libtool && \
+       (cd $(HOST_SUBDIR)/libtool && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14642,7 +14420,7 @@ installcheck-libtool: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in libtool" ; \
-       (cd libtool && \
+       (cd $(HOST_SUBDIR)/libtool && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14667,7 +14445,7 @@ mostlyclean-libtool:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in libtool" ; \
-       (cd libtool && \
+       (cd $(HOST_SUBDIR)/libtool && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14692,7 +14470,7 @@ clean-libtool:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in libtool" ; \
-       (cd libtool && \
+       (cd $(HOST_SUBDIR)/libtool && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14717,7 +14495,7 @@ distclean-libtool:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in libtool" ; \
-       (cd libtool && \
+       (cd $(HOST_SUBDIR)/libtool && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14742,7 +14520,7 @@ maintainer-clean-libtool:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in libtool" ; \
-       (cd libtool && \
+       (cd $(HOST_SUBDIR)/libtool && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14758,24 +14536,20 @@ maybe-configure-m4:
 @if m4
 maybe-configure-m4: configure-m4
 configure-m4:
-       @test ! -f m4/Makefile || exit 0; \
-       [ -d m4 ] || mkdir m4; \
+       @test ! -f $(HOST_SUBDIR)/m4/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/m4 ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in m4; \
-       cd m4 || exit 1; \
+       cd $(HOST_SUBDIR)/m4 || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/m4"; \
-           libsrcdir="$$s/m4";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/m4"; \
-           libsrcdir="$$s/m4";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/m4/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/m4"; \
+       libsrcdir="$$s/m4"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -14791,8 +14565,8 @@ all-m4: configure-m4
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd m4 && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-m4))
+       (cd $(HOST_SUBDIR)/m4 && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-m4))
 @endif m4
 
 .PHONY: check-m4 maybe-check-m4
@@ -14805,7 +14579,8 @@ check-m4:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd m4 && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/m4 && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif m4
 
@@ -14819,7 +14594,8 @@ install-m4: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd m4 && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/m4 && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif m4
 
@@ -14841,7 +14617,7 @@ info-m4: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in m4" ; \
-       (cd m4 && \
+       (cd $(HOST_SUBDIR)/m4 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14867,7 +14643,7 @@ dvi-m4: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in m4" ; \
-       (cd m4 && \
+       (cd $(HOST_SUBDIR)/m4 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14893,7 +14669,7 @@ html-m4: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in m4" ; \
-       (cd m4 && \
+       (cd $(HOST_SUBDIR)/m4 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14919,7 +14695,7 @@ TAGS-m4: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in m4" ; \
-       (cd m4 && \
+       (cd $(HOST_SUBDIR)/m4 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14946,7 +14722,7 @@ install-info-m4: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in m4" ; \
-       (cd m4 && \
+       (cd $(HOST_SUBDIR)/m4 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14972,7 +14748,7 @@ installcheck-m4: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in m4" ; \
-       (cd m4 && \
+       (cd $(HOST_SUBDIR)/m4 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -14997,7 +14773,7 @@ mostlyclean-m4:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in m4" ; \
-       (cd m4 && \
+       (cd $(HOST_SUBDIR)/m4 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15022,7 +14798,7 @@ clean-m4:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in m4" ; \
-       (cd m4 && \
+       (cd $(HOST_SUBDIR)/m4 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15047,7 +14823,7 @@ distclean-m4:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in m4" ; \
-       (cd m4 && \
+       (cd $(HOST_SUBDIR)/m4 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15072,7 +14848,7 @@ maintainer-clean-m4:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in m4" ; \
-       (cd m4 && \
+       (cd $(HOST_SUBDIR)/m4 && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15088,24 +14864,20 @@ maybe-configure-make:
 @if make
 maybe-configure-make: configure-make
 configure-make:
-       @test ! -f make/Makefile || exit 0; \
-       [ -d make ] || mkdir make; \
+       @test ! -f $(HOST_SUBDIR)/make/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/make ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in make; \
-       cd make || exit 1; \
+       cd $(HOST_SUBDIR)/make || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/make"; \
-           libsrcdir="$$s/make";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/make"; \
-           libsrcdir="$$s/make";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/make/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/make"; \
+       libsrcdir="$$s/make"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -15121,8 +14893,8 @@ all-make: configure-make
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd make && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-make))
+       (cd $(HOST_SUBDIR)/make && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-make))
 @endif make
 
 .PHONY: check-make maybe-check-make
@@ -15135,7 +14907,8 @@ check-make:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd make && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/make && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif make
 
@@ -15149,7 +14922,8 @@ install-make: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd make && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/make && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif make
 
@@ -15171,7 +14945,7 @@ info-make: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in make" ; \
-       (cd make && \
+       (cd $(HOST_SUBDIR)/make && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15197,7 +14971,7 @@ dvi-make: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in make" ; \
-       (cd make && \
+       (cd $(HOST_SUBDIR)/make && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15223,7 +14997,7 @@ html-make: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in make" ; \
-       (cd make && \
+       (cd $(HOST_SUBDIR)/make && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15249,7 +15023,7 @@ TAGS-make: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in make" ; \
-       (cd make && \
+       (cd $(HOST_SUBDIR)/make && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15276,7 +15050,7 @@ install-info-make: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in make" ; \
-       (cd make && \
+       (cd $(HOST_SUBDIR)/make && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15302,7 +15076,7 @@ installcheck-make: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in make" ; \
-       (cd make && \
+       (cd $(HOST_SUBDIR)/make && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15327,7 +15101,7 @@ mostlyclean-make:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in make" ; \
-       (cd make && \
+       (cd $(HOST_SUBDIR)/make && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15352,7 +15126,7 @@ clean-make:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in make" ; \
-       (cd make && \
+       (cd $(HOST_SUBDIR)/make && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15377,7 +15151,7 @@ distclean-make:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in make" ; \
-       (cd make && \
+       (cd $(HOST_SUBDIR)/make && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15402,7 +15176,7 @@ maintainer-clean-make:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in make" ; \
-       (cd make && \
+       (cd $(HOST_SUBDIR)/make && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15418,24 +15192,20 @@ maybe-configure-mmalloc:
 @if mmalloc
 maybe-configure-mmalloc: configure-mmalloc
 configure-mmalloc:
-       @test ! -f mmalloc/Makefile || exit 0; \
-       [ -d mmalloc ] || mkdir mmalloc; \
+       @test ! -f $(HOST_SUBDIR)/mmalloc/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/mmalloc ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in mmalloc; \
-       cd mmalloc || exit 1; \
+       cd $(HOST_SUBDIR)/mmalloc || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/mmalloc"; \
-           libsrcdir="$$s/mmalloc";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/mmalloc"; \
-           libsrcdir="$$s/mmalloc";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/mmalloc/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/mmalloc"; \
+       libsrcdir="$$s/mmalloc"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -15451,8 +15221,8 @@ all-mmalloc: configure-mmalloc
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd mmalloc && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-mmalloc))
+       (cd $(HOST_SUBDIR)/mmalloc && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-mmalloc))
 @endif mmalloc
 
 .PHONY: check-mmalloc maybe-check-mmalloc
@@ -15474,7 +15244,8 @@ install-mmalloc: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd mmalloc && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/mmalloc && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif mmalloc
 
@@ -15496,7 +15267,7 @@ info-mmalloc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in mmalloc" ; \
-       (cd mmalloc && \
+       (cd $(HOST_SUBDIR)/mmalloc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15522,7 +15293,7 @@ dvi-mmalloc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in mmalloc" ; \
-       (cd mmalloc && \
+       (cd $(HOST_SUBDIR)/mmalloc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15548,7 +15319,7 @@ html-mmalloc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in mmalloc" ; \
-       (cd mmalloc && \
+       (cd $(HOST_SUBDIR)/mmalloc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15574,7 +15345,7 @@ TAGS-mmalloc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in mmalloc" ; \
-       (cd mmalloc && \
+       (cd $(HOST_SUBDIR)/mmalloc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15601,7 +15372,7 @@ install-info-mmalloc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in mmalloc" ; \
-       (cd mmalloc && \
+       (cd $(HOST_SUBDIR)/mmalloc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15627,7 +15398,7 @@ installcheck-mmalloc: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in mmalloc" ; \
-       (cd mmalloc && \
+       (cd $(HOST_SUBDIR)/mmalloc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15652,7 +15423,7 @@ mostlyclean-mmalloc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in mmalloc" ; \
-       (cd mmalloc && \
+       (cd $(HOST_SUBDIR)/mmalloc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15677,7 +15448,7 @@ clean-mmalloc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in mmalloc" ; \
-       (cd mmalloc && \
+       (cd $(HOST_SUBDIR)/mmalloc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15702,7 +15473,7 @@ distclean-mmalloc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in mmalloc" ; \
-       (cd mmalloc && \
+       (cd $(HOST_SUBDIR)/mmalloc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15727,7 +15498,7 @@ maintainer-clean-mmalloc:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in mmalloc" ; \
-       (cd mmalloc && \
+       (cd $(HOST_SUBDIR)/mmalloc && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15743,24 +15514,20 @@ maybe-configure-patch:
 @if patch
 maybe-configure-patch: configure-patch
 configure-patch:
-       @test ! -f patch/Makefile || exit 0; \
-       [ -d patch ] || mkdir patch; \
+       @test ! -f $(HOST_SUBDIR)/patch/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/patch ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in patch; \
-       cd patch || exit 1; \
+       cd $(HOST_SUBDIR)/patch || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/patch"; \
-           libsrcdir="$$s/patch";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/patch"; \
-           libsrcdir="$$s/patch";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/patch/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/patch"; \
+       libsrcdir="$$s/patch"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -15776,8 +15543,8 @@ all-patch: configure-patch
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd patch && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-patch))
+       (cd $(HOST_SUBDIR)/patch && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-patch))
 @endif patch
 
 .PHONY: check-patch maybe-check-patch
@@ -15790,7 +15557,8 @@ check-patch:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd patch && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/patch && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif patch
 
@@ -15804,7 +15572,8 @@ install-patch: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd patch && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/patch && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif patch
 
@@ -15826,7 +15595,7 @@ info-patch: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in patch" ; \
-       (cd patch && \
+       (cd $(HOST_SUBDIR)/patch && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15852,7 +15621,7 @@ dvi-patch: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in patch" ; \
-       (cd patch && \
+       (cd $(HOST_SUBDIR)/patch && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15878,7 +15647,7 @@ html-patch: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in patch" ; \
-       (cd patch && \
+       (cd $(HOST_SUBDIR)/patch && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15904,7 +15673,7 @@ TAGS-patch: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in patch" ; \
-       (cd patch && \
+       (cd $(HOST_SUBDIR)/patch && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15931,7 +15700,7 @@ install-info-patch: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in patch" ; \
-       (cd patch && \
+       (cd $(HOST_SUBDIR)/patch && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15957,7 +15726,7 @@ installcheck-patch: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in patch" ; \
-       (cd patch && \
+       (cd $(HOST_SUBDIR)/patch && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -15982,7 +15751,7 @@ mostlyclean-patch:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in patch" ; \
-       (cd patch && \
+       (cd $(HOST_SUBDIR)/patch && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16007,7 +15776,7 @@ clean-patch:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in patch" ; \
-       (cd patch && \
+       (cd $(HOST_SUBDIR)/patch && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16032,7 +15801,7 @@ distclean-patch:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in patch" ; \
-       (cd patch && \
+       (cd $(HOST_SUBDIR)/patch && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16057,7 +15826,7 @@ maintainer-clean-patch:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in patch" ; \
-       (cd patch && \
+       (cd $(HOST_SUBDIR)/patch && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16073,24 +15842,20 @@ maybe-configure-perl:
 @if perl
 maybe-configure-perl: configure-perl
 configure-perl:
-       @test ! -f perl/Makefile || exit 0; \
-       [ -d perl ] || mkdir perl; \
+       @test ! -f $(HOST_SUBDIR)/perl/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/perl ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in perl; \
-       cd perl || exit 1; \
+       cd $(HOST_SUBDIR)/perl || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/perl"; \
-           libsrcdir="$$s/perl";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/perl"; \
-           libsrcdir="$$s/perl";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/perl/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/perl"; \
+       libsrcdir="$$s/perl"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -16106,8 +15871,8 @@ all-perl: configure-perl
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd perl && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-perl))
+       (cd $(HOST_SUBDIR)/perl && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-perl))
 @endif perl
 
 .PHONY: check-perl maybe-check-perl
@@ -16120,7 +15885,8 @@ check-perl:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd perl && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/perl && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif perl
 
@@ -16134,7 +15900,8 @@ install-perl: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd perl && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/perl && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif perl
 
@@ -16156,7 +15923,7 @@ info-perl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in perl" ; \
-       (cd perl && \
+       (cd $(HOST_SUBDIR)/perl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16182,7 +15949,7 @@ dvi-perl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in perl" ; \
-       (cd perl && \
+       (cd $(HOST_SUBDIR)/perl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16208,7 +15975,7 @@ html-perl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in perl" ; \
-       (cd perl && \
+       (cd $(HOST_SUBDIR)/perl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16234,7 +16001,7 @@ TAGS-perl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in perl" ; \
-       (cd perl && \
+       (cd $(HOST_SUBDIR)/perl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16261,7 +16028,7 @@ install-info-perl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in perl" ; \
-       (cd perl && \
+       (cd $(HOST_SUBDIR)/perl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16287,7 +16054,7 @@ installcheck-perl: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in perl" ; \
-       (cd perl && \
+       (cd $(HOST_SUBDIR)/perl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16312,7 +16079,7 @@ mostlyclean-perl:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in perl" ; \
-       (cd perl && \
+       (cd $(HOST_SUBDIR)/perl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16337,7 +16104,7 @@ clean-perl:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in perl" ; \
-       (cd perl && \
+       (cd $(HOST_SUBDIR)/perl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16362,7 +16129,7 @@ distclean-perl:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in perl" ; \
-       (cd perl && \
+       (cd $(HOST_SUBDIR)/perl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16387,7 +16154,7 @@ maintainer-clean-perl:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in perl" ; \
-       (cd perl && \
+       (cd $(HOST_SUBDIR)/perl && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16403,24 +16170,20 @@ maybe-configure-prms:
 @if prms
 maybe-configure-prms: configure-prms
 configure-prms:
-       @test ! -f prms/Makefile || exit 0; \
-       [ -d prms ] || mkdir prms; \
+       @test ! -f $(HOST_SUBDIR)/prms/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/prms ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in prms; \
-       cd prms || exit 1; \
+       cd $(HOST_SUBDIR)/prms || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/prms"; \
-           libsrcdir="$$s/prms";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/prms"; \
-           libsrcdir="$$s/prms";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/prms/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/prms"; \
+       libsrcdir="$$s/prms"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -16436,8 +16199,8 @@ all-prms: configure-prms
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd prms && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-prms))
+       (cd $(HOST_SUBDIR)/prms && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-prms))
 @endif prms
 
 .PHONY: check-prms maybe-check-prms
@@ -16450,7 +16213,8 @@ check-prms:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd prms && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/prms && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif prms
 
@@ -16464,7 +16228,8 @@ install-prms: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd prms && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/prms && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif prms
 
@@ -16486,7 +16251,7 @@ info-prms: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in prms" ; \
-       (cd prms && \
+       (cd $(HOST_SUBDIR)/prms && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16512,7 +16277,7 @@ dvi-prms: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in prms" ; \
-       (cd prms && \
+       (cd $(HOST_SUBDIR)/prms && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16538,7 +16303,7 @@ html-prms: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in prms" ; \
-       (cd prms && \
+       (cd $(HOST_SUBDIR)/prms && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16564,7 +16329,7 @@ TAGS-prms: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in prms" ; \
-       (cd prms && \
+       (cd $(HOST_SUBDIR)/prms && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16591,7 +16356,7 @@ install-info-prms: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in prms" ; \
-       (cd prms && \
+       (cd $(HOST_SUBDIR)/prms && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16617,7 +16382,7 @@ installcheck-prms: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in prms" ; \
-       (cd prms && \
+       (cd $(HOST_SUBDIR)/prms && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16642,7 +16407,7 @@ mostlyclean-prms:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in prms" ; \
-       (cd prms && \
+       (cd $(HOST_SUBDIR)/prms && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16667,7 +16432,7 @@ clean-prms:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in prms" ; \
-       (cd prms && \
+       (cd $(HOST_SUBDIR)/prms && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16692,7 +16457,7 @@ distclean-prms:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in prms" ; \
-       (cd prms && \
+       (cd $(HOST_SUBDIR)/prms && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16717,7 +16482,7 @@ maintainer-clean-prms:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in prms" ; \
-       (cd prms && \
+       (cd $(HOST_SUBDIR)/prms && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16733,24 +16498,20 @@ maybe-configure-rcs:
 @if rcs
 maybe-configure-rcs: configure-rcs
 configure-rcs:
-       @test ! -f rcs/Makefile || exit 0; \
-       [ -d rcs ] || mkdir rcs; \
+       @test ! -f $(HOST_SUBDIR)/rcs/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/rcs ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in rcs; \
-       cd rcs || exit 1; \
+       cd $(HOST_SUBDIR)/rcs || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/rcs"; \
-           libsrcdir="$$s/rcs";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/rcs"; \
-           libsrcdir="$$s/rcs";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/rcs/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/rcs"; \
+       libsrcdir="$$s/rcs"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -16766,8 +16527,8 @@ all-rcs: configure-rcs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd rcs && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-rcs))
+       (cd $(HOST_SUBDIR)/rcs && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-rcs))
 @endif rcs
 
 .PHONY: check-rcs maybe-check-rcs
@@ -16780,7 +16541,8 @@ check-rcs:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd rcs && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/rcs && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif rcs
 
@@ -16794,7 +16556,8 @@ install-rcs: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd rcs && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/rcs && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif rcs
 
@@ -16816,7 +16579,7 @@ info-rcs: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in rcs" ; \
-       (cd rcs && \
+       (cd $(HOST_SUBDIR)/rcs && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16842,7 +16605,7 @@ dvi-rcs: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in rcs" ; \
-       (cd rcs && \
+       (cd $(HOST_SUBDIR)/rcs && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16868,7 +16631,7 @@ html-rcs: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in rcs" ; \
-       (cd rcs && \
+       (cd $(HOST_SUBDIR)/rcs && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16894,7 +16657,7 @@ TAGS-rcs: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in rcs" ; \
-       (cd rcs && \
+       (cd $(HOST_SUBDIR)/rcs && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16921,7 +16684,7 @@ install-info-rcs: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in rcs" ; \
-       (cd rcs && \
+       (cd $(HOST_SUBDIR)/rcs && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16947,7 +16710,7 @@ installcheck-rcs: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in rcs" ; \
-       (cd rcs && \
+       (cd $(HOST_SUBDIR)/rcs && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16972,7 +16735,7 @@ mostlyclean-rcs:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in rcs" ; \
-       (cd rcs && \
+       (cd $(HOST_SUBDIR)/rcs && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -16997,7 +16760,7 @@ clean-rcs:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in rcs" ; \
-       (cd rcs && \
+       (cd $(HOST_SUBDIR)/rcs && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17022,7 +16785,7 @@ distclean-rcs:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in rcs" ; \
-       (cd rcs && \
+       (cd $(HOST_SUBDIR)/rcs && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17047,7 +16810,7 @@ maintainer-clean-rcs:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in rcs" ; \
-       (cd rcs && \
+       (cd $(HOST_SUBDIR)/rcs && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17063,24 +16826,20 @@ maybe-configure-readline:
 @if readline
 maybe-configure-readline: configure-readline
 configure-readline:
-       @test ! -f readline/Makefile || exit 0; \
-       [ -d readline ] || mkdir readline; \
+       @test ! -f $(HOST_SUBDIR)/readline/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/readline ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in readline; \
-       cd readline || exit 1; \
+       cd $(HOST_SUBDIR)/readline || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/readline"; \
-           libsrcdir="$$s/readline";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/readline"; \
-           libsrcdir="$$s/readline";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/readline/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/readline"; \
+       libsrcdir="$$s/readline"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -17096,8 +16855,8 @@ all-readline: configure-readline
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd readline && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-readline))
+       (cd $(HOST_SUBDIR)/readline && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-readline))
 @endif readline
 
 .PHONY: check-readline maybe-check-readline
@@ -17110,7 +16869,8 @@ check-readline:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd readline && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/readline && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif readline
 
@@ -17124,7 +16884,8 @@ install-readline: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd readline && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/readline && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif readline
 
@@ -17146,7 +16907,7 @@ info-readline: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in readline" ; \
-       (cd readline && \
+       (cd $(HOST_SUBDIR)/readline && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17172,7 +16933,7 @@ dvi-readline: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in readline" ; \
-       (cd readline && \
+       (cd $(HOST_SUBDIR)/readline && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17198,7 +16959,7 @@ html-readline: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in readline" ; \
-       (cd readline && \
+       (cd $(HOST_SUBDIR)/readline && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17224,7 +16985,7 @@ TAGS-readline: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in readline" ; \
-       (cd readline && \
+       (cd $(HOST_SUBDIR)/readline && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17251,7 +17012,7 @@ install-info-readline: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in readline" ; \
-       (cd readline && \
+       (cd $(HOST_SUBDIR)/readline && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17277,7 +17038,7 @@ installcheck-readline: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in readline" ; \
-       (cd readline && \
+       (cd $(HOST_SUBDIR)/readline && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17302,7 +17063,7 @@ mostlyclean-readline:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in readline" ; \
-       (cd readline && \
+       (cd $(HOST_SUBDIR)/readline && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17327,7 +17088,7 @@ clean-readline:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in readline" ; \
-       (cd readline && \
+       (cd $(HOST_SUBDIR)/readline && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17352,7 +17113,7 @@ distclean-readline:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in readline" ; \
-       (cd readline && \
+       (cd $(HOST_SUBDIR)/readline && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17377,7 +17138,7 @@ maintainer-clean-readline:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in readline" ; \
-       (cd readline && \
+       (cd $(HOST_SUBDIR)/readline && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17393,24 +17154,20 @@ maybe-configure-release:
 @if release
 maybe-configure-release: configure-release
 configure-release:
-       @test ! -f release/Makefile || exit 0; \
-       [ -d release ] || mkdir release; \
+       @test ! -f $(HOST_SUBDIR)/release/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/release ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in release; \
-       cd release || exit 1; \
+       cd $(HOST_SUBDIR)/release || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/release"; \
-           libsrcdir="$$s/release";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/release"; \
-           libsrcdir="$$s/release";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/release/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/release"; \
+       libsrcdir="$$s/release"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -17426,8 +17183,8 @@ all-release: configure-release
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd release && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-release))
+       (cd $(HOST_SUBDIR)/release && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-release))
 @endif release
 
 .PHONY: check-release maybe-check-release
@@ -17466,7 +17223,7 @@ info-release: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in release" ; \
-       (cd release && \
+       (cd $(HOST_SUBDIR)/release && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17492,7 +17249,7 @@ dvi-release: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in release" ; \
-       (cd release && \
+       (cd $(HOST_SUBDIR)/release && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17518,7 +17275,7 @@ html-release: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in release" ; \
-       (cd release && \
+       (cd $(HOST_SUBDIR)/release && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17544,7 +17301,7 @@ TAGS-release: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in release" ; \
-       (cd release && \
+       (cd $(HOST_SUBDIR)/release && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17571,7 +17328,7 @@ install-info-release: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in release" ; \
-       (cd release && \
+       (cd $(HOST_SUBDIR)/release && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17597,7 +17354,7 @@ installcheck-release: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in release" ; \
-       (cd release && \
+       (cd $(HOST_SUBDIR)/release && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17622,7 +17379,7 @@ mostlyclean-release:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in release" ; \
-       (cd release && \
+       (cd $(HOST_SUBDIR)/release && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17647,7 +17404,7 @@ clean-release:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in release" ; \
-       (cd release && \
+       (cd $(HOST_SUBDIR)/release && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17672,7 +17429,7 @@ distclean-release:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in release" ; \
-       (cd release && \
+       (cd $(HOST_SUBDIR)/release && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17697,7 +17454,7 @@ maintainer-clean-release:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in release" ; \
-       (cd release && \
+       (cd $(HOST_SUBDIR)/release && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17713,24 +17470,20 @@ maybe-configure-recode:
 @if recode
 maybe-configure-recode: configure-recode
 configure-recode:
-       @test ! -f recode/Makefile || exit 0; \
-       [ -d recode ] || mkdir recode; \
+       @test ! -f $(HOST_SUBDIR)/recode/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/recode ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in recode; \
-       cd recode || exit 1; \
+       cd $(HOST_SUBDIR)/recode || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/recode"; \
-           libsrcdir="$$s/recode";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/recode"; \
-           libsrcdir="$$s/recode";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/recode/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/recode"; \
+       libsrcdir="$$s/recode"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -17746,8 +17499,8 @@ all-recode: configure-recode
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd recode && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-recode))
+       (cd $(HOST_SUBDIR)/recode && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-recode))
 @endif recode
 
 .PHONY: check-recode maybe-check-recode
@@ -17760,7 +17513,8 @@ check-recode:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd recode && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/recode && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif recode
 
@@ -17774,7 +17528,8 @@ install-recode: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd recode && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/recode && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif recode
 
@@ -17796,7 +17551,7 @@ info-recode: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in recode" ; \
-       (cd recode && \
+       (cd $(HOST_SUBDIR)/recode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17822,7 +17577,7 @@ dvi-recode: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in recode" ; \
-       (cd recode && \
+       (cd $(HOST_SUBDIR)/recode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17848,7 +17603,7 @@ html-recode: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in recode" ; \
-       (cd recode && \
+       (cd $(HOST_SUBDIR)/recode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17874,7 +17629,7 @@ TAGS-recode: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in recode" ; \
-       (cd recode && \
+       (cd $(HOST_SUBDIR)/recode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17901,7 +17656,7 @@ install-info-recode: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in recode" ; \
-       (cd recode && \
+       (cd $(HOST_SUBDIR)/recode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17927,7 +17682,7 @@ installcheck-recode: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in recode" ; \
-       (cd recode && \
+       (cd $(HOST_SUBDIR)/recode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17952,7 +17707,7 @@ mostlyclean-recode:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in recode" ; \
-       (cd recode && \
+       (cd $(HOST_SUBDIR)/recode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -17977,7 +17732,7 @@ clean-recode:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in recode" ; \
-       (cd recode && \
+       (cd $(HOST_SUBDIR)/recode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18002,7 +17757,7 @@ distclean-recode:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in recode" ; \
-       (cd recode && \
+       (cd $(HOST_SUBDIR)/recode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18027,7 +17782,7 @@ maintainer-clean-recode:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in recode" ; \
-       (cd recode && \
+       (cd $(HOST_SUBDIR)/recode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18043,24 +17798,20 @@ maybe-configure-sed:
 @if sed
 maybe-configure-sed: configure-sed
 configure-sed:
-       @test ! -f sed/Makefile || exit 0; \
-       [ -d sed ] || mkdir sed; \
+       @test ! -f $(HOST_SUBDIR)/sed/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/sed ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in sed; \
-       cd sed || exit 1; \
+       cd $(HOST_SUBDIR)/sed || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/sed"; \
-           libsrcdir="$$s/sed";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/sed"; \
-           libsrcdir="$$s/sed";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/sed/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/sed"; \
+       libsrcdir="$$s/sed"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -18076,8 +17827,8 @@ all-sed: configure-sed
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd sed && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-sed))
+       (cd $(HOST_SUBDIR)/sed && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-sed))
 @endif sed
 
 .PHONY: check-sed maybe-check-sed
@@ -18090,7 +17841,8 @@ check-sed:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd sed && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/sed && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif sed
 
@@ -18104,7 +17856,8 @@ install-sed: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd sed && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/sed && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif sed
 
@@ -18126,7 +17879,7 @@ info-sed: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in sed" ; \
-       (cd sed && \
+       (cd $(HOST_SUBDIR)/sed && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18152,7 +17905,7 @@ dvi-sed: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in sed" ; \
-       (cd sed && \
+       (cd $(HOST_SUBDIR)/sed && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18178,7 +17931,7 @@ html-sed: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in sed" ; \
-       (cd sed && \
+       (cd $(HOST_SUBDIR)/sed && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18204,7 +17957,7 @@ TAGS-sed: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in sed" ; \
-       (cd sed && \
+       (cd $(HOST_SUBDIR)/sed && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18231,7 +17984,7 @@ install-info-sed: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in sed" ; \
-       (cd sed && \
+       (cd $(HOST_SUBDIR)/sed && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18257,7 +18010,7 @@ installcheck-sed: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in sed" ; \
-       (cd sed && \
+       (cd $(HOST_SUBDIR)/sed && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18282,7 +18035,7 @@ mostlyclean-sed:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in sed" ; \
-       (cd sed && \
+       (cd $(HOST_SUBDIR)/sed && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18307,7 +18060,7 @@ clean-sed:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in sed" ; \
-       (cd sed && \
+       (cd $(HOST_SUBDIR)/sed && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18332,7 +18085,7 @@ distclean-sed:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in sed" ; \
-       (cd sed && \
+       (cd $(HOST_SUBDIR)/sed && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18357,7 +18110,7 @@ maintainer-clean-sed:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in sed" ; \
-       (cd sed && \
+       (cd $(HOST_SUBDIR)/sed && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18373,24 +18126,20 @@ maybe-configure-send-pr:
 @if send-pr
 maybe-configure-send-pr: configure-send-pr
 configure-send-pr:
-       @test ! -f send-pr/Makefile || exit 0; \
-       [ -d send-pr ] || mkdir send-pr; \
+       @test ! -f $(HOST_SUBDIR)/send-pr/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/send-pr ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in send-pr; \
-       cd send-pr || exit 1; \
+       cd $(HOST_SUBDIR)/send-pr || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/send-pr"; \
-           libsrcdir="$$s/send-pr";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/send-pr"; \
-           libsrcdir="$$s/send-pr";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/send-pr/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/send-pr"; \
+       libsrcdir="$$s/send-pr"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -18406,8 +18155,8 @@ all-send-pr: configure-send-pr
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd send-pr && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-send-pr))
+       (cd $(HOST_SUBDIR)/send-pr && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-send-pr))
 @endif send-pr
 
 .PHONY: check-send-pr maybe-check-send-pr
@@ -18420,7 +18169,8 @@ check-send-pr:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd send-pr && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/send-pr && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif send-pr
 
@@ -18434,7 +18184,8 @@ install-send-pr: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd send-pr && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/send-pr && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif send-pr
 
@@ -18456,7 +18207,7 @@ info-send-pr: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in send-pr" ; \
-       (cd send-pr && \
+       (cd $(HOST_SUBDIR)/send-pr && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18482,7 +18233,7 @@ dvi-send-pr: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in send-pr" ; \
-       (cd send-pr && \
+       (cd $(HOST_SUBDIR)/send-pr && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18508,7 +18259,7 @@ html-send-pr: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in send-pr" ; \
-       (cd send-pr && \
+       (cd $(HOST_SUBDIR)/send-pr && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18534,7 +18285,7 @@ TAGS-send-pr: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in send-pr" ; \
-       (cd send-pr && \
+       (cd $(HOST_SUBDIR)/send-pr && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18561,7 +18312,7 @@ install-info-send-pr: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in send-pr" ; \
-       (cd send-pr && \
+       (cd $(HOST_SUBDIR)/send-pr && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18587,7 +18338,7 @@ installcheck-send-pr: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in send-pr" ; \
-       (cd send-pr && \
+       (cd $(HOST_SUBDIR)/send-pr && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18612,7 +18363,7 @@ mostlyclean-send-pr:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in send-pr" ; \
-       (cd send-pr && \
+       (cd $(HOST_SUBDIR)/send-pr && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18637,7 +18388,7 @@ clean-send-pr:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in send-pr" ; \
-       (cd send-pr && \
+       (cd $(HOST_SUBDIR)/send-pr && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18662,7 +18413,7 @@ distclean-send-pr:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in send-pr" ; \
-       (cd send-pr && \
+       (cd $(HOST_SUBDIR)/send-pr && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18687,7 +18438,7 @@ maintainer-clean-send-pr:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in send-pr" ; \
-       (cd send-pr && \
+       (cd $(HOST_SUBDIR)/send-pr && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18703,24 +18454,20 @@ maybe-configure-shellutils:
 @if shellutils
 maybe-configure-shellutils: configure-shellutils
 configure-shellutils:
-       @test ! -f shellutils/Makefile || exit 0; \
-       [ -d shellutils ] || mkdir shellutils; \
+       @test ! -f $(HOST_SUBDIR)/shellutils/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/shellutils ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in shellutils; \
-       cd shellutils || exit 1; \
+       cd $(HOST_SUBDIR)/shellutils || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/shellutils"; \
-           libsrcdir="$$s/shellutils";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/shellutils"; \
-           libsrcdir="$$s/shellutils";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/shellutils/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/shellutils"; \
+       libsrcdir="$$s/shellutils"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -18736,8 +18483,8 @@ all-shellutils: configure-shellutils
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd shellutils && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-shellutils))
+       (cd $(HOST_SUBDIR)/shellutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-shellutils))
 @endif shellutils
 
 .PHONY: check-shellutils maybe-check-shellutils
@@ -18750,7 +18497,8 @@ check-shellutils:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd shellutils && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/shellutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif shellutils
 
@@ -18764,7 +18512,8 @@ install-shellutils: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd shellutils && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/shellutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif shellutils
 
@@ -18786,7 +18535,7 @@ info-shellutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in shellutils" ; \
-       (cd shellutils && \
+       (cd $(HOST_SUBDIR)/shellutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18812,7 +18561,7 @@ dvi-shellutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in shellutils" ; \
-       (cd shellutils && \
+       (cd $(HOST_SUBDIR)/shellutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18838,7 +18587,7 @@ html-shellutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in shellutils" ; \
-       (cd shellutils && \
+       (cd $(HOST_SUBDIR)/shellutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18864,7 +18613,7 @@ TAGS-shellutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in shellutils" ; \
-       (cd shellutils && \
+       (cd $(HOST_SUBDIR)/shellutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18891,7 +18640,7 @@ install-info-shellutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in shellutils" ; \
-       (cd shellutils && \
+       (cd $(HOST_SUBDIR)/shellutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18917,7 +18666,7 @@ installcheck-shellutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in shellutils" ; \
-       (cd shellutils && \
+       (cd $(HOST_SUBDIR)/shellutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18942,7 +18691,7 @@ mostlyclean-shellutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in shellutils" ; \
-       (cd shellutils && \
+       (cd $(HOST_SUBDIR)/shellutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18967,7 +18716,7 @@ clean-shellutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in shellutils" ; \
-       (cd shellutils && \
+       (cd $(HOST_SUBDIR)/shellutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -18992,7 +18741,7 @@ distclean-shellutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in shellutils" ; \
-       (cd shellutils && \
+       (cd $(HOST_SUBDIR)/shellutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19017,7 +18766,7 @@ maintainer-clean-shellutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in shellutils" ; \
-       (cd shellutils && \
+       (cd $(HOST_SUBDIR)/shellutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19033,24 +18782,20 @@ maybe-configure-sid:
 @if sid
 maybe-configure-sid: configure-sid
 configure-sid:
-       @test ! -f sid/Makefile || exit 0; \
-       [ -d sid ] || mkdir sid; \
+       @test ! -f $(HOST_SUBDIR)/sid/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/sid ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in sid; \
-       cd sid || exit 1; \
+       cd $(HOST_SUBDIR)/sid || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/sid"; \
-           libsrcdir="$$s/sid";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/sid"; \
-           libsrcdir="$$s/sid";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/sid/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/sid"; \
+       libsrcdir="$$s/sid"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -19066,8 +18811,8 @@ all-sid: configure-sid
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd sid && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-sid))
+       (cd $(HOST_SUBDIR)/sid && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-sid))
 @endif sid
 
 .PHONY: check-sid maybe-check-sid
@@ -19080,7 +18825,8 @@ check-sid:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd sid && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/sid && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif sid
 
@@ -19094,7 +18840,8 @@ install-sid: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd sid && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/sid && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif sid
 
@@ -19116,7 +18863,7 @@ info-sid: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in sid" ; \
-       (cd sid && \
+       (cd $(HOST_SUBDIR)/sid && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19142,7 +18889,7 @@ dvi-sid: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in sid" ; \
-       (cd sid && \
+       (cd $(HOST_SUBDIR)/sid && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19168,7 +18915,7 @@ html-sid: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in sid" ; \
-       (cd sid && \
+       (cd $(HOST_SUBDIR)/sid && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19194,7 +18941,7 @@ TAGS-sid: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in sid" ; \
-       (cd sid && \
+       (cd $(HOST_SUBDIR)/sid && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19221,7 +18968,7 @@ install-info-sid: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in sid" ; \
-       (cd sid && \
+       (cd $(HOST_SUBDIR)/sid && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19247,7 +18994,7 @@ installcheck-sid: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in sid" ; \
-       (cd sid && \
+       (cd $(HOST_SUBDIR)/sid && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19272,7 +19019,7 @@ mostlyclean-sid:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in sid" ; \
-       (cd sid && \
+       (cd $(HOST_SUBDIR)/sid && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19297,7 +19044,7 @@ clean-sid:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in sid" ; \
-       (cd sid && \
+       (cd $(HOST_SUBDIR)/sid && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19322,7 +19069,7 @@ distclean-sid:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in sid" ; \
-       (cd sid && \
+       (cd $(HOST_SUBDIR)/sid && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19347,7 +19094,7 @@ maintainer-clean-sid:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in sid" ; \
-       (cd sid && \
+       (cd $(HOST_SUBDIR)/sid && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19363,24 +19110,20 @@ maybe-configure-sim:
 @if sim
 maybe-configure-sim: configure-sim
 configure-sim:
-       @test ! -f sim/Makefile || exit 0; \
-       [ -d sim ] || mkdir sim; \
+       @test ! -f $(HOST_SUBDIR)/sim/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/sim ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in sim; \
-       cd sim || exit 1; \
+       cd $(HOST_SUBDIR)/sim || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/sim"; \
-           libsrcdir="$$s/sim";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/sim"; \
-           libsrcdir="$$s/sim";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/sim/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/sim"; \
+       libsrcdir="$$s/sim"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -19396,8 +19139,8 @@ all-sim: configure-sim
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd sim && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-sim))
+       (cd $(HOST_SUBDIR)/sim && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-sim))
 @endif sim
 
 .PHONY: check-sim maybe-check-sim
@@ -19410,7 +19153,8 @@ check-sim:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd sim && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/sim && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif sim
 
@@ -19424,7 +19168,8 @@ install-sim: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd sim && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/sim && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif sim
 
@@ -19446,7 +19191,7 @@ info-sim: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in sim" ; \
-       (cd sim && \
+       (cd $(HOST_SUBDIR)/sim && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19472,7 +19217,7 @@ dvi-sim: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in sim" ; \
-       (cd sim && \
+       (cd $(HOST_SUBDIR)/sim && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19498,7 +19243,7 @@ html-sim: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in sim" ; \
-       (cd sim && \
+       (cd $(HOST_SUBDIR)/sim && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19524,7 +19269,7 @@ TAGS-sim: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in sim" ; \
-       (cd sim && \
+       (cd $(HOST_SUBDIR)/sim && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19551,7 +19296,7 @@ install-info-sim: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in sim" ; \
-       (cd sim && \
+       (cd $(HOST_SUBDIR)/sim && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19577,7 +19322,7 @@ installcheck-sim: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in sim" ; \
-       (cd sim && \
+       (cd $(HOST_SUBDIR)/sim && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19602,7 +19347,7 @@ mostlyclean-sim:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in sim" ; \
-       (cd sim && \
+       (cd $(HOST_SUBDIR)/sim && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19627,7 +19372,7 @@ clean-sim:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in sim" ; \
-       (cd sim && \
+       (cd $(HOST_SUBDIR)/sim && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19652,7 +19397,7 @@ distclean-sim:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in sim" ; \
-       (cd sim && \
+       (cd $(HOST_SUBDIR)/sim && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19677,7 +19422,7 @@ maintainer-clean-sim:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in sim" ; \
-       (cd sim && \
+       (cd $(HOST_SUBDIR)/sim && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19693,24 +19438,20 @@ maybe-configure-tar:
 @if tar
 maybe-configure-tar: configure-tar
 configure-tar:
-       @test ! -f tar/Makefile || exit 0; \
-       [ -d tar ] || mkdir tar; \
+       @test ! -f $(HOST_SUBDIR)/tar/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/tar ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in tar; \
-       cd tar || exit 1; \
+       cd $(HOST_SUBDIR)/tar || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/tar"; \
-           libsrcdir="$$s/tar";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/tar"; \
-           libsrcdir="$$s/tar";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/tar/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/tar"; \
+       libsrcdir="$$s/tar"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -19726,8 +19467,8 @@ all-tar: configure-tar
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd tar && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-tar))
+       (cd $(HOST_SUBDIR)/tar && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-tar))
 @endif tar
 
 .PHONY: check-tar maybe-check-tar
@@ -19740,7 +19481,8 @@ check-tar:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd tar && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/tar && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif tar
 
@@ -19754,7 +19496,8 @@ install-tar: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd tar && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/tar && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif tar
 
@@ -19776,7 +19519,7 @@ info-tar: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in tar" ; \
-       (cd tar && \
+       (cd $(HOST_SUBDIR)/tar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19802,7 +19545,7 @@ dvi-tar: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in tar" ; \
-       (cd tar && \
+       (cd $(HOST_SUBDIR)/tar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19828,7 +19571,7 @@ html-tar: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in tar" ; \
-       (cd tar && \
+       (cd $(HOST_SUBDIR)/tar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19854,7 +19597,7 @@ TAGS-tar: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in tar" ; \
-       (cd tar && \
+       (cd $(HOST_SUBDIR)/tar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19881,7 +19624,7 @@ install-info-tar: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in tar" ; \
-       (cd tar && \
+       (cd $(HOST_SUBDIR)/tar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19907,7 +19650,7 @@ installcheck-tar: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in tar" ; \
-       (cd tar && \
+       (cd $(HOST_SUBDIR)/tar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19932,7 +19675,7 @@ mostlyclean-tar:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in tar" ; \
-       (cd tar && \
+       (cd $(HOST_SUBDIR)/tar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19957,7 +19700,7 @@ clean-tar:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in tar" ; \
-       (cd tar && \
+       (cd $(HOST_SUBDIR)/tar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -19982,7 +19725,7 @@ distclean-tar:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in tar" ; \
-       (cd tar && \
+       (cd $(HOST_SUBDIR)/tar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20007,7 +19750,7 @@ maintainer-clean-tar:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in tar" ; \
-       (cd tar && \
+       (cd $(HOST_SUBDIR)/tar && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20023,24 +19766,20 @@ maybe-configure-texinfo:
 @if texinfo
 maybe-configure-texinfo: configure-texinfo
 configure-texinfo:
-       @test ! -f texinfo/Makefile || exit 0; \
-       [ -d texinfo ] || mkdir texinfo; \
+       @test ! -f $(HOST_SUBDIR)/texinfo/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/texinfo ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in texinfo; \
-       cd texinfo || exit 1; \
+       cd $(HOST_SUBDIR)/texinfo || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/texinfo"; \
-           libsrcdir="$$s/texinfo";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/texinfo"; \
-           libsrcdir="$$s/texinfo";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/texinfo/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/texinfo"; \
+       libsrcdir="$$s/texinfo"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -20056,8 +19795,8 @@ all-texinfo: configure-texinfo
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd texinfo && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-texinfo))
+       (cd $(HOST_SUBDIR)/texinfo && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-texinfo))
 @endif texinfo
 
 .PHONY: check-texinfo maybe-check-texinfo
@@ -20070,7 +19809,8 @@ check-texinfo:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd texinfo && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/texinfo && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif texinfo
 
@@ -20101,7 +19841,7 @@ info-texinfo: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in texinfo" ; \
-       (cd texinfo && \
+       (cd $(HOST_SUBDIR)/texinfo && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20127,7 +19867,7 @@ dvi-texinfo: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in texinfo" ; \
-       (cd texinfo && \
+       (cd $(HOST_SUBDIR)/texinfo && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20153,7 +19893,7 @@ html-texinfo: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in texinfo" ; \
-       (cd texinfo && \
+       (cd $(HOST_SUBDIR)/texinfo && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20179,7 +19919,7 @@ TAGS-texinfo: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in texinfo" ; \
-       (cd texinfo && \
+       (cd $(HOST_SUBDIR)/texinfo && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20206,7 +19946,7 @@ install-info-texinfo: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in texinfo" ; \
-       (cd texinfo && \
+       (cd $(HOST_SUBDIR)/texinfo && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20232,7 +19972,7 @@ installcheck-texinfo: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in texinfo" ; \
-       (cd texinfo && \
+       (cd $(HOST_SUBDIR)/texinfo && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20257,7 +19997,7 @@ mostlyclean-texinfo:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in texinfo" ; \
-       (cd texinfo && \
+       (cd $(HOST_SUBDIR)/texinfo && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20282,7 +20022,7 @@ clean-texinfo:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in texinfo" ; \
-       (cd texinfo && \
+       (cd $(HOST_SUBDIR)/texinfo && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20307,7 +20047,7 @@ distclean-texinfo:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in texinfo" ; \
-       (cd texinfo && \
+       (cd $(HOST_SUBDIR)/texinfo && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20332,7 +20072,7 @@ maintainer-clean-texinfo:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in texinfo" ; \
-       (cd texinfo && \
+       (cd $(HOST_SUBDIR)/texinfo && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20348,24 +20088,20 @@ maybe-configure-textutils:
 @if textutils
 maybe-configure-textutils: configure-textutils
 configure-textutils:
-       @test ! -f textutils/Makefile || exit 0; \
-       [ -d textutils ] || mkdir textutils; \
+       @test ! -f $(HOST_SUBDIR)/textutils/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/textutils ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in textutils; \
-       cd textutils || exit 1; \
+       cd $(HOST_SUBDIR)/textutils || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/textutils"; \
-           libsrcdir="$$s/textutils";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/textutils"; \
-           libsrcdir="$$s/textutils";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/textutils/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/textutils"; \
+       libsrcdir="$$s/textutils"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -20381,8 +20117,8 @@ all-textutils: configure-textutils
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd textutils && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-textutils))
+       (cd $(HOST_SUBDIR)/textutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-textutils))
 @endif textutils
 
 .PHONY: check-textutils maybe-check-textutils
@@ -20395,7 +20131,8 @@ check-textutils:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd textutils && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/textutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif textutils
 
@@ -20409,7 +20146,8 @@ install-textutils: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd textutils && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/textutils && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif textutils
 
@@ -20431,7 +20169,7 @@ info-textutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in textutils" ; \
-       (cd textutils && \
+       (cd $(HOST_SUBDIR)/textutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20457,7 +20195,7 @@ dvi-textutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in textutils" ; \
-       (cd textutils && \
+       (cd $(HOST_SUBDIR)/textutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20483,7 +20221,7 @@ html-textutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in textutils" ; \
-       (cd textutils && \
+       (cd $(HOST_SUBDIR)/textutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20509,7 +20247,7 @@ TAGS-textutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in textutils" ; \
-       (cd textutils && \
+       (cd $(HOST_SUBDIR)/textutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20536,7 +20274,7 @@ install-info-textutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in textutils" ; \
-       (cd textutils && \
+       (cd $(HOST_SUBDIR)/textutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20562,7 +20300,7 @@ installcheck-textutils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in textutils" ; \
-       (cd textutils && \
+       (cd $(HOST_SUBDIR)/textutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20587,7 +20325,7 @@ mostlyclean-textutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in textutils" ; \
-       (cd textutils && \
+       (cd $(HOST_SUBDIR)/textutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20612,7 +20350,7 @@ clean-textutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in textutils" ; \
-       (cd textutils && \
+       (cd $(HOST_SUBDIR)/textutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20637,7 +20375,7 @@ distclean-textutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in textutils" ; \
-       (cd textutils && \
+       (cd $(HOST_SUBDIR)/textutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20662,7 +20400,7 @@ maintainer-clean-textutils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in textutils" ; \
-       (cd textutils && \
+       (cd $(HOST_SUBDIR)/textutils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20678,24 +20416,20 @@ maybe-configure-time:
 @if time
 maybe-configure-time: configure-time
 configure-time:
-       @test ! -f time/Makefile || exit 0; \
-       [ -d time ] || mkdir time; \
+       @test ! -f $(HOST_SUBDIR)/time/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/time ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in time; \
-       cd time || exit 1; \
+       cd $(HOST_SUBDIR)/time || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/time"; \
-           libsrcdir="$$s/time";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/time"; \
-           libsrcdir="$$s/time";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/time/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/time"; \
+       libsrcdir="$$s/time"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -20711,8 +20445,8 @@ all-time: configure-time
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd time && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-time))
+       (cd $(HOST_SUBDIR)/time && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-time))
 @endif time
 
 .PHONY: check-time maybe-check-time
@@ -20725,7 +20459,8 @@ check-time:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd time && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/time && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif time
 
@@ -20739,7 +20474,8 @@ install-time: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd time && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/time && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif time
 
@@ -20761,7 +20497,7 @@ info-time: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in time" ; \
-       (cd time && \
+       (cd $(HOST_SUBDIR)/time && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20787,7 +20523,7 @@ dvi-time: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in time" ; \
-       (cd time && \
+       (cd $(HOST_SUBDIR)/time && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20813,7 +20549,7 @@ html-time: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in time" ; \
-       (cd time && \
+       (cd $(HOST_SUBDIR)/time && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20839,7 +20575,7 @@ TAGS-time: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in time" ; \
-       (cd time && \
+       (cd $(HOST_SUBDIR)/time && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20866,7 +20602,7 @@ install-info-time: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in time" ; \
-       (cd time && \
+       (cd $(HOST_SUBDIR)/time && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20892,7 +20628,7 @@ installcheck-time: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in time" ; \
-       (cd time && \
+       (cd $(HOST_SUBDIR)/time && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20917,7 +20653,7 @@ mostlyclean-time:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in time" ; \
-       (cd time && \
+       (cd $(HOST_SUBDIR)/time && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20942,7 +20678,7 @@ clean-time:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in time" ; \
-       (cd time && \
+       (cd $(HOST_SUBDIR)/time && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20967,7 +20703,7 @@ distclean-time:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in time" ; \
-       (cd time && \
+       (cd $(HOST_SUBDIR)/time && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -20992,7 +20728,7 @@ maintainer-clean-time:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in time" ; \
-       (cd time && \
+       (cd $(HOST_SUBDIR)/time && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21008,24 +20744,20 @@ maybe-configure-uudecode:
 @if uudecode
 maybe-configure-uudecode: configure-uudecode
 configure-uudecode:
-       @test ! -f uudecode/Makefile || exit 0; \
-       [ -d uudecode ] || mkdir uudecode; \
+       @test ! -f $(HOST_SUBDIR)/uudecode/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/uudecode ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in uudecode; \
-       cd uudecode || exit 1; \
+       cd $(HOST_SUBDIR)/uudecode || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/uudecode"; \
-           libsrcdir="$$s/uudecode";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/uudecode"; \
-           libsrcdir="$$s/uudecode";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/uudecode/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/uudecode"; \
+       libsrcdir="$$s/uudecode"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -21041,8 +20773,8 @@ all-uudecode: configure-uudecode
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd uudecode && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-uudecode))
+       (cd $(HOST_SUBDIR)/uudecode && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-uudecode))
 @endif uudecode
 
 .PHONY: check-uudecode maybe-check-uudecode
@@ -21055,7 +20787,8 @@ check-uudecode:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd uudecode && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/uudecode && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif uudecode
 
@@ -21069,7 +20802,8 @@ install-uudecode: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd uudecode && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/uudecode && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif uudecode
 
@@ -21091,7 +20825,7 @@ info-uudecode: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in uudecode" ; \
-       (cd uudecode && \
+       (cd $(HOST_SUBDIR)/uudecode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21117,7 +20851,7 @@ dvi-uudecode: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in uudecode" ; \
-       (cd uudecode && \
+       (cd $(HOST_SUBDIR)/uudecode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21143,7 +20877,7 @@ html-uudecode: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in uudecode" ; \
-       (cd uudecode && \
+       (cd $(HOST_SUBDIR)/uudecode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21169,7 +20903,7 @@ TAGS-uudecode: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in uudecode" ; \
-       (cd uudecode && \
+       (cd $(HOST_SUBDIR)/uudecode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21196,7 +20930,7 @@ install-info-uudecode: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in uudecode" ; \
-       (cd uudecode && \
+       (cd $(HOST_SUBDIR)/uudecode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21222,7 +20956,7 @@ installcheck-uudecode: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in uudecode" ; \
-       (cd uudecode && \
+       (cd $(HOST_SUBDIR)/uudecode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21247,7 +20981,7 @@ mostlyclean-uudecode:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in uudecode" ; \
-       (cd uudecode && \
+       (cd $(HOST_SUBDIR)/uudecode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21272,7 +21006,7 @@ clean-uudecode:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in uudecode" ; \
-       (cd uudecode && \
+       (cd $(HOST_SUBDIR)/uudecode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21297,7 +21031,7 @@ distclean-uudecode:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in uudecode" ; \
-       (cd uudecode && \
+       (cd $(HOST_SUBDIR)/uudecode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21322,7 +21056,7 @@ maintainer-clean-uudecode:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in uudecode" ; \
-       (cd uudecode && \
+       (cd $(HOST_SUBDIR)/uudecode && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21338,24 +21072,20 @@ maybe-configure-wdiff:
 @if wdiff
 maybe-configure-wdiff: configure-wdiff
 configure-wdiff:
-       @test ! -f wdiff/Makefile || exit 0; \
-       [ -d wdiff ] || mkdir wdiff; \
+       @test ! -f $(HOST_SUBDIR)/wdiff/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/wdiff ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in wdiff; \
-       cd wdiff || exit 1; \
+       cd $(HOST_SUBDIR)/wdiff || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/wdiff"; \
-           libsrcdir="$$s/wdiff";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/wdiff"; \
-           libsrcdir="$$s/wdiff";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/wdiff/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/wdiff"; \
+       libsrcdir="$$s/wdiff"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -21371,8 +21101,8 @@ all-wdiff: configure-wdiff
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd wdiff && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-wdiff))
+       (cd $(HOST_SUBDIR)/wdiff && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-wdiff))
 @endif wdiff
 
 .PHONY: check-wdiff maybe-check-wdiff
@@ -21385,7 +21115,8 @@ check-wdiff:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd wdiff && $(MAKE) $(FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/wdiff && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif wdiff
 
@@ -21399,7 +21130,8 @@ install-wdiff: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd wdiff && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/wdiff && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif wdiff
 
@@ -21421,7 +21153,7 @@ info-wdiff: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in wdiff" ; \
-       (cd wdiff && \
+       (cd $(HOST_SUBDIR)/wdiff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21447,7 +21179,7 @@ dvi-wdiff: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in wdiff" ; \
-       (cd wdiff && \
+       (cd $(HOST_SUBDIR)/wdiff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21473,7 +21205,7 @@ html-wdiff: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in wdiff" ; \
-       (cd wdiff && \
+       (cd $(HOST_SUBDIR)/wdiff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21499,7 +21231,7 @@ TAGS-wdiff: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in wdiff" ; \
-       (cd wdiff && \
+       (cd $(HOST_SUBDIR)/wdiff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21526,7 +21258,7 @@ install-info-wdiff: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in wdiff" ; \
-       (cd wdiff && \
+       (cd $(HOST_SUBDIR)/wdiff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21552,7 +21284,7 @@ installcheck-wdiff: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in wdiff" ; \
-       (cd wdiff && \
+       (cd $(HOST_SUBDIR)/wdiff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21577,7 +21309,7 @@ mostlyclean-wdiff:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in wdiff" ; \
-       (cd wdiff && \
+       (cd $(HOST_SUBDIR)/wdiff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21602,7 +21334,7 @@ clean-wdiff:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in wdiff" ; \
-       (cd wdiff && \
+       (cd $(HOST_SUBDIR)/wdiff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21627,7 +21359,7 @@ distclean-wdiff:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in wdiff" ; \
-       (cd wdiff && \
+       (cd $(HOST_SUBDIR)/wdiff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21652,7 +21384,7 @@ maintainer-clean-wdiff:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in wdiff" ; \
-       (cd wdiff && \
+       (cd $(HOST_SUBDIR)/wdiff && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21668,24 +21400,20 @@ maybe-configure-zip:
 @if zip
 maybe-configure-zip: configure-zip
 configure-zip:
-       @test ! -f zip/Makefile || exit 0; \
-       [ -d zip ] || mkdir zip; \
+       @test ! -f $(HOST_SUBDIR)/zip/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zip ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in zip; \
-       cd zip || exit 1; \
+       cd $(HOST_SUBDIR)/zip || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/zip"; \
-           libsrcdir="$$s/zip";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/zip"; \
-           libsrcdir="$$s/zip";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/zip/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/zip"; \
+       libsrcdir="$$s/zip"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -21701,8 +21429,8 @@ all-zip: configure-zip
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd zip && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-zip))
+       (cd $(HOST_SUBDIR)/zip && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-zip))
 @endif zip
 
 .PHONY: check-zip maybe-check-zip
@@ -21717,7 +21445,8 @@ check-zip:
          s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
          $(SET_LIB_PATH) \
          $(HOST_EXPORTS) \
-         (cd zip && $(MAKE) $(FLAGS_TO_PASS)  check); \
+         (cd $(HOST_SUBDIR)/zip && \
+           $(MAKE) $(FLAGS_TO_PASS)  check)
        fi
 
 @endif zip
@@ -21732,7 +21461,8 @@ install-zip: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd zip && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/zip && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif zip
 
@@ -21754,7 +21484,7 @@ info-zip: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in zip" ; \
-       (cd zip && \
+       (cd $(HOST_SUBDIR)/zip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21780,7 +21510,7 @@ dvi-zip: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in zip" ; \
-       (cd zip && \
+       (cd $(HOST_SUBDIR)/zip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21806,7 +21536,7 @@ html-zip: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in zip" ; \
-       (cd zip && \
+       (cd $(HOST_SUBDIR)/zip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21832,7 +21562,7 @@ TAGS-zip: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in zip" ; \
-       (cd zip && \
+       (cd $(HOST_SUBDIR)/zip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21859,7 +21589,7 @@ install-info-zip: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in zip" ; \
-       (cd zip && \
+       (cd $(HOST_SUBDIR)/zip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21885,7 +21615,7 @@ installcheck-zip: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in zip" ; \
-       (cd zip && \
+       (cd $(HOST_SUBDIR)/zip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21910,7 +21640,7 @@ mostlyclean-zip:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in zip" ; \
-       (cd zip && \
+       (cd $(HOST_SUBDIR)/zip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21935,7 +21665,7 @@ clean-zip:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in zip" ; \
-       (cd zip && \
+       (cd $(HOST_SUBDIR)/zip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21960,7 +21690,7 @@ distclean-zip:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in zip" ; \
-       (cd zip && \
+       (cd $(HOST_SUBDIR)/zip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -21985,7 +21715,7 @@ maintainer-clean-zip:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in zip" ; \
-       (cd zip && \
+       (cd $(HOST_SUBDIR)/zip && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22002,24 +21732,20 @@ maybe-configure-zlib:
 maybe-configure-zlib: configure-zlib
 configure-zlib:
        @test -f stage_last && exit 0; \
-       test ! -f zlib/Makefile || exit 0; \
-       [ -d zlib ] || mkdir zlib; \
+       test ! -f $(HOST_SUBDIR)/zlib/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in zlib; \
-       cd zlib || exit 1; \
+       cd $(HOST_SUBDIR)/zlib || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/zlib"; \
-           libsrcdir="$$s/zlib";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/zlib"; \
-           libsrcdir="$$s/zlib";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/zlib/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/zlib"; \
+       libsrcdir="$$s/zlib"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -22036,8 +21762,8 @@ all-zlib: configure-zlib
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd zlib && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-zlib))
+       (cd $(HOST_SUBDIR)/zlib && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-zlib))
 @endif zlib
 
 .PHONY: check-zlib maybe-check-zlib
@@ -22076,7 +21802,7 @@ info-zlib: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in zlib" ; \
-       (cd zlib && \
+       (cd $(HOST_SUBDIR)/zlib && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22102,7 +21828,7 @@ dvi-zlib: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in zlib" ; \
-       (cd zlib && \
+       (cd $(HOST_SUBDIR)/zlib && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22128,7 +21854,7 @@ html-zlib: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in zlib" ; \
-       (cd zlib && \
+       (cd $(HOST_SUBDIR)/zlib && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22154,7 +21880,7 @@ TAGS-zlib: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in zlib" ; \
-       (cd zlib && \
+       (cd $(HOST_SUBDIR)/zlib && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22181,7 +21907,7 @@ install-info-zlib: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in zlib" ; \
-       (cd zlib && \
+       (cd $(HOST_SUBDIR)/zlib && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22207,7 +21933,7 @@ installcheck-zlib: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in zlib" ; \
-       (cd zlib && \
+       (cd $(HOST_SUBDIR)/zlib && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22232,7 +21958,7 @@ mostlyclean-zlib:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in zlib" ; \
-       (cd zlib && \
+       (cd $(HOST_SUBDIR)/zlib && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22257,7 +21983,7 @@ clean-zlib:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in zlib" ; \
-       (cd zlib && \
+       (cd $(HOST_SUBDIR)/zlib && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22282,7 +22008,7 @@ distclean-zlib:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in zlib" ; \
-       (cd zlib && \
+       (cd $(HOST_SUBDIR)/zlib && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22307,7 +22033,7 @@ maintainer-clean-zlib:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in zlib" ; \
-       (cd zlib && \
+       (cd $(HOST_SUBDIR)/zlib && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22323,24 +22049,20 @@ maybe-configure-gdb:
 @if gdb
 maybe-configure-gdb: configure-gdb
 configure-gdb:
-       @test ! -f gdb/Makefile || exit 0; \
-       [ -d gdb ] || mkdir gdb; \
+       @test ! -f $(HOST_SUBDIR)/gdb/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gdb ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in gdb; \
-       cd gdb || exit 1; \
+       cd $(HOST_SUBDIR)/gdb || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gdb"; \
-           libsrcdir="$$s/gdb";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gdb"; \
-           libsrcdir="$$s/gdb";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gdb/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gdb"; \
+       libsrcdir="$$s/gdb"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -22356,8 +22078,8 @@ all-gdb: configure-gdb
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gdb && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) \
-         $(TARGET-gdb))
+       (cd $(HOST_SUBDIR)/gdb && \
+         $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) $(TARGET-gdb))
 @endif gdb
 
 .PHONY: check-gdb maybe-check-gdb
@@ -22370,7 +22092,8 @@ check-gdb:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gdb && $(MAKE) $(FLAGS_TO_PASS)$(X11_FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/gdb && \
+         $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check)
 
 @endif gdb
 
@@ -22384,7 +22107,8 @@ install-gdb: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd gdb && $(MAKE) $(FLAGS_TO_PASS)$(X11_FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/gdb && \
+         $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install)
 
 @endif gdb
 
@@ -22406,7 +22130,7 @@ info-gdb: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in gdb" ; \
-       (cd gdb && \
+       (cd $(HOST_SUBDIR)/gdb && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22432,7 +22156,7 @@ dvi-gdb: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in gdb" ; \
-       (cd gdb && \
+       (cd $(HOST_SUBDIR)/gdb && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22458,7 +22182,7 @@ html-gdb: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in gdb" ; \
-       (cd gdb && \
+       (cd $(HOST_SUBDIR)/gdb && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22484,7 +22208,7 @@ TAGS-gdb: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in gdb" ; \
-       (cd gdb && \
+       (cd $(HOST_SUBDIR)/gdb && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22511,7 +22235,7 @@ install-info-gdb: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in gdb" ; \
-       (cd gdb && \
+       (cd $(HOST_SUBDIR)/gdb && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22537,7 +22261,7 @@ installcheck-gdb: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in gdb" ; \
-       (cd gdb && \
+       (cd $(HOST_SUBDIR)/gdb && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22562,7 +22286,7 @@ mostlyclean-gdb:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in gdb" ; \
-       (cd gdb && \
+       (cd $(HOST_SUBDIR)/gdb && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22587,7 +22311,7 @@ clean-gdb:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in gdb" ; \
-       (cd gdb && \
+       (cd $(HOST_SUBDIR)/gdb && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22612,7 +22336,7 @@ distclean-gdb:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in gdb" ; \
-       (cd gdb && \
+       (cd $(HOST_SUBDIR)/gdb && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22637,7 +22361,7 @@ maintainer-clean-gdb:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in gdb" ; \
-       (cd gdb && \
+       (cd $(HOST_SUBDIR)/gdb && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22653,24 +22377,20 @@ maybe-configure-expect:
 @if expect
 maybe-configure-expect: configure-expect
 configure-expect:
-       @test ! -f expect/Makefile || exit 0; \
-       [ -d expect ] || mkdir expect; \
+       @test ! -f $(HOST_SUBDIR)/expect/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/expect ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in expect; \
-       cd expect || exit 1; \
+       cd $(HOST_SUBDIR)/expect || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/expect"; \
-           libsrcdir="$$s/expect";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/expect"; \
-           libsrcdir="$$s/expect";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/expect/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/expect"; \
+       libsrcdir="$$s/expect"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -22686,8 +22406,8 @@ all-expect: configure-expect
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd expect && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) \
-         $(TARGET-expect))
+       (cd $(HOST_SUBDIR)/expect && \
+         $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) $(TARGET-expect))
 @endif expect
 
 .PHONY: check-expect maybe-check-expect
@@ -22700,7 +22420,8 @@ check-expect:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd expect && $(MAKE) $(FLAGS_TO_PASS)$(X11_FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/expect && \
+         $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check)
 
 @endif expect
 
@@ -22714,7 +22435,8 @@ install-expect: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd expect && $(MAKE) $(FLAGS_TO_PASS)$(X11_FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/expect && \
+         $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install)
 
 @endif expect
 
@@ -22736,7 +22458,7 @@ info-expect: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in expect" ; \
-       (cd expect && \
+       (cd $(HOST_SUBDIR)/expect && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22762,7 +22484,7 @@ dvi-expect: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in expect" ; \
-       (cd expect && \
+       (cd $(HOST_SUBDIR)/expect && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22788,7 +22510,7 @@ html-expect: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in expect" ; \
-       (cd expect && \
+       (cd $(HOST_SUBDIR)/expect && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22814,7 +22536,7 @@ TAGS-expect: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in expect" ; \
-       (cd expect && \
+       (cd $(HOST_SUBDIR)/expect && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22841,7 +22563,7 @@ install-info-expect: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in expect" ; \
-       (cd expect && \
+       (cd $(HOST_SUBDIR)/expect && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22867,7 +22589,7 @@ installcheck-expect: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in expect" ; \
-       (cd expect && \
+       (cd $(HOST_SUBDIR)/expect && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22892,7 +22614,7 @@ mostlyclean-expect:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in expect" ; \
-       (cd expect && \
+       (cd $(HOST_SUBDIR)/expect && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22917,7 +22639,7 @@ clean-expect:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in expect" ; \
-       (cd expect && \
+       (cd $(HOST_SUBDIR)/expect && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22942,7 +22664,7 @@ distclean-expect:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in expect" ; \
-       (cd expect && \
+       (cd $(HOST_SUBDIR)/expect && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22967,7 +22689,7 @@ maintainer-clean-expect:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in expect" ; \
-       (cd expect && \
+       (cd $(HOST_SUBDIR)/expect && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -22983,24 +22705,20 @@ maybe-configure-guile:
 @if guile
 maybe-configure-guile: configure-guile
 configure-guile:
-       @test ! -f guile/Makefile || exit 0; \
-       [ -d guile ] || mkdir guile; \
+       @test ! -f $(HOST_SUBDIR)/guile/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/guile ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in guile; \
-       cd guile || exit 1; \
+       cd $(HOST_SUBDIR)/guile || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/guile"; \
-           libsrcdir="$$s/guile";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/guile"; \
-           libsrcdir="$$s/guile";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/guile/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/guile"; \
+       libsrcdir="$$s/guile"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -23016,8 +22734,8 @@ all-guile: configure-guile
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd guile && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) \
-         $(TARGET-guile))
+       (cd $(HOST_SUBDIR)/guile && \
+         $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) $(TARGET-guile))
 @endif guile
 
 .PHONY: check-guile maybe-check-guile
@@ -23030,7 +22748,8 @@ check-guile:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd guile && $(MAKE) $(FLAGS_TO_PASS)$(X11_FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/guile && \
+         $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check)
 
 @endif guile
 
@@ -23044,7 +22763,8 @@ install-guile: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd guile && $(MAKE) $(FLAGS_TO_PASS)$(X11_FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/guile && \
+         $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install)
 
 @endif guile
 
@@ -23066,7 +22786,7 @@ info-guile: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in guile" ; \
-       (cd guile && \
+       (cd $(HOST_SUBDIR)/guile && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23092,7 +22812,7 @@ dvi-guile: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in guile" ; \
-       (cd guile && \
+       (cd $(HOST_SUBDIR)/guile && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23118,7 +22838,7 @@ html-guile: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in guile" ; \
-       (cd guile && \
+       (cd $(HOST_SUBDIR)/guile && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23144,7 +22864,7 @@ TAGS-guile: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in guile" ; \
-       (cd guile && \
+       (cd $(HOST_SUBDIR)/guile && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23171,7 +22891,7 @@ install-info-guile: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in guile" ; \
-       (cd guile && \
+       (cd $(HOST_SUBDIR)/guile && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23197,7 +22917,7 @@ installcheck-guile: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in guile" ; \
-       (cd guile && \
+       (cd $(HOST_SUBDIR)/guile && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23222,7 +22942,7 @@ mostlyclean-guile:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in guile" ; \
-       (cd guile && \
+       (cd $(HOST_SUBDIR)/guile && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23247,7 +22967,7 @@ clean-guile:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in guile" ; \
-       (cd guile && \
+       (cd $(HOST_SUBDIR)/guile && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23272,7 +22992,7 @@ distclean-guile:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in guile" ; \
-       (cd guile && \
+       (cd $(HOST_SUBDIR)/guile && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23297,7 +23017,7 @@ maintainer-clean-guile:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in guile" ; \
-       (cd guile && \
+       (cd $(HOST_SUBDIR)/guile && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23313,24 +23033,20 @@ maybe-configure-tk:
 @if tk
 maybe-configure-tk: configure-tk
 configure-tk:
-       @test ! -f tk/Makefile || exit 0; \
-       [ -d tk ] || mkdir tk; \
+       @test ! -f $(HOST_SUBDIR)/tk/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/tk ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in tk; \
-       cd tk || exit 1; \
+       cd $(HOST_SUBDIR)/tk || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/tk"; \
-           libsrcdir="$$s/tk";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/tk"; \
-           libsrcdir="$$s/tk";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/tk/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/tk"; \
+       libsrcdir="$$s/tk"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -23346,8 +23062,8 @@ all-tk: configure-tk
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd tk && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) \
-         $(TARGET-tk))
+       (cd $(HOST_SUBDIR)/tk && \
+         $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) $(TARGET-tk))
 @endif tk
 
 .PHONY: check-tk maybe-check-tk
@@ -23360,7 +23076,8 @@ check-tk:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd tk && $(MAKE) $(FLAGS_TO_PASS)$(X11_FLAGS_TO_PASS) check)
+       (cd $(HOST_SUBDIR)/tk && \
+         $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check)
 
 @endif tk
 
@@ -23374,7 +23091,8 @@ install-tk: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd tk && $(MAKE) $(FLAGS_TO_PASS)$(X11_FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/tk && \
+         $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install)
 
 @endif tk
 
@@ -23396,7 +23114,7 @@ info-tk: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in tk" ; \
-       (cd tk && \
+       (cd $(HOST_SUBDIR)/tk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23422,7 +23140,7 @@ dvi-tk: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in tk" ; \
-       (cd tk && \
+       (cd $(HOST_SUBDIR)/tk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23448,7 +23166,7 @@ html-tk: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in tk" ; \
-       (cd tk && \
+       (cd $(HOST_SUBDIR)/tk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23474,7 +23192,7 @@ TAGS-tk: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in tk" ; \
-       (cd tk && \
+       (cd $(HOST_SUBDIR)/tk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23501,7 +23219,7 @@ install-info-tk: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in tk" ; \
-       (cd tk && \
+       (cd $(HOST_SUBDIR)/tk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23527,7 +23245,7 @@ installcheck-tk: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in tk" ; \
-       (cd tk && \
+       (cd $(HOST_SUBDIR)/tk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23552,7 +23270,7 @@ mostlyclean-tk:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in tk" ; \
-       (cd tk && \
+       (cd $(HOST_SUBDIR)/tk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23577,7 +23295,7 @@ clean-tk:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in tk" ; \
-       (cd tk && \
+       (cd $(HOST_SUBDIR)/tk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23602,7 +23320,7 @@ distclean-tk:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in tk" ; \
-       (cd tk && \
+       (cd $(HOST_SUBDIR)/tk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23627,7 +23345,7 @@ maintainer-clean-tk:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in tk" ; \
-       (cd tk && \
+       (cd $(HOST_SUBDIR)/tk && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23643,24 +23361,20 @@ maybe-configure-libtermcap:
 @if libtermcap
 maybe-configure-libtermcap: configure-libtermcap
 configure-libtermcap:
-       @test ! -f libtermcap/Makefile || exit 0; \
-       [ -d libtermcap ] || mkdir libtermcap; \
+       @test ! -f $(HOST_SUBDIR)/libtermcap/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libtermcap ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in libtermcap; \
-       cd libtermcap || exit 1; \
+       cd $(HOST_SUBDIR)/libtermcap || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libtermcap"; \
-           libsrcdir="$$s/libtermcap";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libtermcap"; \
-           libsrcdir="$$s/libtermcap";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libtermcap/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libtermcap"; \
+       libsrcdir="$$s/libtermcap"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -23676,8 +23390,8 @@ all-libtermcap: configure-libtermcap
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd libtermcap && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-libtermcap))
+       (cd $(HOST_SUBDIR)/libtermcap && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-libtermcap))
 @endif libtermcap
 
 .PHONY: check-libtermcap maybe-check-libtermcap
@@ -23699,7 +23413,8 @@ install-libtermcap: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd libtermcap && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/libtermcap && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif libtermcap
 
@@ -23721,7 +23436,7 @@ info-libtermcap: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in libtermcap" ; \
-       (cd libtermcap && \
+       (cd $(HOST_SUBDIR)/libtermcap && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23747,7 +23462,7 @@ dvi-libtermcap: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in libtermcap" ; \
-       (cd libtermcap && \
+       (cd $(HOST_SUBDIR)/libtermcap && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23773,7 +23488,7 @@ html-libtermcap: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in libtermcap" ; \
-       (cd libtermcap && \
+       (cd $(HOST_SUBDIR)/libtermcap && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23799,7 +23514,7 @@ TAGS-libtermcap: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in libtermcap" ; \
-       (cd libtermcap && \
+       (cd $(HOST_SUBDIR)/libtermcap && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23826,7 +23541,7 @@ install-info-libtermcap: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in libtermcap" ; \
-       (cd libtermcap && \
+       (cd $(HOST_SUBDIR)/libtermcap && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23852,7 +23567,7 @@ installcheck-libtermcap: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in libtermcap" ; \
-       (cd libtermcap && \
+       (cd $(HOST_SUBDIR)/libtermcap && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -23908,24 +23623,20 @@ maybe-configure-utils:
 @if utils
 maybe-configure-utils: configure-utils
 configure-utils:
-       @test ! -f utils/Makefile || exit 0; \
-       [ -d utils ] || mkdir utils; \
+       @test ! -f $(HOST_SUBDIR)/utils/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/utils ; \
        r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(HOST_EXPORTS) \
        echo Configuring in utils; \
-       cd utils || exit 1; \
+       cd $(HOST_SUBDIR)/utils || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/utils"; \
-           libsrcdir="$$s/utils";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/utils"; \
-           libsrcdir="$$s/utils";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/utils/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/utils"; \
+       libsrcdir="$$s/utils"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption}  \
          || exit 1
@@ -23941,8 +23652,8 @@ all-utils: configure-utils
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd utils && $(MAKE) $(FLAGS_TO_PASS)  \
-         $(TARGET-utils))
+       (cd $(HOST_SUBDIR)/utils && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-utils))
 @endif utils
 
 .PHONY: check-utils maybe-check-utils
@@ -23964,7 +23675,8 @@ install-utils: installdirs
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        $(SET_LIB_PATH) \
        $(HOST_EXPORTS) \
-       (cd utils && $(MAKE) $(FLAGS_TO_PASS) install)
+       (cd $(HOST_SUBDIR)/utils && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
 
 @endif utils
 
@@ -23986,7 +23698,7 @@ info-utils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing info in utils" ; \
-       (cd utils && \
+       (cd $(HOST_SUBDIR)/utils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -24012,7 +23724,7 @@ dvi-utils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing dvi in utils" ; \
-       (cd utils && \
+       (cd $(HOST_SUBDIR)/utils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -24038,7 +23750,7 @@ html-utils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing html in utils" ; \
-       (cd utils && \
+       (cd $(HOST_SUBDIR)/utils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -24064,7 +23776,7 @@ TAGS-utils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing TAGS in utils" ; \
-       (cd utils && \
+       (cd $(HOST_SUBDIR)/utils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -24091,7 +23803,7 @@ install-info-utils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing install-info in utils" ; \
-       (cd utils && \
+       (cd $(HOST_SUBDIR)/utils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -24117,7 +23829,7 @@ installcheck-utils: \
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing installcheck in utils" ; \
-       (cd utils && \
+       (cd $(HOST_SUBDIR)/utils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -24142,7 +23854,7 @@ mostlyclean-utils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing mostlyclean in utils" ; \
-       (cd utils && \
+       (cd $(HOST_SUBDIR)/utils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -24167,7 +23879,7 @@ clean-utils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing clean in utils" ; \
-       (cd utils && \
+       (cd $(HOST_SUBDIR)/utils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -24192,7 +23904,7 @@ distclean-utils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing distclean in utils" ; \
-       (cd utils && \
+       (cd $(HOST_SUBDIR)/utils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -24217,7 +23929,7 @@ maintainer-clean-utils:
          eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
        done; \
        echo "Doing maintainer-clean in utils" ; \
-       (cd utils && \
+       (cd $(HOST_SUBDIR)/utils && \
          $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
                  "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
                  "RANLIB=$${RANLIB}" \
@@ -24228,6 +23940,334 @@ maintainer-clean-utils:
 @endif utils
 
 
+.PHONY: configure-gnattools maybe-configure-gnattools
+maybe-configure-gnattools:
+@if gnattools
+maybe-configure-gnattools: configure-gnattools
+configure-gnattools:
+       @test ! -f $(HOST_SUBDIR)/gnattools/Makefile || exit 0; \
+       $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gnattools ; \
+       r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+       $(HOST_EXPORTS) \
+       echo Configuring in gnattools; \
+       cd $(HOST_SUBDIR)/gnattools || exit 1; \
+       case $(srcdir) in \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gnattools/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+       esac; \
+       srcdiroption="--srcdir=$${topdir}/gnattools"; \
+       libsrcdir="$$s/gnattools"; \
+       $(SHELL) $${libsrcdir}/configure \
+         $(HOST_CONFIGARGS) $${srcdiroption}  \
+         || exit 1
+@endif gnattools
+
+.PHONY: all-gnattools maybe-all-gnattools
+maybe-all-gnattools:
+@if gnattools
+TARGET-gnattools=all
+maybe-all-gnattools: all-gnattools
+all-gnattools: configure-gnattools
+       @r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+       $(SET_LIB_PATH) \
+       $(HOST_EXPORTS) \
+       (cd $(HOST_SUBDIR)/gnattools && \
+         $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-gnattools))
+@endif gnattools
+
+.PHONY: check-gnattools maybe-check-gnattools
+maybe-check-gnattools:
+@if gnattools
+maybe-check-gnattools: check-gnattools
+
+check-gnattools:
+       @r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+       $(SET_LIB_PATH) \
+       $(HOST_EXPORTS) \
+       (cd $(HOST_SUBDIR)/gnattools && \
+         $(MAKE) $(FLAGS_TO_PASS)  check)
+
+@endif gnattools
+
+.PHONY: install-gnattools maybe-install-gnattools
+maybe-install-gnattools:
+@if gnattools
+maybe-install-gnattools: install-gnattools
+
+install-gnattools: installdirs
+       @r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+       $(SET_LIB_PATH) \
+       $(HOST_EXPORTS) \
+       (cd $(HOST_SUBDIR)/gnattools && \
+         $(MAKE) $(FLAGS_TO_PASS)  install)
+
+@endif gnattools
+
+# Other targets (info, dvi, etc.)
+
+.PHONY: maybe-info-gnattools info-gnattools
+maybe-info-gnattools:
+@if gnattools
+maybe-info-gnattools: info-gnattools
+
+info-gnattools: \
+    configure-gnattools 
+       @[ -f ./gnattools/Makefile ] || exit 0; \
+       r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+       $(SET_LIB_PATH) \
+       $(HOST_EXPORTS) \
+       for flag in $(EXTRA_HOST_FLAGS) ; do \
+         eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+       done; \
+       echo "Doing info in gnattools" ; \
+       (cd $(HOST_SUBDIR)/gnattools && \
+         $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+                 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+                 "RANLIB=$${RANLIB}" \
+                 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+                 info) \
+         || exit 1
+
+@endif gnattools
+
+.PHONY: maybe-dvi-gnattools dvi-gnattools
+maybe-dvi-gnattools:
+@if gnattools
+maybe-dvi-gnattools: dvi-gnattools
+
+dvi-gnattools: \
+    configure-gnattools 
+       @[ -f ./gnattools/Makefile ] || exit 0; \
+       r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+       $(SET_LIB_PATH) \
+       $(HOST_EXPORTS) \
+       for flag in $(EXTRA_HOST_FLAGS) ; do \
+         eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+       done; \
+       echo "Doing dvi in gnattools" ; \
+       (cd $(HOST_SUBDIR)/gnattools && \
+         $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+                 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+                 "RANLIB=$${RANLIB}" \
+                 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+                 dvi) \
+         || exit 1
+
+@endif gnattools
+
+.PHONY: maybe-html-gnattools html-gnattools
+maybe-html-gnattools:
+@if gnattools
+maybe-html-gnattools: html-gnattools
+
+html-gnattools: \
+    configure-gnattools 
+       @[ -f ./gnattools/Makefile ] || exit 0; \
+       r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+       $(SET_LIB_PATH) \
+       $(HOST_EXPORTS) \
+       for flag in $(EXTRA_HOST_FLAGS) ; do \
+         eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+       done; \
+       echo "Doing html in gnattools" ; \
+       (cd $(HOST_SUBDIR)/gnattools && \
+         $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+                 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+                 "RANLIB=$${RANLIB}" \
+                 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+                 html) \
+         || exit 1
+
+@endif gnattools
+
+.PHONY: maybe-TAGS-gnattools TAGS-gnattools
+maybe-TAGS-gnattools:
+@if gnattools
+maybe-TAGS-gnattools: TAGS-gnattools
+
+TAGS-gnattools: \
+    configure-gnattools 
+       @[ -f ./gnattools/Makefile ] || exit 0; \
+       r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+       $(SET_LIB_PATH) \
+       $(HOST_EXPORTS) \
+       for flag in $(EXTRA_HOST_FLAGS) ; do \
+         eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+       done; \
+       echo "Doing TAGS in gnattools" ; \
+       (cd $(HOST_SUBDIR)/gnattools && \
+         $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+                 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+                 "RANLIB=$${RANLIB}" \
+                 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+                 TAGS) \
+         || exit 1
+
+@endif gnattools
+
+.PHONY: maybe-install-info-gnattools install-info-gnattools
+maybe-install-info-gnattools:
+@if gnattools
+maybe-install-info-gnattools: install-info-gnattools
+
+install-info-gnattools: \
+    configure-gnattools \
+    info-gnattools 
+       @[ -f ./gnattools/Makefile ] || exit 0; \
+       r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+       $(SET_LIB_PATH) \
+       $(HOST_EXPORTS) \
+       for flag in $(EXTRA_HOST_FLAGS) ; do \
+         eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+       done; \
+       echo "Doing install-info in gnattools" ; \
+       (cd $(HOST_SUBDIR)/gnattools && \
+         $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+                 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+                 "RANLIB=$${RANLIB}" \
+                 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+                 install-info) \
+         || exit 1
+
+@endif gnattools
+
+.PHONY: maybe-installcheck-gnattools installcheck-gnattools
+maybe-installcheck-gnattools:
+@if gnattools
+maybe-installcheck-gnattools: installcheck-gnattools
+
+installcheck-gnattools: \
+    configure-gnattools 
+       @[ -f ./gnattools/Makefile ] || exit 0; \
+       r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+       $(SET_LIB_PATH) \
+       $(HOST_EXPORTS) \
+       for flag in $(EXTRA_HOST_FLAGS) ; do \
+         eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+       done; \
+       echo "Doing installcheck in gnattools" ; \
+       (cd $(HOST_SUBDIR)/gnattools && \
+         $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+                 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+                 "RANLIB=$${RANLIB}" \
+                 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+                 installcheck) \
+         || exit 1
+
+@endif gnattools
+
+.PHONY: maybe-mostlyclean-gnattools mostlyclean-gnattools
+maybe-mostlyclean-gnattools:
+@if gnattools
+maybe-mostlyclean-gnattools: mostlyclean-gnattools
+
+mostlyclean-gnattools: 
+       @[ -f ./gnattools/Makefile ] || exit 0; \
+       r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+       $(SET_LIB_PATH) \
+       $(HOST_EXPORTS) \
+       for flag in $(EXTRA_HOST_FLAGS) ; do \
+         eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+       done; \
+       echo "Doing mostlyclean in gnattools" ; \
+       (cd $(HOST_SUBDIR)/gnattools && \
+         $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+                 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+                 "RANLIB=$${RANLIB}" \
+                 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+                 mostlyclean) \
+         || exit 1
+
+@endif gnattools
+
+.PHONY: maybe-clean-gnattools clean-gnattools
+maybe-clean-gnattools:
+@if gnattools
+maybe-clean-gnattools: clean-gnattools
+
+clean-gnattools: 
+       @[ -f ./gnattools/Makefile ] || exit 0; \
+       r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+       $(SET_LIB_PATH) \
+       $(HOST_EXPORTS) \
+       for flag in $(EXTRA_HOST_FLAGS) ; do \
+         eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+       done; \
+       echo "Doing clean in gnattools" ; \
+       (cd $(HOST_SUBDIR)/gnattools && \
+         $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+                 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+                 "RANLIB=$${RANLIB}" \
+                 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+                 clean) \
+         || exit 1
+
+@endif gnattools
+
+.PHONY: maybe-distclean-gnattools distclean-gnattools
+maybe-distclean-gnattools:
+@if gnattools
+maybe-distclean-gnattools: distclean-gnattools
+
+distclean-gnattools: 
+       @[ -f ./gnattools/Makefile ] || exit 0; \
+       r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+       $(SET_LIB_PATH) \
+       $(HOST_EXPORTS) \
+       for flag in $(EXTRA_HOST_FLAGS) ; do \
+         eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+       done; \
+       echo "Doing distclean in gnattools" ; \
+       (cd $(HOST_SUBDIR)/gnattools && \
+         $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+                 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+                 "RANLIB=$${RANLIB}" \
+                 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+                 distclean) \
+         || exit 1
+
+@endif gnattools
+
+.PHONY: maybe-maintainer-clean-gnattools maintainer-clean-gnattools
+maybe-maintainer-clean-gnattools:
+@if gnattools
+maybe-maintainer-clean-gnattools: maintainer-clean-gnattools
+
+maintainer-clean-gnattools: 
+       @[ -f ./gnattools/Makefile ] || exit 0; \
+       r=`${PWD_COMMAND}`; export r; \
+       s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+       $(SET_LIB_PATH) \
+       $(HOST_EXPORTS) \
+       for flag in $(EXTRA_HOST_FLAGS) ; do \
+         eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+       done; \
+       echo "Doing maintainer-clean in gnattools" ; \
+       (cd $(HOST_SUBDIR)/gnattools && \
+         $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+                 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+                 "RANLIB=$${RANLIB}" \
+                 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+                 maintainer-clean) \
+         || exit 1
+
+@endif gnattools
+
+
 
 # ---------------------------------------
 # Modules which run on the target machine
@@ -24255,36 +24295,11 @@ configure-target-libstdc++-v3: $(TARGET_SUBDIR)/libstdc++-v3/multilib.out
        cd "$(TARGET_SUBDIR)/libstdc++-v3" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/libstdc++-v3/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/libstdc++-v3 "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../libstdc++-v3; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/libstdc++-v3"; \
-         libsrcdir="$$s/libstdc++-v3"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/libstdc++-v3"; \
+       libsrcdir="$$s/libstdc++-v3"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -24618,36 +24633,11 @@ configure-target-libmudflap: $(TARGET_SUBDIR)/libmudflap/multilib.out
        cd "$(TARGET_SUBDIR)/libmudflap" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/libmudflap/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/libmudflap "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../libmudflap; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/libmudflap"; \
-         libsrcdir="$$s/libmudflap"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/libmudflap"; \
+       libsrcdir="$$s/libmudflap"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -24981,36 +24971,11 @@ configure-target-newlib: $(TARGET_SUBDIR)/newlib/multilib.out
        cd "$(TARGET_SUBDIR)/newlib" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/newlib/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/newlib "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../newlib; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/newlib"; \
-         libsrcdir="$$s/newlib"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/newlib"; \
+       libsrcdir="$$s/newlib"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -25344,36 +25309,11 @@ configure-target-libgfortran: $(TARGET_SUBDIR)/libgfortran/multilib.out
        cd "$(TARGET_SUBDIR)/libgfortran" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/libgfortran/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/libgfortran "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../libgfortran; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/libgfortran"; \
-         libsrcdir="$$s/libgfortran"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/libgfortran"; \
+       libsrcdir="$$s/libgfortran"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -25707,36 +25647,11 @@ configure-target-libobjc: $(TARGET_SUBDIR)/libobjc/multilib.out
        cd "$(TARGET_SUBDIR)/libobjc" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/libobjc/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/libobjc "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../libobjc; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/libobjc"; \
-         libsrcdir="$$s/libobjc"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/libobjc"; \
+       libsrcdir="$$s/libobjc"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -26070,36 +25985,11 @@ configure-target-libtermcap: $(TARGET_SUBDIR)/libtermcap/multilib.out
        cd "$(TARGET_SUBDIR)/libtermcap" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/libtermcap/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/libtermcap "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../libtermcap; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/libtermcap"; \
-         libsrcdir="$$s/libtermcap"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/libtermcap"; \
+       libsrcdir="$$s/libtermcap"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -26368,36 +26258,11 @@ configure-target-winsup: $(TARGET_SUBDIR)/winsup/multilib.out
        cd "$(TARGET_SUBDIR)/winsup" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/winsup/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/winsup "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../winsup; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/winsup"; \
-         libsrcdir="$$s/winsup"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/winsup"; \
+       libsrcdir="$$s/winsup"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -26731,36 +26596,11 @@ configure-target-libgloss: $(TARGET_SUBDIR)/libgloss/multilib.out
        cd "$(TARGET_SUBDIR)/libgloss" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/libgloss/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/libgloss "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../libgloss; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/libgloss"; \
-         libsrcdir="$$s/libgloss"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/libgloss"; \
+       libsrcdir="$$s/libgloss"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -27089,36 +26929,11 @@ configure-target-libiberty: $(TARGET_SUBDIR)/libiberty/multilib.out
        cd "$(TARGET_SUBDIR)/libiberty" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/libiberty/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/libiberty "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../libiberty; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/libiberty"; \
-         libsrcdir="$$s/libiberty"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/libiberty"; \
+       libsrcdir="$$s/libiberty"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -27452,36 +27267,11 @@ configure-target-gperf: $(TARGET_SUBDIR)/gperf/multilib.out
        cd "$(TARGET_SUBDIR)/gperf" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/gperf/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/gperf "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../gperf; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/gperf"; \
-         libsrcdir="$$s/gperf"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/gperf"; \
+       libsrcdir="$$s/gperf"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -27815,36 +27605,11 @@ configure-target-examples: $(TARGET_SUBDIR)/examples/multilib.out
        cd "$(TARGET_SUBDIR)/examples" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/examples/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/examples "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../examples; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/examples"; \
-         libsrcdir="$$s/examples"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/examples"; \
+       libsrcdir="$$s/examples"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -28168,36 +27933,11 @@ configure-target-libffi: $(TARGET_SUBDIR)/libffi/multilib.out
        cd "$(TARGET_SUBDIR)/libffi" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/libffi/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/libffi "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../libffi; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/libffi"; \
-         libsrcdir="$$s/libffi"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/libffi"; \
+       libsrcdir="$$s/libffi"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -28531,36 +28271,11 @@ configure-target-libjava: $(TARGET_SUBDIR)/libjava/multilib.out
        cd "$(TARGET_SUBDIR)/libjava" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/libjava/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/libjava "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../libjava; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/libjava"; \
-         libsrcdir="$$s/libjava"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/libjava"; \
+       libsrcdir="$$s/libjava"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -28894,36 +28609,11 @@ configure-target-zlib: $(TARGET_SUBDIR)/zlib/multilib.out
        cd "$(TARGET_SUBDIR)/zlib" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/zlib/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/zlib "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../zlib; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/zlib"; \
-         libsrcdir="$$s/zlib"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/zlib"; \
+       libsrcdir="$$s/zlib"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -29257,36 +28947,11 @@ configure-target-boehm-gc: $(TARGET_SUBDIR)/boehm-gc/multilib.out
        cd "$(TARGET_SUBDIR)/boehm-gc" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/boehm-gc/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/boehm-gc "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../boehm-gc; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/boehm-gc"; \
-         libsrcdir="$$s/boehm-gc"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/boehm-gc"; \
+       libsrcdir="$$s/boehm-gc"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -29620,36 +29285,11 @@ configure-target-qthreads: $(TARGET_SUBDIR)/qthreads/multilib.out
        cd "$(TARGET_SUBDIR)/qthreads" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/qthreads/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/qthreads "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../qthreads; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/qthreads"; \
-         libsrcdir="$$s/qthreads"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/qthreads"; \
+       libsrcdir="$$s/qthreads"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -29983,36 +29623,11 @@ configure-target-rda: $(TARGET_SUBDIR)/rda/multilib.out
        cd "$(TARGET_SUBDIR)/rda" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/rda/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/rda "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../rda; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/rda"; \
-         libsrcdir="$$s/rda"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/rda"; \
+       libsrcdir="$$s/rda"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -30346,36 +29961,11 @@ configure-target-libada: $(TARGET_SUBDIR)/libada/multilib.out
        cd "$(TARGET_SUBDIR)/libada" || exit 1; \
        case $(srcdir) in \
          /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-         *) topdir="../../$(srcdir)" ;; \
+         *) topdir=`echo $(TARGET_SUBDIR)/libada/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
-       if [ "$(srcdir)" = "." ] ; then \
-         if $(SHELL) $$s/symlink-tree $${topdir}/libada "no-such-file" ; then \
-           if [ -f Makefile ]; then \
-             if $(MAKE) distclean; then \
-               true; \
-             else \
-               exit 1; \
-             fi; \
-           else \
-             true; \
-           fi; \
-         else \
-           exit 1; \
-         fi; \
-         if [ -d ../include ] ; then \
-           true; \
-         else \
-           mkdir ../include; \
-           cd ../include; \
-           $(SHELL) $$s/symlink-tree $${topdir}/include "no-such-file"; \
-           cd ../libada; \
-         fi; \
-         srcdiroption="--srcdir=."; \
-         libsrcdir="."; \
-       else \
-         srcdiroption="--srcdir=$${topdir}/libada"; \
-         libsrcdir="$$s/libada"; \
-       fi; \
+       srcdiroption="--srcdir=$${topdir}/libada"; \
+       libsrcdir="$$s/libada"; \
        rm -f no-such-file || : ; \
        CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
          $(TARGET_CONFIGARGS) $${srcdiroption} \
@@ -30886,79 +30476,110 @@ POSTSTAGE1_FLAGS_TO_PASS = \
 stage1-start::
        @[ -f stage_current ] && $(MAKE) `cat stage_current`-end || : ; \
        echo stage1 > stage_current ; \
-       echo stage1 > stage_last
+       echo stage1 > stage_last; \
+       $(mkinstalldirs) $(HOST_SUBDIR)
 @if bfd
-       @[ -d stage1-bfd ] || mkdir stage1-bfd; \
-       set stage1-bfd bfd ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage1-bfd ] || \
+         mkdir stage1-bfd; \
+       set stage1-bfd bfd ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif bfd
 @if opcodes
-       @[ -d stage1-opcodes ] || mkdir stage1-opcodes; \
-       set stage1-opcodes opcodes ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage1-opcodes ] || \
+         mkdir stage1-opcodes; \
+       set stage1-opcodes opcodes ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif opcodes
 @if binutils
-       @[ -d stage1-binutils ] || mkdir stage1-binutils; \
-       set stage1-binutils binutils ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage1-binutils ] || \
+         mkdir stage1-binutils; \
+       set stage1-binutils binutils ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif binutils
 @if gas
-       @[ -d stage1-gas ] || mkdir stage1-gas; \
-       set stage1-gas gas ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage1-gas ] || \
+         mkdir stage1-gas; \
+       set stage1-gas gas ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif gas
 @if gcc
-       @[ -d stage1-gcc ] || mkdir stage1-gcc; \
-       set stage1-gcc gcc ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage1-gcc ] || \
+         mkdir stage1-gcc; \
+       set stage1-gcc gcc ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif gcc
 @if intl
-       @[ -d stage1-intl ] || mkdir stage1-intl; \
-       set stage1-intl intl ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage1-intl ] || \
+         mkdir stage1-intl; \
+       set stage1-intl intl ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif intl
 @if ld
-       @[ -d stage1-ld ] || mkdir stage1-ld; \
-       set stage1-ld ld ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage1-ld ] || \
+         mkdir stage1-ld; \
+       set stage1-ld ld ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif ld
 @if libcpp
-       @[ -d stage1-libcpp ] || mkdir stage1-libcpp; \
-       set stage1-libcpp libcpp ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage1-libcpp ] || \
+         mkdir stage1-libcpp; \
+       set stage1-libcpp libcpp ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif libcpp
 @if libiberty
-       @[ -d stage1-libiberty ] || mkdir stage1-libiberty; \
-       set stage1-libiberty libiberty ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage1-libiberty ] || \
+         mkdir stage1-libiberty; \
+       set stage1-libiberty libiberty ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif libiberty
 @if zlib
-       @[ -d stage1-zlib ] || mkdir stage1-zlib; \
-       set stage1-zlib zlib ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage1-zlib ] || \
+         mkdir stage1-zlib; \
+       set stage1-zlib zlib ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif zlib
 
 stage1-end::
        @rm -f stage_current
 @if bfd
-       @set bfd stage1-bfd ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set bfd stage1-bfd ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif bfd
 @if opcodes
-       @set opcodes stage1-opcodes ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set opcodes stage1-opcodes ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif opcodes
 @if binutils
-       @set binutils stage1-binutils ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set binutils stage1-binutils ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif binutils
 @if gas
-       @set gas stage1-gas ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set gas stage1-gas ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif gas
 @if gcc
-       @set gcc stage1-gcc ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set gcc stage1-gcc ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif gcc
 @if intl
-       @set intl stage1-intl ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set intl stage1-intl ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif intl
 @if ld
-       @set ld stage1-ld ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set ld stage1-ld ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif ld
 @if libcpp
-       @set libcpp stage1-libcpp ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set libcpp stage1-libcpp ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif libcpp
 @if libiberty
-       @set libiberty stage1-libiberty ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set libiberty stage1-libiberty ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif libiberty
 @if zlib
-       @set zlib stage1-zlib ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set zlib stage1-zlib ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif zlib
 
 # Bubble a bugfix through all the stages up to stage 1.  They
@@ -30983,7 +30604,7 @@ all-stage1:     \
   maybe-all-stage1-ld \
   maybe-all-stage1-libcpp  \
   maybe-all-stage1-libiberty                        \
-  maybe-all-stage1-zlib       
+  maybe-all-stage1-zlib        
 
 do-clean: clean-stage1
 clean-stage1:     \
@@ -30996,7 +30617,7 @@ clean-stage1:     \
   maybe-clean-stage1-ld \
   maybe-clean-stage1-libcpp  \
   maybe-clean-stage1-libiberty                        \
-  maybe-clean-stage1-zlib       
+  maybe-clean-stage1-zlib        
 
 
 .PHONY: configure-stage1-bfd maybe-configure-stage1-bfd
@@ -31016,18 +30637,14 @@ configure-stage1-bfd:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
        echo Configuring stage 1 in bfd ; \
-       cd bfd || exit 1; \
+       cd $(HOST_SUBDIR)/bfd || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/bfd"; \
-           libsrcdir="$$s/bfd";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/bfd"; \
-           libsrcdir="$$s/bfd";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/bfd/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/bfd"; \
+       libsrcdir="$$s/bfd"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          --disable-intermodule           --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" 
@@ -31038,7 +30655,7 @@ all-stage1-bfd: configure-stage1-bfd
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
-       cd bfd && \
+       cd $(HOST_SUBDIR)/bfd && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)" 
 
@@ -31047,7 +30664,7 @@ clean-stage1-bfd:
        @[ -f bfd/Makefile ] || [ -f stage1-bfd/Makefile ] \
          || exit 0 ; \
        [ -f bfd/Makefile ] || $(MAKE) stage1-start ; \
-       cd bfd && \
+       cd $(HOST_SUBDIR)/bfd && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)"  clean
 @endif bfd-bootstrap
@@ -31070,18 +30687,14 @@ configure-stage1-opcodes:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
        echo Configuring stage 1 in opcodes ; \
-       cd opcodes || exit 1; \
+       cd $(HOST_SUBDIR)/opcodes || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/opcodes"; \
-           libsrcdir="$$s/opcodes";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/opcodes"; \
-           libsrcdir="$$s/opcodes";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/opcodes/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/opcodes"; \
+       libsrcdir="$$s/opcodes"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          --disable-intermodule           --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" 
@@ -31092,7 +30705,7 @@ all-stage1-opcodes: configure-stage1-opcodes
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
-       cd opcodes && \
+       cd $(HOST_SUBDIR)/opcodes && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)" 
 
@@ -31101,7 +30714,7 @@ clean-stage1-opcodes:
        @[ -f opcodes/Makefile ] || [ -f stage1-opcodes/Makefile ] \
          || exit 0 ; \
        [ -f opcodes/Makefile ] || $(MAKE) stage1-start ; \
-       cd opcodes && \
+       cd $(HOST_SUBDIR)/opcodes && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)"  clean
 @endif opcodes-bootstrap
@@ -31124,18 +30737,14 @@ configure-stage1-binutils:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
        echo Configuring stage 1 in binutils ; \
-       cd binutils || exit 1; \
+       cd $(HOST_SUBDIR)/binutils || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/binutils"; \
-           libsrcdir="$$s/binutils";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/binutils"; \
-           libsrcdir="$$s/binutils";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/binutils/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/binutils"; \
+       libsrcdir="$$s/binutils"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          --disable-intermodule           --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" 
@@ -31146,7 +30755,7 @@ all-stage1-binutils: configure-stage1-binutils
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
-       cd binutils && \
+       cd $(HOST_SUBDIR)/binutils && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)" 
 
@@ -31155,7 +30764,7 @@ clean-stage1-binutils:
        @[ -f binutils/Makefile ] || [ -f stage1-binutils/Makefile ] \
          || exit 0 ; \
        [ -f binutils/Makefile ] || $(MAKE) stage1-start ; \
-       cd binutils && \
+       cd $(HOST_SUBDIR)/binutils && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)"  clean
 @endif binutils-bootstrap
@@ -31178,18 +30787,14 @@ configure-stage1-gas:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
        echo Configuring stage 1 in gas ; \
-       cd gas || exit 1; \
+       cd $(HOST_SUBDIR)/gas || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gas"; \
-           libsrcdir="$$s/gas";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gas"; \
-           libsrcdir="$$s/gas";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gas/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gas"; \
+       libsrcdir="$$s/gas"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          --disable-intermodule           --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" 
@@ -31200,7 +30805,7 @@ all-stage1-gas: configure-stage1-gas
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
-       cd gas && \
+       cd $(HOST_SUBDIR)/gas && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)" 
 
@@ -31209,7 +30814,7 @@ clean-stage1-gas:
        @[ -f gas/Makefile ] || [ -f stage1-gas/Makefile ] \
          || exit 0 ; \
        [ -f gas/Makefile ] || $(MAKE) stage1-start ; \
-       cd gas && \
+       cd $(HOST_SUBDIR)/gas && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)"  clean
 @endif gas-bootstrap
@@ -31232,18 +30837,14 @@ configure-stage1-gcc:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
        echo Configuring stage 1 in gcc ; \
-       cd gcc || exit 1; \
+       cd $(HOST_SUBDIR)/gcc || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gcc"; \
-           libsrcdir="$$s/gcc";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gcc"; \
-           libsrcdir="$$s/gcc";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gcc/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gcc"; \
+       libsrcdir="$$s/gcc"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          --disable-intermodule           --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" 
@@ -31254,7 +30855,7 @@ all-stage1-gcc: configure-stage1-gcc
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
-       cd gcc && \
+       cd $(HOST_SUBDIR)/gcc && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)" $(EXTRA_GCC_FLAGS)
 
@@ -31263,7 +30864,7 @@ clean-stage1-gcc:
        @[ -f gcc/Makefile ] || [ -f stage1-gcc/Makefile ] \
          || exit 0 ; \
        [ -f gcc/Makefile ] || $(MAKE) stage1-start ; \
-       cd gcc && \
+       cd $(HOST_SUBDIR)/gcc && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)" $(EXTRA_GCC_FLAGS) clean
 @endif gcc-bootstrap
@@ -31286,18 +30887,14 @@ configure-stage1-intl:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
        echo Configuring stage 1 in intl ; \
-       cd intl || exit 1; \
+       cd $(HOST_SUBDIR)/intl || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/intl"; \
-           libsrcdir="$$s/intl";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/intl"; \
-           libsrcdir="$$s/intl";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/intl/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/intl"; \
+       libsrcdir="$$s/intl"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          --disable-intermodule           --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" 
@@ -31308,7 +30905,7 @@ all-stage1-intl: configure-stage1-intl
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
-       cd intl && \
+       cd $(HOST_SUBDIR)/intl && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)" 
 
@@ -31317,7 +30914,7 @@ clean-stage1-intl:
        @[ -f intl/Makefile ] || [ -f stage1-intl/Makefile ] \
          || exit 0 ; \
        [ -f intl/Makefile ] || $(MAKE) stage1-start ; \
-       cd intl && \
+       cd $(HOST_SUBDIR)/intl && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)"  clean
 @endif intl-bootstrap
@@ -31340,18 +30937,14 @@ configure-stage1-ld:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
        echo Configuring stage 1 in ld ; \
-       cd ld || exit 1; \
+       cd $(HOST_SUBDIR)/ld || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/ld"; \
-           libsrcdir="$$s/ld";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/ld"; \
-           libsrcdir="$$s/ld";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/ld/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/ld"; \
+       libsrcdir="$$s/ld"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          --disable-intermodule           --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" 
@@ -31362,7 +30955,7 @@ all-stage1-ld: configure-stage1-ld
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
-       cd ld && \
+       cd $(HOST_SUBDIR)/ld && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)" 
 
@@ -31371,7 +30964,7 @@ clean-stage1-ld:
        @[ -f ld/Makefile ] || [ -f stage1-ld/Makefile ] \
          || exit 0 ; \
        [ -f ld/Makefile ] || $(MAKE) stage1-start ; \
-       cd ld && \
+       cd $(HOST_SUBDIR)/ld && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)"  clean
 @endif ld-bootstrap
@@ -31394,18 +30987,14 @@ configure-stage1-libcpp:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
        echo Configuring stage 1 in libcpp ; \
-       cd libcpp || exit 1; \
+       cd $(HOST_SUBDIR)/libcpp || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libcpp"; \
-           libsrcdir="$$s/libcpp";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libcpp"; \
-           libsrcdir="$$s/libcpp";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libcpp/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libcpp"; \
+       libsrcdir="$$s/libcpp"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          --disable-intermodule           --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" 
@@ -31416,7 +31005,7 @@ all-stage1-libcpp: configure-stage1-libcpp
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
-       cd libcpp && \
+       cd $(HOST_SUBDIR)/libcpp && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)" 
 
@@ -31425,7 +31014,7 @@ clean-stage1-libcpp:
        @[ -f libcpp/Makefile ] || [ -f stage1-libcpp/Makefile ] \
          || exit 0 ; \
        [ -f libcpp/Makefile ] || $(MAKE) stage1-start ; \
-       cd libcpp && \
+       cd $(HOST_SUBDIR)/libcpp && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)"  clean
 @endif libcpp-bootstrap
@@ -31448,18 +31037,14 @@ configure-stage1-libiberty:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
        echo Configuring stage 1 in libiberty ; \
-       cd libiberty || exit 1; \
+       cd $(HOST_SUBDIR)/libiberty || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libiberty"; \
-           libsrcdir="$$s/libiberty";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libiberty"; \
-           libsrcdir="$$s/libiberty";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libiberty/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libiberty"; \
+       libsrcdir="$$s/libiberty"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          --disable-intermodule           --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" 
@@ -31470,7 +31055,7 @@ all-stage1-libiberty: configure-stage1-libiberty
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
-       cd libiberty && \
+       cd $(HOST_SUBDIR)/libiberty && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)" 
 
@@ -31479,7 +31064,7 @@ clean-stage1-libiberty:
        @[ -f libiberty/Makefile ] || [ -f stage1-libiberty/Makefile ] \
          || exit 0 ; \
        [ -f libiberty/Makefile ] || $(MAKE) stage1-start ; \
-       cd libiberty && \
+       cd $(HOST_SUBDIR)/libiberty && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)"  clean
 @endif libiberty-bootstrap
@@ -31502,18 +31087,14 @@ configure-stage1-zlib:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
        echo Configuring stage 1 in zlib ; \
-       cd zlib || exit 1; \
+       cd $(HOST_SUBDIR)/zlib || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/zlib"; \
-           libsrcdir="$$s/zlib";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/zlib"; \
-           libsrcdir="$$s/zlib";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/zlib/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/zlib"; \
+       libsrcdir="$$s/zlib"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          --disable-intermodule           --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" 
@@ -31524,7 +31105,7 @@ all-stage1-zlib: configure-stage1-zlib
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(HOST_EXPORTS)  \
-       cd zlib && \
+       cd $(HOST_SUBDIR)/zlib && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)" 
 
@@ -31533,7 +31114,7 @@ clean-stage1-zlib:
        @[ -f zlib/Makefile ] || [ -f stage1-zlib/Makefile ] \
          || exit 0 ; \
        [ -f zlib/Makefile ] || $(MAKE) stage1-start ; \
-       cd zlib && \
+       cd $(HOST_SUBDIR)/zlib && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                CFLAGS="$(STAGE1_CFLAGS)"  clean
 @endif zlib-bootstrap
@@ -31563,99 +31144,150 @@ distclean-stage1::
 stage2-start::
        @[ -f stage_current ] && $(MAKE) `cat stage_current`-end || : ; \
        echo stage2 > stage_current ; \
-       echo stage2 > stage_last
+       echo stage2 > stage_last; \
+       $(mkinstalldirs) $(HOST_SUBDIR)
 @if bfd
-       @[ -d stage2-bfd ] || mkdir stage2-bfd; \
-       set stage2-bfd bfd ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-bfd prev-bfd ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage2-bfd ] || \
+         mkdir stage2-bfd; \
+       set stage2-bfd bfd ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-bfd prev-bfd ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif bfd
 @if opcodes
-       @[ -d stage2-opcodes ] || mkdir stage2-opcodes; \
-       set stage2-opcodes opcodes ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-opcodes prev-opcodes ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage2-opcodes ] || \
+         mkdir stage2-opcodes; \
+       set stage2-opcodes opcodes ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-opcodes prev-opcodes ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif opcodes
 @if binutils
-       @[ -d stage2-binutils ] || mkdir stage2-binutils; \
-       set stage2-binutils binutils ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-binutils prev-binutils ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage2-binutils ] || \
+         mkdir stage2-binutils; \
+       set stage2-binutils binutils ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-binutils prev-binutils ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif binutils
 @if gas
-       @[ -d stage2-gas ] || mkdir stage2-gas; \
-       set stage2-gas gas ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-gas prev-gas ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage2-gas ] || \
+         mkdir stage2-gas; \
+       set stage2-gas gas ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-gas prev-gas ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif gas
 @if gcc
-       @[ -d stage2-gcc ] || mkdir stage2-gcc; \
-       set stage2-gcc gcc ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-gcc prev-gcc ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage2-gcc ] || \
+         mkdir stage2-gcc; \
+       set stage2-gcc gcc ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-gcc prev-gcc ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif gcc
 @if intl
-       @[ -d stage2-intl ] || mkdir stage2-intl; \
-       set stage2-intl intl ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-intl prev-intl ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage2-intl ] || \
+         mkdir stage2-intl; \
+       set stage2-intl intl ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-intl prev-intl ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif intl
 @if ld
-       @[ -d stage2-ld ] || mkdir stage2-ld; \
-       set stage2-ld ld ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-ld prev-ld ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage2-ld ] || \
+         mkdir stage2-ld; \
+       set stage2-ld ld ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-ld prev-ld ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif ld
 @if libcpp
-       @[ -d stage2-libcpp ] || mkdir stage2-libcpp; \
-       set stage2-libcpp libcpp ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-libcpp prev-libcpp ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage2-libcpp ] || \
+         mkdir stage2-libcpp; \
+       set stage2-libcpp libcpp ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-libcpp prev-libcpp ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif libcpp
 @if libiberty
-       @[ -d stage2-libiberty ] || mkdir stage2-libiberty; \
-       set stage2-libiberty libiberty ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-libiberty prev-libiberty ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage2-libiberty ] || \
+         mkdir stage2-libiberty; \
+       set stage2-libiberty libiberty ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-libiberty prev-libiberty ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif libiberty
 @if zlib
-       @[ -d stage2-zlib ] || mkdir stage2-zlib; \
-       set stage2-zlib zlib ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-zlib prev-zlib ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage2-zlib ] || \
+         mkdir stage2-zlib; \
+       set stage2-zlib zlib ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-zlib prev-zlib ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif zlib
 
 stage2-end::
        @rm -f stage_current
 @if bfd
-       @set bfd stage2-bfd ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-bfd stage1-bfd ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set bfd stage2-bfd ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-bfd stage1-bfd ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif bfd
 @if opcodes
-       @set opcodes stage2-opcodes ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-opcodes stage1-opcodes ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set opcodes stage2-opcodes ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-opcodes stage1-opcodes ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif opcodes
 @if binutils
-       @set binutils stage2-binutils ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-binutils stage1-binutils ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set binutils stage2-binutils ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-binutils stage1-binutils ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif binutils
 @if gas
-       @set gas stage2-gas ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-gas stage1-gas ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set gas stage2-gas ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-gas stage1-gas ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif gas
 @if gcc
-       @set gcc stage2-gcc ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-gcc stage1-gcc ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set gcc stage2-gcc ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-gcc stage1-gcc ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif gcc
 @if intl
-       @set intl stage2-intl ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-intl stage1-intl ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set intl stage2-intl ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-intl stage1-intl ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif intl
 @if ld
-       @set ld stage2-ld ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-ld stage1-ld ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set ld stage2-ld ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-ld stage1-ld ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif ld
 @if libcpp
-       @set libcpp stage2-libcpp ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-libcpp stage1-libcpp ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set libcpp stage2-libcpp ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-libcpp stage1-libcpp ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif libcpp
 @if libiberty
-       @set libiberty stage2-libiberty ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-libiberty stage1-libiberty ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set libiberty stage2-libiberty ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-libiberty stage1-libiberty ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif libiberty
 @if zlib
-       @set zlib stage2-zlib ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-zlib stage1-zlib ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set zlib stage2-zlib ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-zlib stage1-zlib ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif zlib
 
 # Bubble a bugfix through all the stages up to stage 2.  They
@@ -31680,7 +31312,7 @@ all-stage2:     \
   maybe-all-stage2-ld \
   maybe-all-stage2-libcpp  \
   maybe-all-stage2-libiberty                        \
-  maybe-all-stage2-zlib       
+  maybe-all-stage2-zlib        
 
 do-clean: clean-stage2
 clean-stage2:     \
@@ -31693,7 +31325,7 @@ clean-stage2:     \
   maybe-clean-stage2-ld \
   maybe-clean-stage2-libcpp  \
   maybe-clean-stage2-libiberty                        \
-  maybe-clean-stage2-zlib       
+  maybe-clean-stage2-zlib        
 
 
 .PHONY: configure-stage2-bfd maybe-configure-stage2-bfd
@@ -31713,18 +31345,14 @@ configure-stage2-bfd:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 2 in bfd ; \
-       cd bfd || exit 1; \
+       cd $(HOST_SUBDIR)/bfd || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/bfd"; \
-           libsrcdir="$$s/bfd";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/bfd"; \
-           libsrcdir="$$s/bfd";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/bfd/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/bfd"; \
+       libsrcdir="$$s/bfd"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -31735,7 +31363,7 @@ all-stage2-bfd: configure-stage2-bfd
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd bfd && \
+       cd $(HOST_SUBDIR)/bfd && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -31745,7 +31373,7 @@ clean-stage2-bfd:
        @[ -f bfd/Makefile ] || [ -f stage2-bfd/Makefile ] \
          || exit 0 ; \
        [ -f bfd/Makefile ] || $(MAKE) stage2-start ; \
-       cd bfd && \
+       cd $(HOST_SUBDIR)/bfd && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -31769,18 +31397,14 @@ configure-stage2-opcodes:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 2 in opcodes ; \
-       cd opcodes || exit 1; \
+       cd $(HOST_SUBDIR)/opcodes || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/opcodes"; \
-           libsrcdir="$$s/opcodes";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/opcodes"; \
-           libsrcdir="$$s/opcodes";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/opcodes/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/opcodes"; \
+       libsrcdir="$$s/opcodes"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -31791,7 +31415,7 @@ all-stage2-opcodes: configure-stage2-opcodes
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd opcodes && \
+       cd $(HOST_SUBDIR)/opcodes && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -31801,7 +31425,7 @@ clean-stage2-opcodes:
        @[ -f opcodes/Makefile ] || [ -f stage2-opcodes/Makefile ] \
          || exit 0 ; \
        [ -f opcodes/Makefile ] || $(MAKE) stage2-start ; \
-       cd opcodes && \
+       cd $(HOST_SUBDIR)/opcodes && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -31825,18 +31449,14 @@ configure-stage2-binutils:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 2 in binutils ; \
-       cd binutils || exit 1; \
+       cd $(HOST_SUBDIR)/binutils || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/binutils"; \
-           libsrcdir="$$s/binutils";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/binutils"; \
-           libsrcdir="$$s/binutils";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/binutils/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/binutils"; \
+       libsrcdir="$$s/binutils"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -31847,7 +31467,7 @@ all-stage2-binutils: configure-stage2-binutils
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd binutils && \
+       cd $(HOST_SUBDIR)/binutils && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -31857,7 +31477,7 @@ clean-stage2-binutils:
        @[ -f binutils/Makefile ] || [ -f stage2-binutils/Makefile ] \
          || exit 0 ; \
        [ -f binutils/Makefile ] || $(MAKE) stage2-start ; \
-       cd binutils && \
+       cd $(HOST_SUBDIR)/binutils && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -31881,18 +31501,14 @@ configure-stage2-gas:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 2 in gas ; \
-       cd gas || exit 1; \
+       cd $(HOST_SUBDIR)/gas || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gas"; \
-           libsrcdir="$$s/gas";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gas"; \
-           libsrcdir="$$s/gas";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gas/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gas"; \
+       libsrcdir="$$s/gas"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -31903,7 +31519,7 @@ all-stage2-gas: configure-stage2-gas
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd gas && \
+       cd $(HOST_SUBDIR)/gas && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -31913,7 +31529,7 @@ clean-stage2-gas:
        @[ -f gas/Makefile ] || [ -f stage2-gas/Makefile ] \
          || exit 0 ; \
        [ -f gas/Makefile ] || $(MAKE) stage2-start ; \
-       cd gas && \
+       cd $(HOST_SUBDIR)/gas && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -31937,18 +31553,14 @@ configure-stage2-gcc:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 2 in gcc ; \
-       cd gcc || exit 1; \
+       cd $(HOST_SUBDIR)/gcc || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gcc"; \
-           libsrcdir="$$s/gcc";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gcc"; \
-           libsrcdir="$$s/gcc";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gcc/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gcc"; \
+       libsrcdir="$$s/gcc"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -31959,7 +31571,7 @@ all-stage2-gcc: configure-stage2-gcc
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd gcc && \
+       cd $(HOST_SUBDIR)/gcc && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 $(EXTRA_GCC_FLAGS)
@@ -31969,7 +31581,7 @@ clean-stage2-gcc:
        @[ -f gcc/Makefile ] || [ -f stage2-gcc/Makefile ] \
          || exit 0 ; \
        [ -f gcc/Makefile ] || $(MAKE) stage2-start ; \
-       cd gcc && \
+       cd $(HOST_SUBDIR)/gcc && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 $(EXTRA_GCC_FLAGS) clean
@@ -31993,18 +31605,14 @@ configure-stage2-intl:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 2 in intl ; \
-       cd intl || exit 1; \
+       cd $(HOST_SUBDIR)/intl || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/intl"; \
-           libsrcdir="$$s/intl";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/intl"; \
-           libsrcdir="$$s/intl";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/intl/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/intl"; \
+       libsrcdir="$$s/intl"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -32015,7 +31623,7 @@ all-stage2-intl: configure-stage2-intl
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd intl && \
+       cd $(HOST_SUBDIR)/intl && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -32025,7 +31633,7 @@ clean-stage2-intl:
        @[ -f intl/Makefile ] || [ -f stage2-intl/Makefile ] \
          || exit 0 ; \
        [ -f intl/Makefile ] || $(MAKE) stage2-start ; \
-       cd intl && \
+       cd $(HOST_SUBDIR)/intl && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -32049,18 +31657,14 @@ configure-stage2-ld:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 2 in ld ; \
-       cd ld || exit 1; \
+       cd $(HOST_SUBDIR)/ld || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/ld"; \
-           libsrcdir="$$s/ld";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/ld"; \
-           libsrcdir="$$s/ld";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/ld/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/ld"; \
+       libsrcdir="$$s/ld"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -32071,7 +31675,7 @@ all-stage2-ld: configure-stage2-ld
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd ld && \
+       cd $(HOST_SUBDIR)/ld && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -32081,7 +31685,7 @@ clean-stage2-ld:
        @[ -f ld/Makefile ] || [ -f stage2-ld/Makefile ] \
          || exit 0 ; \
        [ -f ld/Makefile ] || $(MAKE) stage2-start ; \
-       cd ld && \
+       cd $(HOST_SUBDIR)/ld && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -32105,18 +31709,14 @@ configure-stage2-libcpp:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 2 in libcpp ; \
-       cd libcpp || exit 1; \
+       cd $(HOST_SUBDIR)/libcpp || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libcpp"; \
-           libsrcdir="$$s/libcpp";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libcpp"; \
-           libsrcdir="$$s/libcpp";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libcpp/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libcpp"; \
+       libsrcdir="$$s/libcpp"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -32127,7 +31727,7 @@ all-stage2-libcpp: configure-stage2-libcpp
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd libcpp && \
+       cd $(HOST_SUBDIR)/libcpp && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -32137,7 +31737,7 @@ clean-stage2-libcpp:
        @[ -f libcpp/Makefile ] || [ -f stage2-libcpp/Makefile ] \
          || exit 0 ; \
        [ -f libcpp/Makefile ] || $(MAKE) stage2-start ; \
-       cd libcpp && \
+       cd $(HOST_SUBDIR)/libcpp && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -32161,18 +31761,14 @@ configure-stage2-libiberty:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 2 in libiberty ; \
-       cd libiberty || exit 1; \
+       cd $(HOST_SUBDIR)/libiberty || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libiberty"; \
-           libsrcdir="$$s/libiberty";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libiberty"; \
-           libsrcdir="$$s/libiberty";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libiberty/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libiberty"; \
+       libsrcdir="$$s/libiberty"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -32183,7 +31779,7 @@ all-stage2-libiberty: configure-stage2-libiberty
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd libiberty && \
+       cd $(HOST_SUBDIR)/libiberty && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -32193,7 +31789,7 @@ clean-stage2-libiberty:
        @[ -f libiberty/Makefile ] || [ -f stage2-libiberty/Makefile ] \
          || exit 0 ; \
        [ -f libiberty/Makefile ] || $(MAKE) stage2-start ; \
-       cd libiberty && \
+       cd $(HOST_SUBDIR)/libiberty && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -32217,18 +31813,14 @@ configure-stage2-zlib:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 2 in zlib ; \
-       cd zlib || exit 1; \
+       cd $(HOST_SUBDIR)/zlib || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/zlib"; \
-           libsrcdir="$$s/zlib";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/zlib"; \
-           libsrcdir="$$s/zlib";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/zlib/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/zlib"; \
+       libsrcdir="$$s/zlib"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -32239,7 +31831,7 @@ all-stage2-zlib: configure-stage2-zlib
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd zlib && \
+       cd $(HOST_SUBDIR)/zlib && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -32249,7 +31841,7 @@ clean-stage2-zlib:
        @[ -f zlib/Makefile ] || [ -f stage2-zlib/Makefile ] \
          || exit 0 ; \
        [ -f zlib/Makefile ] || $(MAKE) stage2-start ; \
-       cd zlib && \
+       cd $(HOST_SUBDIR)/zlib && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -32283,99 +31875,150 @@ distclean-stage2::
 stage3-start::
        @[ -f stage_current ] && $(MAKE) `cat stage_current`-end || : ; \
        echo stage3 > stage_current ; \
-       echo stage3 > stage_last
+       echo stage3 > stage_last; \
+       $(mkinstalldirs) $(HOST_SUBDIR)
 @if bfd
-       @[ -d stage3-bfd ] || mkdir stage3-bfd; \
-       set stage3-bfd bfd ; @CREATE_LINK_TO_DIR@  ; \
-       set stage2-bfd prev-bfd ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage3-bfd ] || \
+         mkdir stage3-bfd; \
+       set stage3-bfd bfd ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage2-bfd prev-bfd ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif bfd
 @if opcodes
-       @[ -d stage3-opcodes ] || mkdir stage3-opcodes; \
-       set stage3-opcodes opcodes ; @CREATE_LINK_TO_DIR@  ; \
-       set stage2-opcodes prev-opcodes ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage3-opcodes ] || \
+         mkdir stage3-opcodes; \
+       set stage3-opcodes opcodes ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage2-opcodes prev-opcodes ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif opcodes
 @if binutils
-       @[ -d stage3-binutils ] || mkdir stage3-binutils; \
-       set stage3-binutils binutils ; @CREATE_LINK_TO_DIR@  ; \
-       set stage2-binutils prev-binutils ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage3-binutils ] || \
+         mkdir stage3-binutils; \
+       set stage3-binutils binutils ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage2-binutils prev-binutils ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif binutils
 @if gas
-       @[ -d stage3-gas ] || mkdir stage3-gas; \
-       set stage3-gas gas ; @CREATE_LINK_TO_DIR@  ; \
-       set stage2-gas prev-gas ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage3-gas ] || \
+         mkdir stage3-gas; \
+       set stage3-gas gas ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage2-gas prev-gas ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif gas
 @if gcc
-       @[ -d stage3-gcc ] || mkdir stage3-gcc; \
-       set stage3-gcc gcc ; @CREATE_LINK_TO_DIR@  ; \
-       set stage2-gcc prev-gcc ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage3-gcc ] || \
+         mkdir stage3-gcc; \
+       set stage3-gcc gcc ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage2-gcc prev-gcc ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif gcc
 @if intl
-       @[ -d stage3-intl ] || mkdir stage3-intl; \
-       set stage3-intl intl ; @CREATE_LINK_TO_DIR@  ; \
-       set stage2-intl prev-intl ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage3-intl ] || \
+         mkdir stage3-intl; \
+       set stage3-intl intl ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage2-intl prev-intl ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif intl
 @if ld
-       @[ -d stage3-ld ] || mkdir stage3-ld; \
-       set stage3-ld ld ; @CREATE_LINK_TO_DIR@  ; \
-       set stage2-ld prev-ld ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage3-ld ] || \
+         mkdir stage3-ld; \
+       set stage3-ld ld ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage2-ld prev-ld ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif ld
 @if libcpp
-       @[ -d stage3-libcpp ] || mkdir stage3-libcpp; \
-       set stage3-libcpp libcpp ; @CREATE_LINK_TO_DIR@  ; \
-       set stage2-libcpp prev-libcpp ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage3-libcpp ] || \
+         mkdir stage3-libcpp; \
+       set stage3-libcpp libcpp ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage2-libcpp prev-libcpp ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif libcpp
 @if libiberty
-       @[ -d stage3-libiberty ] || mkdir stage3-libiberty; \
-       set stage3-libiberty libiberty ; @CREATE_LINK_TO_DIR@  ; \
-       set stage2-libiberty prev-libiberty ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage3-libiberty ] || \
+         mkdir stage3-libiberty; \
+       set stage3-libiberty libiberty ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage2-libiberty prev-libiberty ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif libiberty
 @if zlib
-       @[ -d stage3-zlib ] || mkdir stage3-zlib; \
-       set stage3-zlib zlib ; @CREATE_LINK_TO_DIR@  ; \
-       set stage2-zlib prev-zlib ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage3-zlib ] || \
+         mkdir stage3-zlib; \
+       set stage3-zlib zlib ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage2-zlib prev-zlib ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif zlib
 
 stage3-end::
        @rm -f stage_current
 @if bfd
-       @set bfd stage3-bfd ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-bfd stage2-bfd ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set bfd stage3-bfd ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-bfd stage2-bfd ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif bfd
 @if opcodes
-       @set opcodes stage3-opcodes ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-opcodes stage2-opcodes ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set opcodes stage3-opcodes ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-opcodes stage2-opcodes ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif opcodes
 @if binutils
-       @set binutils stage3-binutils ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-binutils stage2-binutils ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set binutils stage3-binutils ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-binutils stage2-binutils ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif binutils
 @if gas
-       @set gas stage3-gas ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-gas stage2-gas ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set gas stage3-gas ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-gas stage2-gas ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif gas
 @if gcc
-       @set gcc stage3-gcc ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-gcc stage2-gcc ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set gcc stage3-gcc ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-gcc stage2-gcc ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif gcc
 @if intl
-       @set intl stage3-intl ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-intl stage2-intl ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set intl stage3-intl ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-intl stage2-intl ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif intl
 @if ld
-       @set ld stage3-ld ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-ld stage2-ld ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set ld stage3-ld ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-ld stage2-ld ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif ld
 @if libcpp
-       @set libcpp stage3-libcpp ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-libcpp stage2-libcpp ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set libcpp stage3-libcpp ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-libcpp stage2-libcpp ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif libcpp
 @if libiberty
-       @set libiberty stage3-libiberty ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-libiberty stage2-libiberty ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set libiberty stage3-libiberty ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-libiberty stage2-libiberty ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif libiberty
 @if zlib
-       @set zlib stage3-zlib ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-zlib stage2-zlib ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set zlib stage3-zlib ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-zlib stage2-zlib ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif zlib
 
 # Bubble a bugfix through all the stages up to stage 3.  They
@@ -32401,7 +32044,7 @@ all-stage3:     \
   maybe-all-stage3-ld \
   maybe-all-stage3-libcpp  \
   maybe-all-stage3-libiberty                        \
-  maybe-all-stage3-zlib       
+  maybe-all-stage3-zlib        
 
 do-clean: clean-stage3
 clean-stage3:     \
@@ -32414,7 +32057,7 @@ clean-stage3:     \
   maybe-clean-stage3-ld \
   maybe-clean-stage3-libcpp  \
   maybe-clean-stage3-libiberty                        \
-  maybe-clean-stage3-zlib       
+  maybe-clean-stage3-zlib        
 
 
 .PHONY: configure-stage3-bfd maybe-configure-stage3-bfd
@@ -32434,18 +32077,14 @@ configure-stage3-bfd:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 3 in bfd ; \
-       cd bfd || exit 1; \
+       cd $(HOST_SUBDIR)/bfd || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/bfd"; \
-           libsrcdir="$$s/bfd";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/bfd"; \
-           libsrcdir="$$s/bfd";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/bfd/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/bfd"; \
+       libsrcdir="$$s/bfd"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -32456,7 +32095,7 @@ all-stage3-bfd: configure-stage3-bfd
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd bfd && \
+       cd $(HOST_SUBDIR)/bfd && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -32466,7 +32105,7 @@ clean-stage3-bfd:
        @[ -f bfd/Makefile ] || [ -f stage3-bfd/Makefile ] \
          || exit 0 ; \
        [ -f bfd/Makefile ] || $(MAKE) stage3-start ; \
-       cd bfd && \
+       cd $(HOST_SUBDIR)/bfd && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -32490,18 +32129,14 @@ configure-stage3-opcodes:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 3 in opcodes ; \
-       cd opcodes || exit 1; \
+       cd $(HOST_SUBDIR)/opcodes || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/opcodes"; \
-           libsrcdir="$$s/opcodes";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/opcodes"; \
-           libsrcdir="$$s/opcodes";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/opcodes/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/opcodes"; \
+       libsrcdir="$$s/opcodes"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -32512,7 +32147,7 @@ all-stage3-opcodes: configure-stage3-opcodes
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd opcodes && \
+       cd $(HOST_SUBDIR)/opcodes && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -32522,7 +32157,7 @@ clean-stage3-opcodes:
        @[ -f opcodes/Makefile ] || [ -f stage3-opcodes/Makefile ] \
          || exit 0 ; \
        [ -f opcodes/Makefile ] || $(MAKE) stage3-start ; \
-       cd opcodes && \
+       cd $(HOST_SUBDIR)/opcodes && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -32546,18 +32181,14 @@ configure-stage3-binutils:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 3 in binutils ; \
-       cd binutils || exit 1; \
+       cd $(HOST_SUBDIR)/binutils || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/binutils"; \
-           libsrcdir="$$s/binutils";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/binutils"; \
-           libsrcdir="$$s/binutils";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/binutils/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/binutils"; \
+       libsrcdir="$$s/binutils"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -32568,7 +32199,7 @@ all-stage3-binutils: configure-stage3-binutils
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd binutils && \
+       cd $(HOST_SUBDIR)/binutils && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -32578,7 +32209,7 @@ clean-stage3-binutils:
        @[ -f binutils/Makefile ] || [ -f stage3-binutils/Makefile ] \
          || exit 0 ; \
        [ -f binutils/Makefile ] || $(MAKE) stage3-start ; \
-       cd binutils && \
+       cd $(HOST_SUBDIR)/binutils && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -32602,18 +32233,14 @@ configure-stage3-gas:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 3 in gas ; \
-       cd gas || exit 1; \
+       cd $(HOST_SUBDIR)/gas || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gas"; \
-           libsrcdir="$$s/gas";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gas"; \
-           libsrcdir="$$s/gas";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gas/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gas"; \
+       libsrcdir="$$s/gas"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -32624,7 +32251,7 @@ all-stage3-gas: configure-stage3-gas
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd gas && \
+       cd $(HOST_SUBDIR)/gas && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -32634,7 +32261,7 @@ clean-stage3-gas:
        @[ -f gas/Makefile ] || [ -f stage3-gas/Makefile ] \
          || exit 0 ; \
        [ -f gas/Makefile ] || $(MAKE) stage3-start ; \
-       cd gas && \
+       cd $(HOST_SUBDIR)/gas && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -32658,18 +32285,14 @@ configure-stage3-gcc:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 3 in gcc ; \
-       cd gcc || exit 1; \
+       cd $(HOST_SUBDIR)/gcc || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gcc"; \
-           libsrcdir="$$s/gcc";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gcc"; \
-           libsrcdir="$$s/gcc";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gcc/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gcc"; \
+       libsrcdir="$$s/gcc"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -32680,7 +32303,7 @@ all-stage3-gcc: configure-stage3-gcc
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd gcc && \
+       cd $(HOST_SUBDIR)/gcc && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 $(EXTRA_GCC_FLAGS)
@@ -32690,7 +32313,7 @@ clean-stage3-gcc:
        @[ -f gcc/Makefile ] || [ -f stage3-gcc/Makefile ] \
          || exit 0 ; \
        [ -f gcc/Makefile ] || $(MAKE) stage3-start ; \
-       cd gcc && \
+       cd $(HOST_SUBDIR)/gcc && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 $(EXTRA_GCC_FLAGS) clean
@@ -32714,18 +32337,14 @@ configure-stage3-intl:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 3 in intl ; \
-       cd intl || exit 1; \
+       cd $(HOST_SUBDIR)/intl || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/intl"; \
-           libsrcdir="$$s/intl";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/intl"; \
-           libsrcdir="$$s/intl";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/intl/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/intl"; \
+       libsrcdir="$$s/intl"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -32736,7 +32355,7 @@ all-stage3-intl: configure-stage3-intl
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd intl && \
+       cd $(HOST_SUBDIR)/intl && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -32746,7 +32365,7 @@ clean-stage3-intl:
        @[ -f intl/Makefile ] || [ -f stage3-intl/Makefile ] \
          || exit 0 ; \
        [ -f intl/Makefile ] || $(MAKE) stage3-start ; \
-       cd intl && \
+       cd $(HOST_SUBDIR)/intl && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -32770,18 +32389,14 @@ configure-stage3-ld:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 3 in ld ; \
-       cd ld || exit 1; \
+       cd $(HOST_SUBDIR)/ld || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/ld"; \
-           libsrcdir="$$s/ld";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/ld"; \
-           libsrcdir="$$s/ld";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/ld/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/ld"; \
+       libsrcdir="$$s/ld"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -32792,7 +32407,7 @@ all-stage3-ld: configure-stage3-ld
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd ld && \
+       cd $(HOST_SUBDIR)/ld && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -32802,7 +32417,7 @@ clean-stage3-ld:
        @[ -f ld/Makefile ] || [ -f stage3-ld/Makefile ] \
          || exit 0 ; \
        [ -f ld/Makefile ] || $(MAKE) stage3-start ; \
-       cd ld && \
+       cd $(HOST_SUBDIR)/ld && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -32826,18 +32441,14 @@ configure-stage3-libcpp:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 3 in libcpp ; \
-       cd libcpp || exit 1; \
+       cd $(HOST_SUBDIR)/libcpp || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libcpp"; \
-           libsrcdir="$$s/libcpp";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libcpp"; \
-           libsrcdir="$$s/libcpp";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libcpp/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libcpp"; \
+       libsrcdir="$$s/libcpp"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -32848,7 +32459,7 @@ all-stage3-libcpp: configure-stage3-libcpp
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd libcpp && \
+       cd $(HOST_SUBDIR)/libcpp && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -32858,7 +32469,7 @@ clean-stage3-libcpp:
        @[ -f libcpp/Makefile ] || [ -f stage3-libcpp/Makefile ] \
          || exit 0 ; \
        [ -f libcpp/Makefile ] || $(MAKE) stage3-start ; \
-       cd libcpp && \
+       cd $(HOST_SUBDIR)/libcpp && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -32882,18 +32493,14 @@ configure-stage3-libiberty:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 3 in libiberty ; \
-       cd libiberty || exit 1; \
+       cd $(HOST_SUBDIR)/libiberty || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libiberty"; \
-           libsrcdir="$$s/libiberty";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libiberty"; \
-           libsrcdir="$$s/libiberty";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libiberty/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libiberty"; \
+       libsrcdir="$$s/libiberty"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -32904,7 +32511,7 @@ all-stage3-libiberty: configure-stage3-libiberty
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd libiberty && \
+       cd $(HOST_SUBDIR)/libiberty && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -32914,7 +32521,7 @@ clean-stage3-libiberty:
        @[ -f libiberty/Makefile ] || [ -f stage3-libiberty/Makefile ] \
          || exit 0 ; \
        [ -f libiberty/Makefile ] || $(MAKE) stage3-start ; \
-       cd libiberty && \
+       cd $(HOST_SUBDIR)/libiberty && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -32938,18 +32545,14 @@ configure-stage3-zlib:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 3 in zlib ; \
-       cd zlib || exit 1; \
+       cd $(HOST_SUBDIR)/zlib || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/zlib"; \
-           libsrcdir="$$s/zlib";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/zlib"; \
-           libsrcdir="$$s/zlib";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/zlib/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/zlib"; \
+       libsrcdir="$$s/zlib"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -32960,7 +32563,7 @@ all-stage3-zlib: configure-stage3-zlib
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd zlib && \
+       cd $(HOST_SUBDIR)/zlib && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -32970,7 +32573,7 @@ clean-stage3-zlib:
        @[ -f zlib/Makefile ] || [ -f stage3-zlib/Makefile ] \
          || exit 0 ; \
        [ -f zlib/Makefile ] || $(MAKE) stage3-start ; \
-       cd zlib && \
+       cd $(HOST_SUBDIR)/zlib && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -33034,99 +32637,150 @@ cleanstrap: distclean bootstrap
 stage4-start::
        @[ -f stage_current ] && $(MAKE) `cat stage_current`-end || : ; \
        echo stage4 > stage_current ; \
-       echo stage4 > stage_last
+       echo stage4 > stage_last; \
+       $(mkinstalldirs) $(HOST_SUBDIR)
 @if bfd
-       @[ -d stage4-bfd ] || mkdir stage4-bfd; \
-       set stage4-bfd bfd ; @CREATE_LINK_TO_DIR@  ; \
-       set stage3-bfd prev-bfd ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage4-bfd ] || \
+         mkdir stage4-bfd; \
+       set stage4-bfd bfd ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage3-bfd prev-bfd ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif bfd
 @if opcodes
-       @[ -d stage4-opcodes ] || mkdir stage4-opcodes; \
-       set stage4-opcodes opcodes ; @CREATE_LINK_TO_DIR@  ; \
-       set stage3-opcodes prev-opcodes ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage4-opcodes ] || \
+         mkdir stage4-opcodes; \
+       set stage4-opcodes opcodes ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage3-opcodes prev-opcodes ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif opcodes
 @if binutils
-       @[ -d stage4-binutils ] || mkdir stage4-binutils; \
-       set stage4-binutils binutils ; @CREATE_LINK_TO_DIR@  ; \
-       set stage3-binutils prev-binutils ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage4-binutils ] || \
+         mkdir stage4-binutils; \
+       set stage4-binutils binutils ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage3-binutils prev-binutils ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif binutils
 @if gas
-       @[ -d stage4-gas ] || mkdir stage4-gas; \
-       set stage4-gas gas ; @CREATE_LINK_TO_DIR@  ; \
-       set stage3-gas prev-gas ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage4-gas ] || \
+         mkdir stage4-gas; \
+       set stage4-gas gas ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage3-gas prev-gas ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif gas
 @if gcc
-       @[ -d stage4-gcc ] || mkdir stage4-gcc; \
-       set stage4-gcc gcc ; @CREATE_LINK_TO_DIR@  ; \
-       set stage3-gcc prev-gcc ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage4-gcc ] || \
+         mkdir stage4-gcc; \
+       set stage4-gcc gcc ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage3-gcc prev-gcc ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif gcc
 @if intl
-       @[ -d stage4-intl ] || mkdir stage4-intl; \
-       set stage4-intl intl ; @CREATE_LINK_TO_DIR@  ; \
-       set stage3-intl prev-intl ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage4-intl ] || \
+         mkdir stage4-intl; \
+       set stage4-intl intl ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage3-intl prev-intl ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif intl
 @if ld
-       @[ -d stage4-ld ] || mkdir stage4-ld; \
-       set stage4-ld ld ; @CREATE_LINK_TO_DIR@  ; \
-       set stage3-ld prev-ld ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage4-ld ] || \
+         mkdir stage4-ld; \
+       set stage4-ld ld ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage3-ld prev-ld ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif ld
 @if libcpp
-       @[ -d stage4-libcpp ] || mkdir stage4-libcpp; \
-       set stage4-libcpp libcpp ; @CREATE_LINK_TO_DIR@  ; \
-       set stage3-libcpp prev-libcpp ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage4-libcpp ] || \
+         mkdir stage4-libcpp; \
+       set stage4-libcpp libcpp ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage3-libcpp prev-libcpp ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif libcpp
 @if libiberty
-       @[ -d stage4-libiberty ] || mkdir stage4-libiberty; \
-       set stage4-libiberty libiberty ; @CREATE_LINK_TO_DIR@  ; \
-       set stage3-libiberty prev-libiberty ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage4-libiberty ] || \
+         mkdir stage4-libiberty; \
+       set stage4-libiberty libiberty ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage3-libiberty prev-libiberty ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif libiberty
 @if zlib
-       @[ -d stage4-zlib ] || mkdir stage4-zlib; \
-       set stage4-zlib zlib ; @CREATE_LINK_TO_DIR@  ; \
-       set stage3-zlib prev-zlib ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stage4-zlib ] || \
+         mkdir stage4-zlib; \
+       set stage4-zlib zlib ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage3-zlib prev-zlib ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif zlib
 
 stage4-end::
        @rm -f stage_current
 @if bfd
-       @set bfd stage4-bfd ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-bfd stage3-bfd ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set bfd stage4-bfd ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-bfd stage3-bfd ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif bfd
 @if opcodes
-       @set opcodes stage4-opcodes ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-opcodes stage3-opcodes ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set opcodes stage4-opcodes ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-opcodes stage3-opcodes ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif opcodes
 @if binutils
-       @set binutils stage4-binutils ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-binutils stage3-binutils ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set binutils stage4-binutils ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-binutils stage3-binutils ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif binutils
 @if gas
-       @set gas stage4-gas ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-gas stage3-gas ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set gas stage4-gas ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-gas stage3-gas ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif gas
 @if gcc
-       @set gcc stage4-gcc ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-gcc stage3-gcc ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set gcc stage4-gcc ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-gcc stage3-gcc ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif gcc
 @if intl
-       @set intl stage4-intl ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-intl stage3-intl ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set intl stage4-intl ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-intl stage3-intl ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif intl
 @if ld
-       @set ld stage4-ld ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-ld stage3-ld ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set ld stage4-ld ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-ld stage3-ld ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif ld
 @if libcpp
-       @set libcpp stage4-libcpp ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-libcpp stage3-libcpp ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set libcpp stage4-libcpp ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-libcpp stage3-libcpp ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif libcpp
 @if libiberty
-       @set libiberty stage4-libiberty ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-libiberty stage3-libiberty ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set libiberty stage4-libiberty ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-libiberty stage3-libiberty ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif libiberty
 @if zlib
-       @set zlib stage4-zlib ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-zlib stage3-zlib ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set zlib stage4-zlib ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-zlib stage3-zlib ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif zlib
 
 # Bubble a bugfix through all the stages up to stage 4.  They
@@ -33152,7 +32806,7 @@ all-stage4:     \
   maybe-all-stage4-ld \
   maybe-all-stage4-libcpp  \
   maybe-all-stage4-libiberty                        \
-  maybe-all-stage4-zlib       
+  maybe-all-stage4-zlib        
 
 do-clean: clean-stage4
 clean-stage4:     \
@@ -33165,7 +32819,7 @@ clean-stage4:     \
   maybe-clean-stage4-ld \
   maybe-clean-stage4-libcpp  \
   maybe-clean-stage4-libiberty                        \
-  maybe-clean-stage4-zlib       
+  maybe-clean-stage4-zlib        
 
 
 .PHONY: configure-stage4-bfd maybe-configure-stage4-bfd
@@ -33185,18 +32839,14 @@ configure-stage4-bfd:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 4 in bfd ; \
-       cd bfd || exit 1; \
+       cd $(HOST_SUBDIR)/bfd || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/bfd"; \
-           libsrcdir="$$s/bfd";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/bfd"; \
-           libsrcdir="$$s/bfd";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/bfd/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/bfd"; \
+       libsrcdir="$$s/bfd"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -33207,7 +32857,7 @@ all-stage4-bfd: configure-stage4-bfd
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd bfd && \
+       cd $(HOST_SUBDIR)/bfd && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -33217,7 +32867,7 @@ clean-stage4-bfd:
        @[ -f bfd/Makefile ] || [ -f stage4-bfd/Makefile ] \
          || exit 0 ; \
        [ -f bfd/Makefile ] || $(MAKE) stage4-start ; \
-       cd bfd && \
+       cd $(HOST_SUBDIR)/bfd && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -33241,18 +32891,14 @@ configure-stage4-opcodes:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 4 in opcodes ; \
-       cd opcodes || exit 1; \
+       cd $(HOST_SUBDIR)/opcodes || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/opcodes"; \
-           libsrcdir="$$s/opcodes";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/opcodes"; \
-           libsrcdir="$$s/opcodes";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/opcodes/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/opcodes"; \
+       libsrcdir="$$s/opcodes"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -33263,7 +32909,7 @@ all-stage4-opcodes: configure-stage4-opcodes
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd opcodes && \
+       cd $(HOST_SUBDIR)/opcodes && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -33273,7 +32919,7 @@ clean-stage4-opcodes:
        @[ -f opcodes/Makefile ] || [ -f stage4-opcodes/Makefile ] \
          || exit 0 ; \
        [ -f opcodes/Makefile ] || $(MAKE) stage4-start ; \
-       cd opcodes && \
+       cd $(HOST_SUBDIR)/opcodes && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -33297,18 +32943,14 @@ configure-stage4-binutils:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 4 in binutils ; \
-       cd binutils || exit 1; \
+       cd $(HOST_SUBDIR)/binutils || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/binutils"; \
-           libsrcdir="$$s/binutils";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/binutils"; \
-           libsrcdir="$$s/binutils";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/binutils/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/binutils"; \
+       libsrcdir="$$s/binutils"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -33319,7 +32961,7 @@ all-stage4-binutils: configure-stage4-binutils
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd binutils && \
+       cd $(HOST_SUBDIR)/binutils && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -33329,7 +32971,7 @@ clean-stage4-binutils:
        @[ -f binutils/Makefile ] || [ -f stage4-binutils/Makefile ] \
          || exit 0 ; \
        [ -f binutils/Makefile ] || $(MAKE) stage4-start ; \
-       cd binutils && \
+       cd $(HOST_SUBDIR)/binutils && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -33353,18 +32995,14 @@ configure-stage4-gas:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 4 in gas ; \
-       cd gas || exit 1; \
+       cd $(HOST_SUBDIR)/gas || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gas"; \
-           libsrcdir="$$s/gas";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gas"; \
-           libsrcdir="$$s/gas";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gas/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gas"; \
+       libsrcdir="$$s/gas"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -33375,7 +33013,7 @@ all-stage4-gas: configure-stage4-gas
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd gas && \
+       cd $(HOST_SUBDIR)/gas && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -33385,7 +33023,7 @@ clean-stage4-gas:
        @[ -f gas/Makefile ] || [ -f stage4-gas/Makefile ] \
          || exit 0 ; \
        [ -f gas/Makefile ] || $(MAKE) stage4-start ; \
-       cd gas && \
+       cd $(HOST_SUBDIR)/gas && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -33409,18 +33047,14 @@ configure-stage4-gcc:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 4 in gcc ; \
-       cd gcc || exit 1; \
+       cd $(HOST_SUBDIR)/gcc || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gcc"; \
-           libsrcdir="$$s/gcc";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gcc"; \
-           libsrcdir="$$s/gcc";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gcc/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gcc"; \
+       libsrcdir="$$s/gcc"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -33431,7 +33065,7 @@ all-stage4-gcc: configure-stage4-gcc
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd gcc && \
+       cd $(HOST_SUBDIR)/gcc && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 $(EXTRA_GCC_FLAGS)
@@ -33441,7 +33075,7 @@ clean-stage4-gcc:
        @[ -f gcc/Makefile ] || [ -f stage4-gcc/Makefile ] \
          || exit 0 ; \
        [ -f gcc/Makefile ] || $(MAKE) stage4-start ; \
-       cd gcc && \
+       cd $(HOST_SUBDIR)/gcc && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 $(EXTRA_GCC_FLAGS) clean
@@ -33465,18 +33099,14 @@ configure-stage4-intl:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 4 in intl ; \
-       cd intl || exit 1; \
+       cd $(HOST_SUBDIR)/intl || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/intl"; \
-           libsrcdir="$$s/intl";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/intl"; \
-           libsrcdir="$$s/intl";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/intl/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/intl"; \
+       libsrcdir="$$s/intl"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -33487,7 +33117,7 @@ all-stage4-intl: configure-stage4-intl
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd intl && \
+       cd $(HOST_SUBDIR)/intl && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -33497,7 +33127,7 @@ clean-stage4-intl:
        @[ -f intl/Makefile ] || [ -f stage4-intl/Makefile ] \
          || exit 0 ; \
        [ -f intl/Makefile ] || $(MAKE) stage4-start ; \
-       cd intl && \
+       cd $(HOST_SUBDIR)/intl && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -33521,18 +33151,14 @@ configure-stage4-ld:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 4 in ld ; \
-       cd ld || exit 1; \
+       cd $(HOST_SUBDIR)/ld || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/ld"; \
-           libsrcdir="$$s/ld";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/ld"; \
-           libsrcdir="$$s/ld";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/ld/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/ld"; \
+       libsrcdir="$$s/ld"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -33543,7 +33169,7 @@ all-stage4-ld: configure-stage4-ld
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd ld && \
+       cd $(HOST_SUBDIR)/ld && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -33553,7 +33179,7 @@ clean-stage4-ld:
        @[ -f ld/Makefile ] || [ -f stage4-ld/Makefile ] \
          || exit 0 ; \
        [ -f ld/Makefile ] || $(MAKE) stage4-start ; \
-       cd ld && \
+       cd $(HOST_SUBDIR)/ld && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -33577,18 +33203,14 @@ configure-stage4-libcpp:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 4 in libcpp ; \
-       cd libcpp || exit 1; \
+       cd $(HOST_SUBDIR)/libcpp || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libcpp"; \
-           libsrcdir="$$s/libcpp";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libcpp"; \
-           libsrcdir="$$s/libcpp";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libcpp/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libcpp"; \
+       libsrcdir="$$s/libcpp"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -33599,7 +33221,7 @@ all-stage4-libcpp: configure-stage4-libcpp
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd libcpp && \
+       cd $(HOST_SUBDIR)/libcpp && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -33609,7 +33231,7 @@ clean-stage4-libcpp:
        @[ -f libcpp/Makefile ] || [ -f stage4-libcpp/Makefile ] \
          || exit 0 ; \
        [ -f libcpp/Makefile ] || $(MAKE) stage4-start ; \
-       cd libcpp && \
+       cd $(HOST_SUBDIR)/libcpp && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -33633,18 +33255,14 @@ configure-stage4-libiberty:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 4 in libiberty ; \
-       cd libiberty || exit 1; \
+       cd $(HOST_SUBDIR)/libiberty || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libiberty"; \
-           libsrcdir="$$s/libiberty";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libiberty"; \
-           libsrcdir="$$s/libiberty";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libiberty/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libiberty"; \
+       libsrcdir="$$s/libiberty"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -33655,7 +33273,7 @@ all-stage4-libiberty: configure-stage4-libiberty
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd libiberty && \
+       cd $(HOST_SUBDIR)/libiberty && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -33665,7 +33283,7 @@ clean-stage4-libiberty:
        @[ -f libiberty/Makefile ] || [ -f stage4-libiberty/Makefile ] \
          || exit 0 ; \
        [ -f libiberty/Makefile ] || $(MAKE) stage4-start ; \
-       cd libiberty && \
+       cd $(HOST_SUBDIR)/libiberty && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -33689,18 +33307,14 @@ configure-stage4-zlib:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage 4 in zlib ; \
-       cd zlib || exit 1; \
+       cd $(HOST_SUBDIR)/zlib || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/zlib"; \
-           libsrcdir="$$s/zlib";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/zlib"; \
-           libsrcdir="$$s/zlib";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/zlib/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/zlib"; \
+       libsrcdir="$$s/zlib"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -33711,7 +33325,7 @@ all-stage4-zlib: configure-stage4-zlib
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd zlib && \
+       cd $(HOST_SUBDIR)/zlib && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                 
@@ -33721,7 +33335,7 @@ clean-stage4-zlib:
        @[ -f zlib/Makefile ] || [ -f stage4-zlib/Makefile ] \
          || exit 0 ; \
        [ -f zlib/Makefile ] || $(MAKE) stage4-start ; \
-       cd zlib && \
+       cd $(HOST_SUBDIR)/zlib && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                  clean
@@ -33782,99 +33396,150 @@ distclean-stage4::
 stageprofile-start::
        @[ -f stage_current ] && $(MAKE) `cat stage_current`-end || : ; \
        echo stageprofile > stage_current ; \
-       echo stageprofile > stage_last
+       echo stageprofile > stage_last; \
+       $(mkinstalldirs) $(HOST_SUBDIR)
 @if bfd
-       @[ -d stageprofile-bfd ] || mkdir stageprofile-bfd; \
-       set stageprofile-bfd bfd ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-bfd prev-bfd ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stageprofile-bfd ] || \
+         mkdir stageprofile-bfd; \
+       set stageprofile-bfd bfd ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-bfd prev-bfd ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif bfd
 @if opcodes
-       @[ -d stageprofile-opcodes ] || mkdir stageprofile-opcodes; \
-       set stageprofile-opcodes opcodes ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-opcodes prev-opcodes ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stageprofile-opcodes ] || \
+         mkdir stageprofile-opcodes; \
+       set stageprofile-opcodes opcodes ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-opcodes prev-opcodes ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif opcodes
 @if binutils
-       @[ -d stageprofile-binutils ] || mkdir stageprofile-binutils; \
-       set stageprofile-binutils binutils ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-binutils prev-binutils ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stageprofile-binutils ] || \
+         mkdir stageprofile-binutils; \
+       set stageprofile-binutils binutils ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-binutils prev-binutils ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif binutils
 @if gas
-       @[ -d stageprofile-gas ] || mkdir stageprofile-gas; \
-       set stageprofile-gas gas ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-gas prev-gas ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stageprofile-gas ] || \
+         mkdir stageprofile-gas; \
+       set stageprofile-gas gas ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-gas prev-gas ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif gas
 @if gcc
-       @[ -d stageprofile-gcc ] || mkdir stageprofile-gcc; \
-       set stageprofile-gcc gcc ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-gcc prev-gcc ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stageprofile-gcc ] || \
+         mkdir stageprofile-gcc; \
+       set stageprofile-gcc gcc ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-gcc prev-gcc ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif gcc
 @if intl
-       @[ -d stageprofile-intl ] || mkdir stageprofile-intl; \
-       set stageprofile-intl intl ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-intl prev-intl ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stageprofile-intl ] || \
+         mkdir stageprofile-intl; \
+       set stageprofile-intl intl ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-intl prev-intl ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif intl
 @if ld
-       @[ -d stageprofile-ld ] || mkdir stageprofile-ld; \
-       set stageprofile-ld ld ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-ld prev-ld ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stageprofile-ld ] || \
+         mkdir stageprofile-ld; \
+       set stageprofile-ld ld ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-ld prev-ld ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif ld
 @if libcpp
-       @[ -d stageprofile-libcpp ] || mkdir stageprofile-libcpp; \
-       set stageprofile-libcpp libcpp ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-libcpp prev-libcpp ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stageprofile-libcpp ] || \
+         mkdir stageprofile-libcpp; \
+       set stageprofile-libcpp libcpp ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-libcpp prev-libcpp ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif libcpp
 @if libiberty
-       @[ -d stageprofile-libiberty ] || mkdir stageprofile-libiberty; \
-       set stageprofile-libiberty libiberty ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-libiberty prev-libiberty ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stageprofile-libiberty ] || \
+         mkdir stageprofile-libiberty; \
+       set stageprofile-libiberty libiberty ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-libiberty prev-libiberty ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif libiberty
 @if zlib
-       @[ -d stageprofile-zlib ] || mkdir stageprofile-zlib; \
-       set stageprofile-zlib zlib ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-zlib prev-zlib ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stageprofile-zlib ] || \
+         mkdir stageprofile-zlib; \
+       set stageprofile-zlib zlib ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-zlib prev-zlib ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif zlib
 
 stageprofile-end::
        @rm -f stage_current
 @if bfd
-       @set bfd stageprofile-bfd ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-bfd stage1-bfd ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set bfd stageprofile-bfd ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-bfd stage1-bfd ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif bfd
 @if opcodes
-       @set opcodes stageprofile-opcodes ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-opcodes stage1-opcodes ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set opcodes stageprofile-opcodes ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-opcodes stage1-opcodes ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif opcodes
 @if binutils
-       @set binutils stageprofile-binutils ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-binutils stage1-binutils ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set binutils stageprofile-binutils ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-binutils stage1-binutils ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif binutils
 @if gas
-       @set gas stageprofile-gas ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-gas stage1-gas ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set gas stageprofile-gas ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-gas stage1-gas ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif gas
 @if gcc
-       @set gcc stageprofile-gcc ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-gcc stage1-gcc ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set gcc stageprofile-gcc ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-gcc stage1-gcc ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif gcc
 @if intl
-       @set intl stageprofile-intl ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-intl stage1-intl ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set intl stageprofile-intl ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-intl stage1-intl ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif intl
 @if ld
-       @set ld stageprofile-ld ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-ld stage1-ld ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set ld stageprofile-ld ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-ld stage1-ld ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif ld
 @if libcpp
-       @set libcpp stageprofile-libcpp ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-libcpp stage1-libcpp ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set libcpp stageprofile-libcpp ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-libcpp stage1-libcpp ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif libcpp
 @if libiberty
-       @set libiberty stageprofile-libiberty ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-libiberty stage1-libiberty ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set libiberty stageprofile-libiberty ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-libiberty stage1-libiberty ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif libiberty
 @if zlib
-       @set zlib stageprofile-zlib ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-zlib stage1-zlib ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set zlib stageprofile-zlib ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-zlib stage1-zlib ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif zlib
 
 # Bubble a bugfix through all the stages up to stage profile.  They
@@ -33899,7 +33564,7 @@ all-stageprofile:     \
   maybe-all-stageprofile-ld \
   maybe-all-stageprofile-libcpp  \
   maybe-all-stageprofile-libiberty                        \
-  maybe-all-stageprofile-zlib       
+  maybe-all-stageprofile-zlib        
 
 do-clean: clean-stageprofile
 clean-stageprofile:     \
@@ -33912,7 +33577,7 @@ clean-stageprofile:     \
   maybe-clean-stageprofile-ld \
   maybe-clean-stageprofile-libcpp  \
   maybe-clean-stageprofile-libiberty                        \
-  maybe-clean-stageprofile-zlib       
+  maybe-clean-stageprofile-zlib        
 
 
 .PHONY: configure-stageprofile-bfd maybe-configure-stageprofile-bfd
@@ -33932,18 +33597,14 @@ configure-stageprofile-bfd:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage profile in bfd ; \
-       cd bfd || exit 1; \
+       cd $(HOST_SUBDIR)/bfd || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/bfd"; \
-           libsrcdir="$$s/bfd";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/bfd"; \
-           libsrcdir="$$s/bfd";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/bfd/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/bfd"; \
+       libsrcdir="$$s/bfd"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -33954,7 +33615,7 @@ all-stageprofile-bfd: configure-stageprofile-bfd
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd bfd && \
+       cd $(HOST_SUBDIR)/bfd && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" 
@@ -33964,7 +33625,7 @@ clean-stageprofile-bfd:
        @[ -f bfd/Makefile ] || [ -f stageprofile-bfd/Makefile ] \
          || exit 0 ; \
        [ -f bfd/Makefile ] || $(MAKE) stageprofile-start ; \
-       cd bfd && \
+       cd $(HOST_SUBDIR)/bfd && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate"  clean
@@ -33988,18 +33649,14 @@ configure-stageprofile-opcodes:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage profile in opcodes ; \
-       cd opcodes || exit 1; \
+       cd $(HOST_SUBDIR)/opcodes || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/opcodes"; \
-           libsrcdir="$$s/opcodes";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/opcodes"; \
-           libsrcdir="$$s/opcodes";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/opcodes/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/opcodes"; \
+       libsrcdir="$$s/opcodes"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -34010,7 +33667,7 @@ all-stageprofile-opcodes: configure-stageprofile-opcodes
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd opcodes && \
+       cd $(HOST_SUBDIR)/opcodes && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" 
@@ -34020,7 +33677,7 @@ clean-stageprofile-opcodes:
        @[ -f opcodes/Makefile ] || [ -f stageprofile-opcodes/Makefile ] \
          || exit 0 ; \
        [ -f opcodes/Makefile ] || $(MAKE) stageprofile-start ; \
-       cd opcodes && \
+       cd $(HOST_SUBDIR)/opcodes && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate"  clean
@@ -34044,18 +33701,14 @@ configure-stageprofile-binutils:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage profile in binutils ; \
-       cd binutils || exit 1; \
+       cd $(HOST_SUBDIR)/binutils || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/binutils"; \
-           libsrcdir="$$s/binutils";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/binutils"; \
-           libsrcdir="$$s/binutils";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/binutils/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/binutils"; \
+       libsrcdir="$$s/binutils"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -34066,7 +33719,7 @@ all-stageprofile-binutils: configure-stageprofile-binutils
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd binutils && \
+       cd $(HOST_SUBDIR)/binutils && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" 
@@ -34076,7 +33729,7 @@ clean-stageprofile-binutils:
        @[ -f binutils/Makefile ] || [ -f stageprofile-binutils/Makefile ] \
          || exit 0 ; \
        [ -f binutils/Makefile ] || $(MAKE) stageprofile-start ; \
-       cd binutils && \
+       cd $(HOST_SUBDIR)/binutils && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate"  clean
@@ -34100,18 +33753,14 @@ configure-stageprofile-gas:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage profile in gas ; \
-       cd gas || exit 1; \
+       cd $(HOST_SUBDIR)/gas || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gas"; \
-           libsrcdir="$$s/gas";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gas"; \
-           libsrcdir="$$s/gas";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gas/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gas"; \
+       libsrcdir="$$s/gas"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -34122,7 +33771,7 @@ all-stageprofile-gas: configure-stageprofile-gas
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd gas && \
+       cd $(HOST_SUBDIR)/gas && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" 
@@ -34132,7 +33781,7 @@ clean-stageprofile-gas:
        @[ -f gas/Makefile ] || [ -f stageprofile-gas/Makefile ] \
          || exit 0 ; \
        [ -f gas/Makefile ] || $(MAKE) stageprofile-start ; \
-       cd gas && \
+       cd $(HOST_SUBDIR)/gas && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate"  clean
@@ -34156,18 +33805,14 @@ configure-stageprofile-gcc:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage profile in gcc ; \
-       cd gcc || exit 1; \
+       cd $(HOST_SUBDIR)/gcc || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gcc"; \
-           libsrcdir="$$s/gcc";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gcc"; \
-           libsrcdir="$$s/gcc";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gcc/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gcc"; \
+       libsrcdir="$$s/gcc"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -34178,7 +33823,7 @@ all-stageprofile-gcc: configure-stageprofile-gcc
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd gcc && \
+       cd $(HOST_SUBDIR)/gcc && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" $(EXTRA_GCC_FLAGS)
@@ -34188,7 +33833,7 @@ clean-stageprofile-gcc:
        @[ -f gcc/Makefile ] || [ -f stageprofile-gcc/Makefile ] \
          || exit 0 ; \
        [ -f gcc/Makefile ] || $(MAKE) stageprofile-start ; \
-       cd gcc && \
+       cd $(HOST_SUBDIR)/gcc && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" $(EXTRA_GCC_FLAGS) clean
@@ -34212,18 +33857,14 @@ configure-stageprofile-intl:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage profile in intl ; \
-       cd intl || exit 1; \
+       cd $(HOST_SUBDIR)/intl || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/intl"; \
-           libsrcdir="$$s/intl";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/intl"; \
-           libsrcdir="$$s/intl";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/intl/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/intl"; \
+       libsrcdir="$$s/intl"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -34234,7 +33875,7 @@ all-stageprofile-intl: configure-stageprofile-intl
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd intl && \
+       cd $(HOST_SUBDIR)/intl && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" 
@@ -34244,7 +33885,7 @@ clean-stageprofile-intl:
        @[ -f intl/Makefile ] || [ -f stageprofile-intl/Makefile ] \
          || exit 0 ; \
        [ -f intl/Makefile ] || $(MAKE) stageprofile-start ; \
-       cd intl && \
+       cd $(HOST_SUBDIR)/intl && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate"  clean
@@ -34268,18 +33909,14 @@ configure-stageprofile-ld:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage profile in ld ; \
-       cd ld || exit 1; \
+       cd $(HOST_SUBDIR)/ld || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/ld"; \
-           libsrcdir="$$s/ld";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/ld"; \
-           libsrcdir="$$s/ld";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/ld/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/ld"; \
+       libsrcdir="$$s/ld"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -34290,7 +33927,7 @@ all-stageprofile-ld: configure-stageprofile-ld
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd ld && \
+       cd $(HOST_SUBDIR)/ld && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" 
@@ -34300,7 +33937,7 @@ clean-stageprofile-ld:
        @[ -f ld/Makefile ] || [ -f stageprofile-ld/Makefile ] \
          || exit 0 ; \
        [ -f ld/Makefile ] || $(MAKE) stageprofile-start ; \
-       cd ld && \
+       cd $(HOST_SUBDIR)/ld && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate"  clean
@@ -34324,18 +33961,14 @@ configure-stageprofile-libcpp:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage profile in libcpp ; \
-       cd libcpp || exit 1; \
+       cd $(HOST_SUBDIR)/libcpp || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libcpp"; \
-           libsrcdir="$$s/libcpp";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libcpp"; \
-           libsrcdir="$$s/libcpp";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libcpp/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libcpp"; \
+       libsrcdir="$$s/libcpp"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -34346,7 +33979,7 @@ all-stageprofile-libcpp: configure-stageprofile-libcpp
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd libcpp && \
+       cd $(HOST_SUBDIR)/libcpp && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" 
@@ -34356,7 +33989,7 @@ clean-stageprofile-libcpp:
        @[ -f libcpp/Makefile ] || [ -f stageprofile-libcpp/Makefile ] \
          || exit 0 ; \
        [ -f libcpp/Makefile ] || $(MAKE) stageprofile-start ; \
-       cd libcpp && \
+       cd $(HOST_SUBDIR)/libcpp && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate"  clean
@@ -34380,18 +34013,14 @@ configure-stageprofile-libiberty:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage profile in libiberty ; \
-       cd libiberty || exit 1; \
+       cd $(HOST_SUBDIR)/libiberty || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libiberty"; \
-           libsrcdir="$$s/libiberty";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libiberty"; \
-           libsrcdir="$$s/libiberty";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libiberty/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libiberty"; \
+       libsrcdir="$$s/libiberty"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -34402,7 +34031,7 @@ all-stageprofile-libiberty: configure-stageprofile-libiberty
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd libiberty && \
+       cd $(HOST_SUBDIR)/libiberty && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" 
@@ -34412,7 +34041,7 @@ clean-stageprofile-libiberty:
        @[ -f libiberty/Makefile ] || [ -f stageprofile-libiberty/Makefile ] \
          || exit 0 ; \
        [ -f libiberty/Makefile ] || $(MAKE) stageprofile-start ; \
-       cd libiberty && \
+       cd $(HOST_SUBDIR)/libiberty && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate"  clean
@@ -34436,18 +34065,14 @@ configure-stageprofile-zlib:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage profile in zlib ; \
-       cd zlib || exit 1; \
+       cd $(HOST_SUBDIR)/zlib || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/zlib"; \
-           libsrcdir="$$s/zlib";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/zlib"; \
-           libsrcdir="$$s/zlib";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/zlib/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/zlib"; \
+       libsrcdir="$$s/zlib"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -34458,7 +34083,7 @@ all-stageprofile-zlib: configure-stageprofile-zlib
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd zlib && \
+       cd $(HOST_SUBDIR)/zlib && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" 
@@ -34468,7 +34093,7 @@ clean-stageprofile-zlib:
        @[ -f zlib/Makefile ] || [ -f stageprofile-zlib/Makefile ] \
          || exit 0 ; \
        [ -f zlib/Makefile ] || $(MAKE) stageprofile-start ; \
-       cd zlib && \
+       cd $(HOST_SUBDIR)/zlib && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-generate"  clean
@@ -34499,99 +34124,150 @@ distclean-stageprofile::
 stagefeedback-start::
        @[ -f stage_current ] && $(MAKE) `cat stage_current`-end || : ; \
        echo stagefeedback > stage_current ; \
-       echo stagefeedback > stage_last
+       echo stagefeedback > stage_last; \
+       $(mkinstalldirs) $(HOST_SUBDIR)
 @if bfd
-       @[ -d stagefeedback-bfd ] || mkdir stagefeedback-bfd; \
-       set stagefeedback-bfd bfd ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-bfd prev-bfd ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stagefeedback-bfd ] || \
+         mkdir stagefeedback-bfd; \
+       set stagefeedback-bfd bfd ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-bfd prev-bfd ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif bfd
 @if opcodes
-       @[ -d stagefeedback-opcodes ] || mkdir stagefeedback-opcodes; \
-       set stagefeedback-opcodes opcodes ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-opcodes prev-opcodes ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stagefeedback-opcodes ] || \
+         mkdir stagefeedback-opcodes; \
+       set stagefeedback-opcodes opcodes ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-opcodes prev-opcodes ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif opcodes
 @if binutils
-       @[ -d stagefeedback-binutils ] || mkdir stagefeedback-binutils; \
-       set stagefeedback-binutils binutils ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-binutils prev-binutils ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stagefeedback-binutils ] || \
+         mkdir stagefeedback-binutils; \
+       set stagefeedback-binutils binutils ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-binutils prev-binutils ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif binutils
 @if gas
-       @[ -d stagefeedback-gas ] || mkdir stagefeedback-gas; \
-       set stagefeedback-gas gas ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-gas prev-gas ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stagefeedback-gas ] || \
+         mkdir stagefeedback-gas; \
+       set stagefeedback-gas gas ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-gas prev-gas ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif gas
 @if gcc
-       @[ -d stagefeedback-gcc ] || mkdir stagefeedback-gcc; \
-       set stagefeedback-gcc gcc ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-gcc prev-gcc ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stagefeedback-gcc ] || \
+         mkdir stagefeedback-gcc; \
+       set stagefeedback-gcc gcc ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-gcc prev-gcc ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif gcc
 @if intl
-       @[ -d stagefeedback-intl ] || mkdir stagefeedback-intl; \
-       set stagefeedback-intl intl ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-intl prev-intl ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stagefeedback-intl ] || \
+         mkdir stagefeedback-intl; \
+       set stagefeedback-intl intl ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-intl prev-intl ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif intl
 @if ld
-       @[ -d stagefeedback-ld ] || mkdir stagefeedback-ld; \
-       set stagefeedback-ld ld ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-ld prev-ld ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stagefeedback-ld ] || \
+         mkdir stagefeedback-ld; \
+       set stagefeedback-ld ld ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-ld prev-ld ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif ld
 @if libcpp
-       @[ -d stagefeedback-libcpp ] || mkdir stagefeedback-libcpp; \
-       set stagefeedback-libcpp libcpp ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-libcpp prev-libcpp ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stagefeedback-libcpp ] || \
+         mkdir stagefeedback-libcpp; \
+       set stagefeedback-libcpp libcpp ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-libcpp prev-libcpp ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif libcpp
 @if libiberty
-       @[ -d stagefeedback-libiberty ] || mkdir stagefeedback-libiberty; \
-       set stagefeedback-libiberty libiberty ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-libiberty prev-libiberty ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stagefeedback-libiberty ] || \
+         mkdir stagefeedback-libiberty; \
+       set stagefeedback-libiberty libiberty ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-libiberty prev-libiberty ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif libiberty
 @if zlib
-       @[ -d stagefeedback-zlib ] || mkdir stagefeedback-zlib; \
-       set stagefeedback-zlib zlib ; @CREATE_LINK_TO_DIR@  ; \
-       set stage1-zlib prev-zlib ; @CREATE_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); [ -d stagefeedback-zlib ] || \
+         mkdir stagefeedback-zlib; \
+       set stagefeedback-zlib zlib ; \
+       @CREATE_LINK_TO_DIR@  ; \
+       set stage1-zlib prev-zlib ; \
+       @CREATE_LINK_TO_DIR@ 
 @endif zlib
 
 stagefeedback-end::
        @rm -f stage_current
 @if bfd
-       @set bfd stagefeedback-bfd ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-bfd stage1-bfd ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set bfd stagefeedback-bfd ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-bfd stage1-bfd ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif bfd
 @if opcodes
-       @set opcodes stagefeedback-opcodes ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-opcodes stage1-opcodes ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set opcodes stagefeedback-opcodes ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-opcodes stage1-opcodes ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif opcodes
 @if binutils
-       @set binutils stagefeedback-binutils ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-binutils stage1-binutils ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set binutils stagefeedback-binutils ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-binutils stage1-binutils ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif binutils
 @if gas
-       @set gas stagefeedback-gas ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-gas stage1-gas ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set gas stagefeedback-gas ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-gas stage1-gas ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif gas
 @if gcc
-       @set gcc stagefeedback-gcc ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-gcc stage1-gcc ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set gcc stagefeedback-gcc ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-gcc stage1-gcc ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif gcc
 @if intl
-       @set intl stagefeedback-intl ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-intl stage1-intl ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set intl stagefeedback-intl ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-intl stage1-intl ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif intl
 @if ld
-       @set ld stagefeedback-ld ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-ld stage1-ld ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set ld stagefeedback-ld ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-ld stage1-ld ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif ld
 @if libcpp
-       @set libcpp stagefeedback-libcpp ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-libcpp stage1-libcpp ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set libcpp stagefeedback-libcpp ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-libcpp stage1-libcpp ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif libcpp
 @if libiberty
-       @set libiberty stagefeedback-libiberty ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-libiberty stage1-libiberty ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set libiberty stagefeedback-libiberty ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-libiberty stage1-libiberty ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif libiberty
 @if zlib
-       @set zlib stagefeedback-zlib ; @UNDO_LINK_TO_DIR@  ; \
-       set prev-zlib stage1-zlib ; @UNDO_LINK_TO_DIR@ 
+       @cd $(HOST_SUBDIR); set zlib stagefeedback-zlib ; \
+       @UNDO_LINK_TO_DIR@  ; \
+       set prev-zlib stage1-zlib ; \
+       @UNDO_LINK_TO_DIR@ 
 @endif zlib
 
 # Bubble a bugfix through all the stages up to stage feedback.  They
@@ -34616,7 +34292,7 @@ all-stagefeedback:     \
   maybe-all-stagefeedback-ld \
   maybe-all-stagefeedback-libcpp  \
   maybe-all-stagefeedback-libiberty                        \
-  maybe-all-stagefeedback-zlib       
+  maybe-all-stagefeedback-zlib        
 
 do-clean: clean-stagefeedback
 clean-stagefeedback:     \
@@ -34629,7 +34305,7 @@ clean-stagefeedback:     \
   maybe-clean-stagefeedback-ld \
   maybe-clean-stagefeedback-libcpp  \
   maybe-clean-stagefeedback-libiberty                        \
-  maybe-clean-stagefeedback-zlib       
+  maybe-clean-stagefeedback-zlib        
 
 
 .PHONY: configure-stagefeedback-bfd maybe-configure-stagefeedback-bfd
@@ -34649,18 +34325,14 @@ configure-stagefeedback-bfd:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage feedback in bfd ; \
-       cd bfd || exit 1; \
+       cd $(HOST_SUBDIR)/bfd || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/bfd"; \
-           libsrcdir="$$s/bfd";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/bfd"; \
-           libsrcdir="$$s/bfd";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/bfd/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/bfd"; \
+       libsrcdir="$$s/bfd"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -34671,7 +34343,7 @@ all-stagefeedback-bfd: configure-stagefeedback-bfd
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd bfd && \
+       cd $(HOST_SUBDIR)/bfd && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use" 
@@ -34681,7 +34353,7 @@ clean-stagefeedback-bfd:
        @[ -f bfd/Makefile ] || [ -f stagefeedback-bfd/Makefile ] \
          || exit 0 ; \
        [ -f bfd/Makefile ] || $(MAKE) stagefeedback-start ; \
-       cd bfd && \
+       cd $(HOST_SUBDIR)/bfd && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use"  clean
@@ -34705,18 +34377,14 @@ configure-stagefeedback-opcodes:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage feedback in opcodes ; \
-       cd opcodes || exit 1; \
+       cd $(HOST_SUBDIR)/opcodes || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/opcodes"; \
-           libsrcdir="$$s/opcodes";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/opcodes"; \
-           libsrcdir="$$s/opcodes";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/opcodes/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/opcodes"; \
+       libsrcdir="$$s/opcodes"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -34727,7 +34395,7 @@ all-stagefeedback-opcodes: configure-stagefeedback-opcodes
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd opcodes && \
+       cd $(HOST_SUBDIR)/opcodes && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use" 
@@ -34737,7 +34405,7 @@ clean-stagefeedback-opcodes:
        @[ -f opcodes/Makefile ] || [ -f stagefeedback-opcodes/Makefile ] \
          || exit 0 ; \
        [ -f opcodes/Makefile ] || $(MAKE) stagefeedback-start ; \
-       cd opcodes && \
+       cd $(HOST_SUBDIR)/opcodes && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use"  clean
@@ -34761,18 +34429,14 @@ configure-stagefeedback-binutils:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage feedback in binutils ; \
-       cd binutils || exit 1; \
+       cd $(HOST_SUBDIR)/binutils || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/binutils"; \
-           libsrcdir="$$s/binutils";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/binutils"; \
-           libsrcdir="$$s/binutils";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/binutils/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/binutils"; \
+       libsrcdir="$$s/binutils"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -34783,7 +34447,7 @@ all-stagefeedback-binutils: configure-stagefeedback-binutils
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd binutils && \
+       cd $(HOST_SUBDIR)/binutils && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use" 
@@ -34793,7 +34457,7 @@ clean-stagefeedback-binutils:
        @[ -f binutils/Makefile ] || [ -f stagefeedback-binutils/Makefile ] \
          || exit 0 ; \
        [ -f binutils/Makefile ] || $(MAKE) stagefeedback-start ; \
-       cd binutils && \
+       cd $(HOST_SUBDIR)/binutils && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use"  clean
@@ -34817,18 +34481,14 @@ configure-stagefeedback-gas:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage feedback in gas ; \
-       cd gas || exit 1; \
+       cd $(HOST_SUBDIR)/gas || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gas"; \
-           libsrcdir="$$s/gas";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gas"; \
-           libsrcdir="$$s/gas";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gas/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gas"; \
+       libsrcdir="$$s/gas"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -34839,7 +34499,7 @@ all-stagefeedback-gas: configure-stagefeedback-gas
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd gas && \
+       cd $(HOST_SUBDIR)/gas && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use" 
@@ -34849,7 +34509,7 @@ clean-stagefeedback-gas:
        @[ -f gas/Makefile ] || [ -f stagefeedback-gas/Makefile ] \
          || exit 0 ; \
        [ -f gas/Makefile ] || $(MAKE) stagefeedback-start ; \
-       cd gas && \
+       cd $(HOST_SUBDIR)/gas && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use"  clean
@@ -34873,18 +34533,14 @@ configure-stagefeedback-gcc:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage feedback in gcc ; \
-       cd gcc || exit 1; \
+       cd $(HOST_SUBDIR)/gcc || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/gcc"; \
-           libsrcdir="$$s/gcc";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/gcc"; \
-           libsrcdir="$$s/gcc";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/gcc/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/gcc"; \
+       libsrcdir="$$s/gcc"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -34895,7 +34551,7 @@ all-stagefeedback-gcc: configure-stagefeedback-gcc
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd gcc && \
+       cd $(HOST_SUBDIR)/gcc && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use" $(EXTRA_GCC_FLAGS)
@@ -34905,7 +34561,7 @@ clean-stagefeedback-gcc:
        @[ -f gcc/Makefile ] || [ -f stagefeedback-gcc/Makefile ] \
          || exit 0 ; \
        [ -f gcc/Makefile ] || $(MAKE) stagefeedback-start ; \
-       cd gcc && \
+       cd $(HOST_SUBDIR)/gcc && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use" $(EXTRA_GCC_FLAGS) clean
@@ -34929,18 +34585,14 @@ configure-stagefeedback-intl:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage feedback in intl ; \
-       cd intl || exit 1; \
+       cd $(HOST_SUBDIR)/intl || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/intl"; \
-           libsrcdir="$$s/intl";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/intl"; \
-           libsrcdir="$$s/intl";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/intl/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/intl"; \
+       libsrcdir="$$s/intl"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -34951,7 +34603,7 @@ all-stagefeedback-intl: configure-stagefeedback-intl
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd intl && \
+       cd $(HOST_SUBDIR)/intl && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use" 
@@ -34961,7 +34613,7 @@ clean-stagefeedback-intl:
        @[ -f intl/Makefile ] || [ -f stagefeedback-intl/Makefile ] \
          || exit 0 ; \
        [ -f intl/Makefile ] || $(MAKE) stagefeedback-start ; \
-       cd intl && \
+       cd $(HOST_SUBDIR)/intl && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use"  clean
@@ -34985,18 +34637,14 @@ configure-stagefeedback-ld:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage feedback in ld ; \
-       cd ld || exit 1; \
+       cd $(HOST_SUBDIR)/ld || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/ld"; \
-           libsrcdir="$$s/ld";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/ld"; \
-           libsrcdir="$$s/ld";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/ld/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/ld"; \
+       libsrcdir="$$s/ld"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -35007,7 +34655,7 @@ all-stagefeedback-ld: configure-stagefeedback-ld
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd ld && \
+       cd $(HOST_SUBDIR)/ld && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use" 
@@ -35017,7 +34665,7 @@ clean-stagefeedback-ld:
        @[ -f ld/Makefile ] || [ -f stagefeedback-ld/Makefile ] \
          || exit 0 ; \
        [ -f ld/Makefile ] || $(MAKE) stagefeedback-start ; \
-       cd ld && \
+       cd $(HOST_SUBDIR)/ld && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use"  clean
@@ -35041,18 +34689,14 @@ configure-stagefeedback-libcpp:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage feedback in libcpp ; \
-       cd libcpp || exit 1; \
+       cd $(HOST_SUBDIR)/libcpp || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libcpp"; \
-           libsrcdir="$$s/libcpp";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libcpp"; \
-           libsrcdir="$$s/libcpp";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libcpp/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libcpp"; \
+       libsrcdir="$$s/libcpp"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -35063,7 +34707,7 @@ all-stagefeedback-libcpp: configure-stagefeedback-libcpp
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd libcpp && \
+       cd $(HOST_SUBDIR)/libcpp && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use" 
@@ -35073,7 +34717,7 @@ clean-stagefeedback-libcpp:
        @[ -f libcpp/Makefile ] || [ -f stagefeedback-libcpp/Makefile ] \
          || exit 0 ; \
        [ -f libcpp/Makefile ] || $(MAKE) stagefeedback-start ; \
-       cd libcpp && \
+       cd $(HOST_SUBDIR)/libcpp && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use"  clean
@@ -35097,18 +34741,14 @@ configure-stagefeedback-libiberty:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage feedback in libiberty ; \
-       cd libiberty || exit 1; \
+       cd $(HOST_SUBDIR)/libiberty || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/libiberty"; \
-           libsrcdir="$$s/libiberty";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/libiberty"; \
-           libsrcdir="$$s/libiberty";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/libiberty/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/libiberty"; \
+       libsrcdir="$$s/libiberty"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -35119,7 +34759,7 @@ all-stagefeedback-libiberty: configure-stagefeedback-libiberty
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd libiberty && \
+       cd $(HOST_SUBDIR)/libiberty && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use" 
@@ -35129,7 +34769,7 @@ clean-stagefeedback-libiberty:
        @[ -f libiberty/Makefile ] || [ -f stagefeedback-libiberty/Makefile ] \
          || exit 0 ; \
        [ -f libiberty/Makefile ] || $(MAKE) stagefeedback-start ; \
-       cd libiberty && \
+       cd $(HOST_SUBDIR)/libiberty && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use"  clean
@@ -35153,18 +34793,14 @@ configure-stagefeedback-zlib:
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
        echo Configuring stage feedback in zlib ; \
-       cd zlib || exit 1; \
+       cd $(HOST_SUBDIR)/zlib || exit 1; \
        case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/zlib"; \
-           libsrcdir="$$s/zlib";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/zlib"; \
-           libsrcdir="$$s/zlib";; \
+         /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+         *) topdir=`echo $(HOST_SUBDIR)/zlib/ | \
+               sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
        esac; \
+       srcdiroption="--srcdir=$${topdir}/zlib"; \
+       libsrcdir="$$s/zlib"; \
        $(SHELL) $${libsrcdir}/configure \
          $(HOST_CONFIGARGS) $${srcdiroption} \
          @stage2_werror_flag@ 
@@ -35175,7 +34811,7 @@ all-stagefeedback-zlib: configure-stagefeedback-zlib
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s;  \
        $(STAGE_HOST_EXPORTS)  \
-       cd zlib && \
+       cd $(HOST_SUBDIR)/zlib && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use" 
@@ -35185,7 +34821,7 @@ clean-stagefeedback-zlib:
        @[ -f zlib/Makefile ] || [ -f stagefeedback-zlib/Makefile ] \
          || exit 0 ; \
        [ -f zlib/Makefile ] || $(MAKE) stagefeedback-start ; \
-       cd zlib && \
+       cd $(HOST_SUBDIR)/zlib && \
        $(MAKE) $(FLAGS_TO_PASS)  \
                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                CFLAGS="$(BOOT_CFLAGS) -fprofile-use"  clean
@@ -35533,6 +35169,7 @@ all-stage4-libcpp: maybe-all-stage4-intl
 all-stageprofile-libcpp: maybe-all-stageprofile-intl
 all-stagefeedback-libcpp: maybe-all-stagefeedback-intl
 all-fixincludes: maybe-all-libiberty
+all-gnattools: maybe-all-target-libada
 configure-gdb: maybe-configure-itcl
 configure-gdb: maybe-configure-tcl
 configure-gdb: maybe-configure-tk