Index: Makefile.in
===================================================================
--- Makefile.in	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ Makefile.in	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -294,4 +294,5 @@
 FGREP = @FGREP@
 GREP = @GREP@
+HAS_DISTCC = @HAS_DISTCC@
 HOST_FLAGS = @HOST_FLAGS@
 INSTALL = @INSTALL@
Index: benchmark/Makefile.in
===================================================================
--- benchmark/Makefile.in	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ benchmark/Makefile.in	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -244,4 +244,5 @@
 FGREP = @FGREP@
 GREP = @GREP@
+HAS_DISTCC = @HAS_DISTCC@
 HOST_FLAGS = @HOST_FLAGS@
 INSTALL = @INSTALL@
Index: configure
===================================================================
--- configure	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ configure	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -663,5 +663,4 @@
 ac_ct_DUMPBIN
 DUMPBIN
-LD
 FGREP
 EGREP
@@ -701,5 +700,4 @@
 LDFLAGS
 CXXFLAGS
-CXX
 CFA_FLAGS
 LIBCFA_TARGET_MAKEFILES
@@ -723,4 +721,9 @@
 CFA_INCDIR
 CFA_PREFIX
+HAS_DISTCC
+LD
+CXX
+ENABLE_DISTCC_FALSE
+ENABLE_DISTCC_TRUE
 DOendif
 DOifskipcompile
@@ -797,4 +800,5 @@
 enable_silent_rules
 with_cfa_name
+enable_distcc
 with_target_hosts
 enable_gprofiler
@@ -1459,4 +1463,5 @@
   --enable-silent-rules   less verbose build output (undo: "make V=1")
   --disable-silent-rules  verbose build output (undo: "make V=0")
+  --enable-distcc     whether or not to enable distributed compilation
   --enable-gprofiler     whether or not to enable gprofiler tools (if available)
   --enable-demangler     whether or not to build the demangler (executable and library)
@@ -3180,4 +3185,36 @@
 
 DOendif='endif'
+
+
+
+#==============================================================================
+# distcc support
+
+# Check whether --enable-distcc was given.
+if test "${enable_distcc+set}" = set; then :
+  enableval=$enable_distcc; enable_distcc=$enableval
+else
+  enable_distcc=no
+fi
+
+
+ if test x$enable_distcc = xyes; then
+  ENABLE_DISTCC_TRUE=
+  ENABLE_DISTCC_FALSE='#'
+else
+  ENABLE_DISTCC_TRUE='#'
+  ENABLE_DISTCC_FALSE=
+fi
+
+HAS_DISTCC="False"
+
+if test x$enable_distcc = xyes; then
+	CXX="distcc ${CXX}"
+	LD="distcc ${LD} -lstdc++"
+	HAS_DISTCC="True"
+	echo "Enabling distributed builds"
+fi
+
+
 
 
@@ -17017,4 +17054,8 @@
 fi
 
+if test -z "${ENABLE_DISTCC_TRUE}" && test -z "${ENABLE_DISTCC_FALSE}"; then
+  as_fn_error $? "conditional \"ENABLE_DISTCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
   as_fn_error $? "conditional \"AMDEP\" was never defined.
Index: configure.ac
===================================================================
--- configure.ac	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ configure.ac	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -56,4 +56,25 @@
 AC_SUBST([DOendif])
 AM_SUBST_NOTMAKE([DOendif])
+
+#==============================================================================
+# distcc support
+
+AC_ARG_ENABLE(distcc,
+	[  --enable-distcc     whether or not to enable distributed compilation],
+	enable_distcc=$enableval, enable_distcc=no)
+
+AM_CONDITIONAL([ENABLE_DISTCC], [test x$enable_distcc = xyes])
+HAS_DISTCC="False"
+
+if test x$enable_distcc = xyes; then
+	CXX="distcc ${CXX}"
+	LD="distcc ${LD} -lstdc++"
+	HAS_DISTCC="True"
+	echo "Enabling distributed builds"
+fi
+
+AC_SUBST(CXX)
+AC_SUBST(LD)
+AC_SUBST(HAS_DISTCC)
 
 #==============================================================================
Index: driver/Makefile.in
===================================================================
--- driver/Makefile.in	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ driver/Makefile.in	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -231,4 +231,5 @@
 FGREP = @FGREP@
 GREP = @GREP@
+HAS_DISTCC = @HAS_DISTCC@
 HOST_FLAGS = @HOST_FLAGS@
 INSTALL = @INSTALL@
Index: driver/cfa.cc
===================================================================
--- driver/cfa.cc	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ driver/cfa.cc	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -35,9 +35,9 @@
 //#define __DEBUG_H__
 
