+ifndef build
+build := $(host)
+endif
+
+ifndef target
+target := $(host)
+endif
+
+ifneq ($(build),$(host))
+
+# We are building on a machine other than the host. We rely upon
+# previously built cross-compilers from the build machine to the host
+# (used to build the executables) and from the build machine to the
+# target (used to build the libraries).
+
+AR := $(host)-ar
+AR_FOR_TARGET := $(target)-ar
+AS := $(host)-as
+AS_FOR_TARGET := $(target)-as
+BISON := byacc
+CC := $(host)-gcc
+CC_FOR_BUILD := gcc
+CC_FOR_TARGET := $(target)-gcc
+CXX := $(host)-c++
+CXX_FOR_TARGET := $(target)-c++
+GCC := $(host)-gcc -O
+GXX := $(host)-g++
+GXX_FOR_TARGET := $(target)-g++
+HOST_PREFIX := $(build)-
+HOST_PREFIX_1 := $(build)-
+LEX := flex
+MAKEINFO := makeinfo
+MUNCH_NM := $(host)-nm
+NM := $(host)-nm
+NM_FOR_TARGET := $(target)-nm
+RANLIB := $(host)-ranlib
+RANLIB_FOR_TARGET := $(target)-ranlib
+YACC := $(BISON)
+
+ifeq ($(build),hppa1.1-hp-hpux)
+CC_FOR_BUILD := cc
+endif
+
+FLAGS_TO_PASS := \
+ "AR=$(AR)" \
+ "AR_FOR_TARGET=$(AR_FOR_TARGET)" \
+ "AS=$(AS)" \
+ "AS_FOR_TARGET=$(AS_FOR_TARGET)" \
+ "BISON=$(BISON)" \
+ "CC=$(CC)" \
+ "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
+ "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
+ "CXX=$(CXX)" \
+ "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
+ "CFLAGS=$(CFLAGS)" \
+ "CXXFLAGS=$(CXXFLAGS)" \
+ "GCC=$(GCC)" \
+ "HOST_PREFIX=$(HOST_PREFIX)" \
+ "HOST_PREFIX_1=$(HOST_PREFIX_1)" \
+ "LEX=$(LEX)" \
+ "MAKEINFO=$(MAKEINFO)" \
+ "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
+ "MF=$(MF)" \
+ "MUNCH_NM=$(MUNCH_NM)" \
+ "NM=$(NM)" \
+ "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
+ "RANLIB=$(RANLIB)" \
+ "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
+ "RELEASE_TAG=$(RELEASE_TAG)" \
+ "RUNTEST=$(relbindir)/runtest" \
+ "SHELL=$(SHELL)" \
+ "TIME=$(TIME)" \
+ "YACC=$(YACC)" \
+ "build=$(build)" \
+ "host=$(host)"
+
+# We must pass the build cross host tools in the environment of
+# configure, so that autoconf scripts will run the right programs.
+configenv := AR="$(AR)" CC="$(CC)" RANLIB="$(RANLIB)"
+
+else
+
+# This is a normal build on the host machine.
+