Rework site config for cmake to be generated at configure time, and only pass
the 'build_config' value in at runtime using the new lit runtime user parameter
feature.

This simplifies things and drops a dependency on 'sed', FWIW.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86421 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index c88c90b..0d452ef 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -7,5 +7,14 @@
 config.clang_obj_root = "@CLANG_BINARY_DIR@"
 config.target_triple = "@TARGET_TRIPLE@"
 
+# Support substitution of the tools and libs dirs with user parameters. This is
+# used when we can't determine the tool dir at configuration time.
+try:
+    config.llvm_tools_dir = config.llvm_tools_dir % lit.params
+    config.llvm_libs_dir = config.llvm_libs_dir % lit.params
+except KeyError,e:
+    key, = e.args
+    lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
+
 # Let the main config do the real work.
 lit.load_config(config, "@CLANG_SOURCE_DIR@/test/lit.cfg")