-
 static string __CFA_FLAGPREFIX__( "__CFA_FLAG" );		// "N__=" suffix
 
 void Putenv( char * argv[], string arg ) {
-	static int flags = 0;								// environment variables must have unique names
+	// environment variables must have unique names
+	static int flags = 0;
 
 	if ( putenv( (char *)( *new string( string( __CFA_FLAGPREFIX__ + to_string( flags++ ) + "__=" ) + arg ) ).c_str() ) ) {
@@ -47,8 +47,13 @@
 } // Putenv
 
-
-bool prefix( const string & arg, const string & pre ) {	// check if string has prefix
+// check if string has prefix
+bool prefix( const string & arg, const string & pre ) {
 	return arg.substr( 0, pre.size() ) == pre;
 } // prefix
+
+inline bool ends_with(const string & str, const string & sfix) {
+	if (sfix.size() > str.size()) return false;
+	return std::equal(str.rbegin(), str.rbegin() + sfix.size(), sfix.rbegin(), sfix.rend());
+}
 
 bool suffix( const string & arg ) {						// check if string has suffix
@@ -68,4 +73,8 @@
 	return (info.st_mode & S_IFDIR) != 0;
 } // dirExists
+
+static inline string dir(const string & path) {
+	return path.substr(0, path.find_last_of('/'));
+}
 
 
@@ -105,4 +114,6 @@
 	bool m64 = false;									// -m64 flag
 	bool intree = false;								// build in tree
+	bool compiling_libs = false;
+	bool disttree = false;
 	int o_file = 0;										// -o filename position
 
@@ -162,4 +173,8 @@
 			} else if ( arg == "-in-tree" ) {
 				intree = true;
+			} else if ( arg == "-dist-tree" ) {
+				disttree = true;
+			} else if ( arg == "-cfalib") {
+				compiling_libs = true;
 			} else if ( arg == "-compiler" ) {
 				// use the user specified compiler
@@ -293,4 +308,7 @@
 	} else {
 		libbase = TOP_BUILDDIR "libcfa/";
+	} // if
+
+	if( compiling_libs ) {
 		Putenv( argv, "-t" );
 	} // if
@@ -305,10 +323,33 @@
 	} // if
 
