Index: driver/cfa.cc
===================================================================
--- driver/cfa.cc	(revision 28582b2f67a95666cd46d6aa6b773838c5711333)
+++ driver/cfa.cc	(revision a5121bff2d239413034fc4cc466f9e5b15eebd1b)
@@ -86,6 +86,7 @@
 	string Major( str( CFA_VERSION_MAJOR ) ), Minor( str( CFA_VERSION_MINOR ) ), Patch( str( CFA_VERSION_PATCH ) );
 
-	string installincdir( CFA_INCDIR );					// fixed location of include files
-	string installlibdir( CFA_LIBDIR );					// fixed location of cc1 and cfa-cpp commands
+	string installincdir( CFA_INCDIR );                         // fixed location of include files
+	string installlibdir( CFA_LIBDIR );                         // fixed location of cc1 and cfa-cpp commands when installed
+	string srcdriverdir ( TOP_BUILDDIR "driver");                // fixed location of cc1 and cfa-cpp commands when in tree
 
 	string heading;										// banner printed at start of cfa compilation
@@ -171,5 +172,4 @@
 				noincstd_flag = true;					// strip the no-include-stdhdr flag
 			} else if ( arg == "-in-tree" ) {
-				noincstd_flag = true;
 				intree = true;
 			} else if ( arg == "-compiler" ) {
@@ -338,37 +338,54 @@
 
 	// add the CFA include-library paths, which allow direct access to header files without directory qualification
-	args[nargs] = "-I" CFA_INCDIR;
-	nargs += 1;
-	if ( ! noincstd_flag ) {							// do not use during build
-		args[nargs] = "-I" CFA_INCDIR "/stdhdr";
-		nargs += 1;
-	} // if
-	args[nargs] = "-I" CFA_INCDIR "/concurrency";
-	nargs += 1;
-	args[nargs] = "-I" CFA_INCDIR "/containers";
-	nargs += 1;
-
-	string libdir;
 	if( !intree ) {
-		const char * const arch = m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU);
-		const char * config = debug ? "debug": "nodebug";
-		libdir = string(CFA_LIBDIR) + arch + config;
-		if( !dirExists(libdir) ) {
-			cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl;
-			libdir = string(CFA_LIBDIR) + arch + "nolib";
-		}
-
-		if( !dirExists(libdir) ) {
-			cerr << argv[0] << " internal error, cannot find prelude directory." << endl;
-			cerr << "Was looking for " << libdir << endl;
-			exit( EXIT_FAILURE );
-		}
-
-		args[nargs] = ( *new string( string("-D__CFA_FLAG__=--prelude-dir=" ) + libdir) ).c_str();
+		args[nargs] = "-I" CFA_INCDIR;
+		nargs += 1;
+		if ( ! noincstd_flag ) {							// do not use during build
+			args[nargs] = "-I" CFA_INCDIR "/stdhdr";
+			nargs += 1;
+		} // if
+		args[nargs] = "-I" CFA_INCDIR "/concurrency";
+		nargs += 1;
+		args[nargs] = "-I" CFA_INCDIR "/containers";
 		nargs += 1;
 	} else {
+		args[nargs] = "-I" TOP_SRCDIR "libcfa/src";
+		nargs += 1;
+		if ( ! noincstd_flag ) {							// do not use during build
+			args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/stdhdr";
+			nargs += 1;
+		} // if
+		args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/concurrency";
+		nargs += 1;
+		args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/containers";
+		nargs += 1;
+	}
+
+	string libbase;
+	if( !intree ) {
+		libbase = CFA_LIBDIR;
+	} else {
+		libbase = TOP_BUILDDIR "libcfa/";
 		args[nargs] = "-D__CFA_FLAG__=-t";
 		nargs += 1;
 	}
+
+	const char * const arch = m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU);
+	const char * config = debug ? "debug": "nodebug";
+	string libdir = libbase + arch + "-" + config;
+	if( !dirExists(libdir) ) {
+		cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl;
+		cerr << "Was looking for " << libdir << endl;
+		libdir = libbase + arch + "-" + "nolib";
+	}
+
+	if( !dirExists(libdir) ) {
+		cerr << argv[0] << " internal error, cannot find prelude directory." << endl;
+		cerr << "Was looking for " << libdir << endl;
+		exit( EXIT_FAILURE );
+	}
+
+	args[nargs] = ( *new string( string("-D__CFA_FLAG__=--prelude-dir=" ) + libdir + (intree ? "/prelude" : "")) ).c_str();
+	nargs += 1;
 
 	if ( link ) {
@@ -387,8 +404,6 @@
 
 		// include the cfa library in case it's needed
-		if( !intree ) {
-			args[nargs] = ( *new string( string("-L" ) + libdir) ).c_str();
-			nargs += 1;
-		}
+		args[nargs] = ( *new string( string("-L" ) + libdir + (intree ? "/src" : "")) ).c_str();
+		nargs += 1;
 		args[nargs] = "-lcfa";
 		nargs += 1;
@@ -445,5 +460,5 @@
 
 	if ( Bprefix.length() == 0 ) {
-		Bprefix = installlibdir;
+		Bprefix = !intree ? installlibdir : srcdriverdir;
 		args[nargs] = ( *new string( string("-D__GCC_BPREFIX__=") + Bprefix ) ).c_str();
 		nargs += 1;