-	string libdir( libbase + arch + "-" + (nolib ? "nolib" : (debug ? "debug": "nodebug")) );
-	if ( ! dirExists( libdir ) ) {
-		cerr << argv[0] << " internal error, cannot find prelude directory " << libdir << endl;
-		exit( EXIT_FAILURE );
-	} // if
-
+	const char * config = nolib ? "nolib" : (debug ? "debug": "nodebug");
+	string libdir = libbase + arch + "-" + config;
+
+	if (!disttree) {
+		if ( ! nolib && ! dirExists( libdir ) ) {
+			cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl;
+			cerr << "Was looking for " << libdir << endl;
+			for(int i = 1; i < argc; i++) {
+				cerr << argv[i] << " ";
+			}
+			cerr << endl;
+			libdir = libbase + arch + "-" + "nolib";
+		} // if
+
+		if ( ! dirExists( libdir ) ) {
+			cerr << argv[0] << " internal error, cannot find prelude directory." << endl;
+			cerr << "Was looking for " << libdir << endl;
+			exit( EXIT_FAILURE );
+		} // if
+	} // if
+
+	if(disttree) {
+		Putenv( argv, "--prelude-dir=" + dir(argv[0])) );
+	} else if(intree) {
+		Putenv( argv, "--prelude-dir=" + libdir + "/prelude") );
+	} else {
+		Putenv( argv, "--prelude-dir=" + libdir) );
+	}
+	nargs += 1;
 	for ( int i = 0; i < nlibs; i += 1 ) {				// copy non-user libraries after all user libraries
 		args[nargs++] = libs[i];
@@ -371,5 +412,11 @@
 
 	if ( bprefix.length() == 0 ) {
-		bprefix = ! intree ? installlibdir : srcdriverdir;
+		if(disttree) {
+			bprefix = dir(argv[0]);
+		} else if(intree) {
+			bprefix = srcdriverdir;
+		} else {
+			bprefix = installlibdir;
+		}
 		if ( bprefix[bprefix.length() - 1] != '/' ) bprefix += '/';
 		Putenv( argv, ( *new string( string("-B=") + bprefix ) ).c_str() );
@@ -415,9 +462,9 @@
 		cerr << " \"" << args[i] << "\"" << endl;
 	} // for
+	cerr << endl;
 	#endif // __DEBUG_H__
 
 	if ( ! quiet ) {
 		cerr << "CFA " << "Version " << Version << heading << endl;
-
 		if ( help ) {
 			cerr <<
Index: libcfa/Makefile.in
===================================================================
--- libcfa/Makefile.in	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ libcfa/Makefile.in	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -231,4 +231,5 @@
 CFACC = @CFACC@
 CFACPP = @CFACPP@
+CFADIR_HASH = @CFADIR_HASH@
 CFA_BINDIR = @CFA_BINDIR@
 CFA_INCDIR = @CFA_INCDIR@
@@ -274,4 +275,5 @@
 LIPO = @LIPO@
 LN_S = @LN_S@
+LOCAL_CFACC = @LOCAL_CFACC@
 LTLIBOBJS = @LTLIBOBJS@
 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
@@ -293,4 +295,5 @@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PRELUDEFLAG = @PRELUDEFLAG@
 RANLIB = @RANLIB@
 SED = @SED@
Index: libcfa/configure
===================================================================
--- libcfa/configure	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ libcfa/configure	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -707,6 +707,11 @@
 CONFIG_CFLAGS
 ARCH_FLAGS
+PRELUDEFLAG
+CFADIR_HASH
+LOCAL_CFACC
 CFACPP
 CFACC
+ENABLE_DISTCC_FALSE
+ENABLE_DISTCC_TRUE
 CFA_VERSION
 DRIVER_DIR
@@ -783,4 +788,5 @@
 enable_option_checking
 enable_silent_rules
+enable_distcc
 with_cfa_name
 enable_shared
@@ -1445,4 +1451,5 @@
   --enable-silent-rules   less verbose build output (undo: "make V=1")
   --disable-silent-rules  verbose build output (undo: "make V=0")
+  --enable-distcc     whether or not to enable distributed compilation
   --enable-shared[=PKGS]  build shared libraries [default=yes]
   --enable-static[=PKGS]  build static libraries [default=yes]
@@ -2941,6 +2948,41 @@
 
 
-CFACC=${DRIVER_DIR}cfa
+# Check whether --enable-distcc was given.
+if test "${enable_distcc+set}" = set; then :
+  enableval=$enable_distcc; enable_distcc=$enableval
+else
+  enable_distcc=no
+fi
+
+
+echo -n "checking for distributated build... "
+if test x$enable_distcc = xno; then
+	CFACC=${DRIVER_DIR}cfa
+	PRELUDEFLAG='-in-tree'
+	echo "no"
+else
+	tools="$(readlink -m $ac_confdir/)/../tools/build"
+	config=$(basename $(readlink -f .))
+	echo "$tools/distcc_hash $config"
+	CFADIR_HASH=$($tools/distcc_hash $config)
+	CFACC="distcc ~/.cfadistcc/${CFADIR_HASH}/cfa"
+	PRELUDEFLAG='-dist-tree'
+	echo "yes (hash=${CFADIR_HASH})"
+fi
 CFACPP=${DRIVER_DIR}cfa-cpp
+LOCAL_CFACC=${DRIVER_DIR}cfa
+
+ if test x$enable_distcc = xyes; then
+  ENABLE_DISTCC_TRUE=
+  ENABLE_DISTCC_FALSE='#'
+else
+  ENABLE_DISTCC_TRUE='#'
+  ENABLE_DISTCC_FALSE=
+fi
+
+
+
+
+
 
 
@@ -16982,4 +17024,8 @@
 fi
 
+if test -z "${ENABLE_DISTCC_TRUE}" && test -z "${ENABLE_DISTCC_FALSE}"; then
+  as_fn_error $? "conditional \"ENABLE_DISTCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${BUILDLIB_TRUE}" && test -z "${BUILDLIB_FALSE}"; then
   as_fn_error $? "conditional \"BUILDLIB\" was never defined.
Index: libcfa/configure.ac
===================================================================
--- libcfa/configure.ac	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ libcfa/configure.ac	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -27,9 +27,33 @@
 AC_ARG_VAR(CFA_VERSION, [The long version of cfa])
 
-CFACC=${DRIVER_DIR}cfa
+AC_ARG_ENABLE(distcc,
+	[  --enable-distcc     whether or not to enable distributed compilation],
+	enable_distcc=$enableval, enable_distcc=no)
+
+echo -n "checking for distributated build... "
+if test x$enable_distcc = xno; then
+	CFACC=${DRIVER_DIR}cfa
+	PRELUDEFLAG='-in-tree'
+	echo "no"
+else
+	tools="$(readlink -m $ac_confdir/)/../tools/build"
+	config=$(basename $(readlink -f .))
+	echo "$tools/distcc_hash $config"
+	CFADIR_HASH=$($tools/distcc_hash $config)
+	CFACC="distcc ~/.cfadistcc/${CFADIR_HASH}/cfa"
+	PRELUDEFLAG='-dist-tree'
+	echo "yes (hash=${CFADIR_HASH})"
+fi
 CFACPP=${DRIVER_DIR}cfa-cpp
+LOCAL_CFACC=${DRIVER_DIR}cfa
+
+AM_CONDITIONAL([ENABLE_DISTCC], [test x$enable_distcc = xyes])
+
 AC_SUBST(CFACC)
 AC_SUBST(CFACPP)
+AC_SUBST(LOCAL_CFACC)
+AC_SUBST(CFADIR_HASH)
 AC_SUBST(CFA_VERSION)
+AC_SUBST(PRELUDEFLAG)
 
 #==============================================================================
Index: libcfa/prelude/Makefile.am
===================================================================
--- libcfa/prelude/Makefile.am	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ libcfa/prelude/Makefile.am	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -23,5 +23,5 @@
 cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cfa bootloader.c
 
-CC = @CFACC@
+CC = @LOCAL_CFACC@
 AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@
 AM_CFAFLAGS = @CONFIG_CFAFLAGS@
@@ -54,5 +54,5 @@
 
 # create forward declarations for cfa builtins
-builtins.cf : builtins.c ${CC}
+builtins.cf : builtins.c @LOCAL_CFACC@
 	${AM_V_GEN}gcc ${AM_CFLAGS} -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po -D__cforall
 	${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po
@@ -68,2 +68,10 @@
 MOSTLYCLEANFILES = bootloader.c builtins.cf extras.cf gcc-builtins.c gcc-builtins.cf prelude.cfa
 MAINTAINERCLEANFILES = ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
+
+if ENABLE_DISTCC
+distribution: @LOCAL_CFACC@ @CFACPP@ gcc-builtins.cf builtins.cf extras.cf prelude.cfa bootloader.c $(srcdir)/../../tools/build/push2dist.sh
+	${AM_V_GEN}$(srcdir)/../../tools/build/push2dist.sh @CFADIR_HASH@
+	@echo "Dummy file to track distribution to remote hosts" > ${@}
+
+all: all-am distribution
+endif ENABLE_DISTCC
Index: libcfa/prelude/Makefile.in
===================================================================
--- libcfa/prelude/Makefile.in	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ libcfa/prelude/Makefile.in	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -167,5 +167,5 @@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-CC = @CFACC@
+CC = @LOCAL_CFACC@
 CCAS = @CCAS@
 CCASDEPMODE = @CCASDEPMODE@
@@ -174,4 +174,5 @@
 CFACC = @CFACC@
 CFACPP = @CFACPP@
+CFADIR_HASH = @CFADIR_HASH@
 CFA_BINDIR = @CFA_BINDIR@
 CFA_INCDIR = @CFA_INCDIR@
@@ -217,4 +218,5 @@
 LIPO = @LIPO@
 LN_S = @LN_S@
+LOCAL_CFACC = @LOCAL_CFACC@
 LTLIBOBJS = @LTLIBOBJS@
 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
@@ -236,4 +238,5 @@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PRELUDEFLAG = @PRELUDEFLAG@
 RANLIB = @RANLIB@
 SED = @SED@
@@ -555,5 +558,5 @@
 
 # create forward declarations for cfa builtins
-builtins.cf : builtins.c ${CC}
+builtins.cf : builtins.c @LOCAL_CFACC@
 	${AM_V_GEN}gcc ${AM_CFLAGS} -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po -D__cforall
 	${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po
@@ -566,4 +569,10 @@
 maintainer-clean-local :
 	rm -rf $(DEPDIR)
+
+@ENABLE_DISTCC_TRUE@distribution: @LOCAL_CFACC@ @CFACPP@ gcc-builtins.cf builtins.cf extras.cf prelude.cfa bootloader.c $(srcdir)/../../tools/build/push2dist.sh
+@ENABLE_DISTCC_TRUE@	${AM_V_GEN}$(srcdir)/../../tools/build/push2dist.sh @CFADIR_HASH@
+@ENABLE_DISTCC_TRUE@	@echo "Dummy file to track distribution to remote hosts" > ${@}
+
+@ENABLE_DISTCC_TRUE@all: all-am distribution
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
Index: libcfa/src/Makefile.am
===================================================================
--- libcfa/src/Makefile.am	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ libcfa/src/Makefile.am	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -32,5 +32,5 @@
 # use -no-include-stdhdr to prevent rebuild cycles
 # The built sources must not depend on the installed headers
-AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb)  @CONFIG_CFAFLAGS@
+AM_CFAFLAGS = -quiet -cfalib @PRELUDEFLAG@ -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@
 AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@
 AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
@@ -64,8 +64,8 @@
 # add dependency of cfa files
 libobjs = $(addsuffix .lo, $(basename $(filter %.cfa,$(libsrc))))
-$(libobjs) : @CFACC@ @CFACPP@ prelude.cfa
+$(libobjs) : @LOCAL_CFACC@ @CFACPP@ prelude.cfa
 
 thread_libobjs = $(addsuffix .lo, $(basename $(filter %.cfa,$(thread_libsrc))))
-$(thread_libobjs) : @CFACC@ @CFACPP@ prelude.cfa
+$(thread_libobjs) : @LOCAL_CFACC@ @CFACPP@ prelude.cfa
 
 
@@ -86,10 +86,10 @@
 
 
-prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
-	${AM_V_GEN}$(CFACOMPILE) -quiet -in-tree -XCFA -l ${<} -c -o ${@}
+prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@
+	${AM_V_GEN}$(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@}
 
-prelude.lo: prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
+prelude.lo: prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@
 	${AM_V_GEN}$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
-	$(CFACOMPILE) -quiet -in-tree -XCFA -l ${<} -c -o ${@}
+	$(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@}
 
 
Index: libcfa/src/Makefile.in
===================================================================
--- libcfa/src/Makefile.in	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ libcfa/src/Makefile.in	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -284,4 +284,5 @@
 CFACC = @CFACC@
 CFACPP = @CFACPP@
+CFADIR_HASH = @CFADIR_HASH@
 CFA_BINDIR = @CFA_BINDIR@
 CFA_INCDIR = @CFA_INCDIR@
@@ -327,4 +328,5 @@
 LIPO = @LIPO@
 LN_S = @LN_S@
+LOCAL_CFACC = @LOCAL_CFACC@
 LTLIBOBJS = @LTLIBOBJS@
 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
@@ -346,4 +348,5 @@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PRELUDEFLAG = @PRELUDEFLAG@
 RANLIB = @RANLIB@
 SED = @SED@
@@ -441,5 +444,5 @@
 # use -no-include-stdhdr to prevent rebuild cycles
 # The built sources must not depend on the installed headers
-AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb)  @CONFIG_CFAFLAGS@
+AM_CFAFLAGS = -quiet -cfalib @PRELUDEFLAG@ -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@
 AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@
 AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
@@ -937,6 +940,6 @@
 	$(LTCFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
 	$(am__mv) $$depbase.Tpo $$depbase.Plo
-$(libobjs) : @CFACC@ @CFACPP@ prelude.cfa
-$(thread_libobjs) : @CFACC@ @CFACPP@ prelude.cfa
+$(libobjs) : @LOCAL_CFACC@ @CFACPP@ prelude.cfa
+$(thread_libobjs) : @LOCAL_CFACC@ @CFACPP@ prelude.cfa
 
 -include $(libdeps)
@@ -944,10 +947,10 @@
 -include $(thread_libdeps)
 
-prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
-	${AM_V_GEN}$(CFACOMPILE) -quiet -in-tree -XCFA -l ${<} -c -o ${@}
-
-prelude.lo: prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
+prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@
+	${AM_V_GEN}$(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@}
+
+prelude.lo: prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@
 	${AM_V_GEN}$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
-	$(CFACOMPILE) -quiet -in-tree -XCFA -l ${<} -c -o ${@}
+	$(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@}
 
 #----------------------------------------------------------------------------------------------------------------
Index: longrun_tests/Makefile.in
===================================================================
--- longrun_tests/Makefile.in	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ longrun_tests/Makefile.in	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -378,4 +378,5 @@
 FGREP = @FGREP@
 GREP = @GREP@
+HAS_DISTCC = @HAS_DISTCC@
 HOST_FLAGS = @HOST_FLAGS@
 INSTALL = @INSTALL@
Index: src/Makefile.in
===================================================================
--- src/Makefile.in	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ src/Makefile.in	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -441,4 +441,5 @@
 FGREP = @FGREP@
 GREP = @GREP@
+HAS_DISTCC = @HAS_DISTCC@
 HOST_FLAGS = @HOST_FLAGS@
 INSTALL = @INSTALL@
Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ tests/Makefile.am	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -35,4 +35,5 @@
 
 # applies to both programs
+# since automake doesn't have support for CFA we have to
 AM_CFLAGS = $(if $(test), 2> $(test), ) \
 	-g \
@@ -42,6 +43,7 @@
 	-DIN_DIR="${abs_srcdir}/.in/"
 
-AM_CFLAGS += ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS}
-CC = @CFACC@
+CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS})
+CFACCBIN = @CFACC@
+CFACC = $(CC)
 
 PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
@@ -57,8 +59,8 @@
 #----------------------------------------------------------------------------------------------------------------
 all-local :
-	@+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
+	@+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
 
 all-tests :
-	@+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
+	@+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
 
 clean-local :
@@ -87,7 +89,7 @@
 
 # Use for all tests, make sure the path are correct and all flags are added
-CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGS" | sed 's/-\|\//_/g'))
+CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) -c $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGS" | sed 's/-\|\//_/g'))
 
-# Use for tests that either generate an executable, print directyl to stdout or the make command is expected to fail
+# Use for tests that either generate an executable, print directly to stdout or the make command is expected to fail
 CFATEST_STDOUT=$(CFACOMPILETEST) -o $(abspath ${@})
 
@@ -98,6 +100,8 @@
 
 # implicit rule so not all test require a rule
-% : %.cfa $(CFACC)
-	$(CFATEST_STDOUT)
+% : %.cfa $(CFACCBIN)
+	$(CFACOMPILETEST) -o $(abspath ${@}).o
+	$(CFACC) $(abspath ${@}).o -o $(abspath ${@})
+
 
 % : %.cpp
@@ -123,33 +127,33 @@
 # CUSTOM TARGET
 #------------------------------------------------------------------------------
-typedefRedef-ERR1: typedefRedef.cfa $(CFACC)
+typedefRedef-ERR1: typedefRedef.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR1
 
-alloc-ERROR: alloc.cfa $(CFACC)
+alloc-ERROR: alloc.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR1
 
-nested-types-ERR1: nested-types.cfa $(CFACC)
+nested-types-ERR1: nested-types.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR1
 
-nested-types-ERR2: nested-types.cfa $(CFACC)
+nested-types-ERR2: nested-types.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR2
 
-raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACC)
+raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR1
 
-raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACC)
+raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR2
 
-raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACC)
+raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR1
 
-raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACC)
+raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR1
 
 #builtins
-builtins/sync: builtins/sync.cfa $(CFACC)
+builtins/sync: builtins/sync.cfa $(CFACCBIN)
 	$(CFATEST_STDERR) -fsyntax-only
 
 # Warnings
-warnings/self-assignment: warnings/self-assignment.cfa $(CFACC)
+warnings/self-assignment: warnings/self-assignment.cfa $(CFACCBIN)
 	$(CFATEST_STDERR) -fsyntax-only
Index: tests/Makefile.in
===================================================================
--- tests/Makefile.in	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ tests/Makefile.in	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -212,10 +212,10 @@
 AWK = @AWK@
 BUILD_IN_TREE_FLAGS = @BUILD_IN_TREE_FLAGS@
-CC = @CFACC@
+CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS})
 CCAS = @CCAS@
 CCASDEPMODE = @CCASDEPMODE@
 CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
-CFACC = @CFACC@
+CFACC = $(CC)
 CFACPP = @CFACPP@
 CFA_BACKEND_CC = @CFA_BACKEND_CC@
@@ -248,4 +248,5 @@
 FGREP = @FGREP@
 GREP = @GREP@
+HAS_DISTCC = @HAS_DISTCC@
 HOST_FLAGS = @HOST_FLAGS@
 INSTALL = @INSTALL@
@@ -386,7 +387,13 @@
 
 # applies to both programs
-AM_CFLAGS = $(if $(test), 2> $(test), ) -g -Wall -Wno-unused-function \
-	-quiet @CFA_FLAGS@ -DIN_DIR="${abs_srcdir}/.in/" \
-	${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS}
+# since automake doesn't have support for CFA we have to
+AM_CFLAGS = $(if $(test), 2> $(test), ) \
+	-g \
+	-Wall \
+	-Wno-unused-function \
+	-quiet @CFA_FLAGS@ \
+	-DIN_DIR="${abs_srcdir}/.in/"
+
+CFACCBIN = @CFACC@
 PRETTY_PATH = mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
 avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa
@@ -397,7 +404,7 @@
 
 # Use for all tests, make sure the path are correct and all flags are added
-CFACOMPILETEST = $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGS" | sed 's/-\|\//_/g'))
-
-# Use for tests that either generate an executable, print directyl to stdout or the make command is expected to fail
+CFACOMPILETEST = $(PRETTY_PATH) $(CFACOMPILE) -c $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGS" | sed 's/-\|\//_/g'))
+
+# Use for tests that either generate an executable, print directly to stdout or the make command is expected to fail
 CFATEST_STDOUT = $(CFACOMPILETEST) -o $(abspath ${@})
 
@@ -771,8 +778,8 @@
 #----------------------------------------------------------------------------------------------------------------
 all-local :
-	@+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
+	@+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
 
 all-tests :
-	@+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
+	@+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
 
 clean-local :
@@ -801,6 +808,7 @@
 
 # implicit rule so not all test require a rule
-% : %.cfa $(CFACC)
-	$(CFATEST_STDOUT)
+% : %.cfa $(CFACCBIN)
+	$(CFACOMPILETEST) -o $(abspath ${@}).o
+	$(CFACC) $(abspath ${@}).o -o $(abspath ${@})
 
 % : %.cpp
@@ -810,34 +818,34 @@
 # CUSTOM TARGET
 #------------------------------------------------------------------------------
-typedefRedef-ERR1: typedefRedef.cfa $(CFACC)
+typedefRedef-ERR1: typedefRedef.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR1
 
-alloc-ERROR: alloc.cfa $(CFACC)
+alloc-ERROR: alloc.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR1
 
-nested-types-ERR1: nested-types.cfa $(CFACC)
+nested-types-ERR1: nested-types.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR1
 
-nested-types-ERR2: nested-types.cfa $(CFACC)
+nested-types-ERR2: nested-types.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR2
 
-raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACC)
+raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR1
 
-raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACC)
+raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR2
 
-raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACC)
+raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR1
 
-raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACC)
+raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACCBIN)
 	$(CFATEST_STDOUT) -DERR1
 
 #builtins
-builtins/sync: builtins/sync.cfa $(CFACC)
+builtins/sync: builtins/sync.cfa $(CFACCBIN)
 	$(CFATEST_STDERR) -fsyntax-only
 
 # Warnings
-warnings/self-assignment: warnings/self-assignment.cfa $(CFACC)
+warnings/self-assignment: warnings/self-assignment.cfa $(CFACCBIN)
 	$(CFATEST_STDERR) -fsyntax-only
 
Index: tests/config.py.in
===================================================================
--- tests/config.py.in	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ tests/config.py.in	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -8,2 +8,3 @@
 BUILDDIR = "@abs_builddir@"
 HOSTARCH = "@host_cpu@"
+DISTRIBUTE = @HAS_DISTCC@
Index: tests/pybin/settings.py
===================================================================
--- tests/pybin/settings.py	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ tests/pybin/settings.py	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -14,4 +14,5 @@
 	SRCDIR = os.path.abspath(config.SRCDIR)
 	BUILDDIR = os.path.abspath(config.BUILDDIR)
+	distribute = config.DISTRIBUTE
 	os.chdir(testpath)
 
@@ -88,7 +89,11 @@
 		self.string = "debug" if value else "no debug"
 		self.flags  = """DEBUG_FLAGS=%s""" % ("-debug -O0" if value else "-nodebug -O2")
+		self.path   = "debug" if value else "nodebug"
 
 class Install:
 	def __init__(self, value):
+		if value:
+			distribute = False
+
 		self.string = "installed" if value else "in-tree"
 		self.flags  = """INSTALL_FLAGS=%s""" % ("" if value else "-in-tree")
@@ -109,23 +114,29 @@
 def init( options ):
 	global arch
+	global archive
+	global debug
+	global distcc
 	global dry_run
 	global generating
+	global install
 	global make
-	global debug
-	global install
+	global output_width
 	global timeout
-	global output_width
-	global archive
 
+	arch         = Architecture(options.arch)
+	archive      = os.path.abspath(os.path.join(original_path, options.archive_errors)) if options.archive_errors else None
+	debug        = Debug(options.debug)
+	distcc       = "DISTCC_CFA_PATH=~/.cfadistcc/%s/cfa" % tools.config_hash()
 	dry_run      = options.dry_run
 	generating   = options.regenerate_expected
+	install      = Install(options.install)
 	make         = ['make']
-	debug        = Debug(options.debug)
-	install      = Install(options.install)
-	arch         = Architecture(options.arch)
+	output_width = 24
 	timeout      = Timeouts(options.timeout, options.global_timeout)
-	output_width = 24
-	archive      = os.path.abspath(os.path.join(original_path, options.archive_errors)) if options.archive_errors else None
 
+	# if we distribute, distcc errors will fail tests, use log file for distcc
+	# don't use "'DISTCC_LOG' not in os.environ" because it can be set to ''
+	if distribute and not os.environ.get('DISTCC_LOG'):
+		os.putenv('DISTCC_LOG', os.path.join(BUILDDIR, 'distcc_error.log'))
 
 def update_make_cmd(force, jobs):
@@ -136,5 +147,5 @@
 def validate():
 	errf = os.path.join(BUILDDIR, ".validate.err")
-	make_ret, out = tools.make( ".validate", error_file = errf, output=subprocess.DEVNULL, error=subprocess.DEVNULL )
+	make_ret, out = tools.make( ".validate", error_file = errf, output_file=subprocess.DEVNULL, error=subprocess.DEVNULL )
 	if make_ret != 0:
 		with open (errf, "r") as myfile:
Index: tests/pybin/tools.py
===================================================================
--- tests/pybin/tools.py	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ tests/pybin/tools.py	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -23,13 +23,16 @@
 
 # helper functions to run terminal commands
-def sh(*cmd, timeout = False, output = None, input = None, error = subprocess.STDOUT):
+def sh(*cmd, timeout = False, output_file = None, input_file = None, input_text = None, error = subprocess.STDOUT):
 	cmd = list(cmd)
+
+	if input_file and input_text:
+		return 401, "Cannot use both text and file inputs"
 
 	# if this is a dry_run, only print the commands that would be ran
 	if settings.dry_run :
 		cmd = "{} cmd: {}".format(os.getcwd(), ' '.join(cmd))
-		if output and not isinstance(output, int):
+		if output_file and not isinstance(output_file, int):
 			cmd += " > "
-			cmd += output
+			cmd += output_file
 
 		if error and not isinstance(error, int):
@@ -37,7 +40,7 @@
 			cmd += error
 
-		if input and not isinstance(input, int) and os.path.isfile(input):
+		if input_file and not isinstance(input_file, int) and os.path.isfile(input_file):
 			cmd += " < "
-			cmd += input
+			cmd += input_file
 
 		print(cmd)
@@ -46,8 +49,8 @@
 	with contextlib.ExitStack() as onexit:
 		# add input redirection if needed
-		input = openfd(input, 'r', onexit, True)
+		input_file = openfd(input_file, 'r', onexit, True)
 
 		# add output redirection if needed
-		output = openfd(output, 'w', onexit, False)
+		output_file = openfd(output_file, 'w', onexit, False)
 
 		# add error redirection if needed
@@ -58,9 +61,10 @@
 			proc = subprocess.run(
 				cmd,
-				stdin =input,
-				stdout=output,
-				stderr=error,
-				timeout=settings.timeout.single if timeout else None
+				**({'input' : bytes(input_text, encoding='utf-8')} if input_text else {'stdin' : input_file}),
+				stdout  = output_file,
+				stderr  = error,
+				timeout = settings.timeout.single if timeout else None
 			)
+
 			return proc.returncode, proc.stdout.decode("utf-8") if proc.stdout else None
 		except subprocess.TimeoutExpired:
@@ -75,5 +79,5 @@
 		return False
 
-	code, out = sh("file %s" % fname, output=subprocess.PIPE)
+	code, out = sh("file %s" % fname, output_file=subprocess.PIPE)
 	if code != 0:
 		return False
@@ -107,5 +111,5 @@
 	if isinstance(files, str ): files = [ files ]
 	for file in files:
-		sh( 'rm', '-f', file, output=subprocess.DEVNULL, error=subprocess.DEVNULL )
+		sh( 'rm', '-f', file, output_file=subprocess.DEVNULL, error=subprocess.DEVNULL )
 
 # Create 1 or more directory
@@ -115,5 +119,5 @@
 		p = os.path.normpath( file )
 		d = os.path.dirname ( p )
-		sh( 'mkdir', '-p', d, output=subprocess.DEVNULL, error=subprocess.DEVNULL )
+		sh( 'mkdir', '-p', d, output_file=subprocess.DEVNULL, error=subprocess.DEVNULL )
 
 
@@ -138,9 +142,9 @@
 		lhs,
 		rhs,
-		output=subprocess.PIPE
+		output_file=subprocess.PIPE
 	)
 
 # call make
-def make(target, *, flags = '', output = None, error = None, error_file = None, silent = False):
+def make(target, *, flags = '', output_file = None, error = None, error_file = None, silent = False):
 	test_param = """test="%s" """ % (error_file) if error_file else None
 	cmd = [
@@ -151,9 +155,10 @@
 		settings.debug.flags,
 		settings.install.flags,
+		settings.distcc if settings.distribute else None,
 		flags,
 		target
 	]
 	cmd = [s for s in cmd if s]
-	return sh(*cmd, output=output, error=error)
+	return sh(*cmd, output_file=output_file, error=error)
 
 def which(program):
@@ -201,5 +206,5 @@
 # cat one file into the other
 def cat(source, dest):
-	ret, _ = sh("cat", source, output=dest)
+	ret, _ = sh("cat", source, output_file=dest)
 	return ret
 
@@ -274,4 +279,16 @@
 ################################################################################
 
+# get hash for given configuration
+def config_hash():
+	path = os.path.normpath(os.path.join(
+		settings.SRCDIR,
+	))
+
+	distcc_hash = os.path.join(settings.SRCDIR, '../tools/build/distcc_hash')
+	config = "%s-%s" % (settings.arch.target, settings.debug.path)
+	_, out = sh(distcc_hash, config, output_file=subprocess.PIPE)
+	return out.strip()
+
+# get pretty string for time of day
 def pretty_now():
 	ts = time.time()
@@ -308,5 +325,5 @@
 		return 1, "ERR No core dump"
 
-	return sh('gdb', '-n', path, core, '-batch', '-x', cmd, output=subprocess.PIPE)
+	return sh('gdb', '-n', path, core, '-batch', '-x', cmd, output_file=subprocess.PIPE)
 
 def core_archive(dst, name, exe):
Index: tests/test.py
===================================================================
--- tests/test.py	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ tests/test.py	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -143,5 +143,5 @@
 	# build, skipping to next test on error
 	with Timed() as comp_dur:
-		make_ret, _ = make( test.target(), output=subprocess.DEVNULL, error=out_file, error_file = err_file )
+		make_ret, _ = make( test.target(), output_file=subprocess.DEVNULL, error=out_file, error_file = err_file )
 
 	run_dur = None
@@ -153,5 +153,5 @@
 				if settings.dry_run or is_exe(exe_file):
 					# run test
-					retcode, _ = sh(exe_file, output=out_file, input=in_file, timeout=True)
+					retcode, _ = sh(exe_file, output_file=out_file, input_file=in_file, timeout=True)
 				else :
 					# simply cat the result into the output
@@ -219,5 +219,5 @@
 def run_tests(tests, jobs) :
 	# clean the sandbox from previous commands
-	make('clean', output=subprocess.DEVNULL, error=subprocess.DEVNULL)
+	make('clean', output_file=subprocess.DEVNULL, error=subprocess.DEVNULL)
 
 	# create the executor for our jobs and handle the signal properly
@@ -260,5 +260,5 @@
 
 	# clean the workspace
-	make('clean', output=subprocess.DEVNULL, error=subprocess.DEVNULL)
+	make('clean', output_file=subprocess.DEVNULL, error=subprocess.DEVNULL)
 
 	return 1 if failed else 0
Index: tools/Makefile.in
===================================================================
--- tools/Makefile.in	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ tools/Makefile.in	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -238,4 +238,5 @@
 FGREP = @FGREP@
 GREP = @GREP@
+HAS_DISTCC = @HAS_DISTCC@
 HOST_FLAGS = @HOST_FLAGS@
 INSTALL = @INSTALL@
Index: tools/prettyprinter/Makefile.in
===================================================================
--- tools/prettyprinter/Makefile.in	(revision 216597dc79087a8783d8e29a32d471445b0aa5ad)
+++ tools/prettyprinter/Makefile.in	(revision c2051e106b97c83b3809b5b85c34a13861991d58)
@@ -267,4 +267,5 @@
 FGREP = @FGREP@
 GREP = @GREP@
+HAS_DISTCC = @HAS_DISTCC@
 HOST_FLAGS = @HOST_FLAGS@
 INSTALL = @INSTALL@
