diff --git a/configure.ac b/configure.ac
index 8318d6cf4dda7f090f2168d9fa84b871d3e6e737..affb063f23d1aa96cb91df7e20516791ae35b553 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1069,7 +1069,6 @@ AC_CONFIG_FILES(
   hadrian/ghci-cabal
   hadrian/ghci-multi-cabal
   hadrian/ghci-stack
-  docs/users_guide/ghc_config.py
   distrib/configure.ac
   hadrian/cfg/default.host.target
   hadrian/cfg/default.target
diff --git a/hadrian/cfg/system.config.in b/hadrian/cfg/system.config.in
index 3aad150112a68782d7975737d2910943251efbe7..a421cab043a42f7f616566830dd8ddae6472aabf 100644
--- a/hadrian/cfg/system.config.in
+++ b/hadrian/cfg/system.config.in
@@ -34,6 +34,9 @@ python         = @PythonCmd@
 
 cc-llvm-backend           = @CcLlvmBackend@
 
+llvm-min-version          = @LlvmMinVersion@
+llvm-max-version          = @LlvmMaxVersion@
+
 # Build options:
 #===============
 
diff --git a/hadrian/src/Oracles/Setting.hs b/hadrian/src/Oracles/Setting.hs
index 46d250241933648110811a477760660c2d49b894..810bc2e19e3fd41c9b9b2579877d30c42161f328 100644
--- a/hadrian/src/Oracles/Setting.hs
+++ b/hadrian/src/Oracles/Setting.hs
@@ -49,6 +49,8 @@ data Setting = CursesIncludeDir
              | GhcPatchLevel
              | GhcVersion
              | GhcSourcePath
+             | LlvmMinVersion
+             | LlvmMaxVersion
              | GmpIncludeDir
              | GmpLibDir
              | IconvIncludeDir
@@ -103,6 +105,8 @@ setting key = lookupSystemConfig $ case key of
     GhcPatchLevel      -> "ghc-patch-level"
     GhcVersion         -> "ghc-version"
     GhcSourcePath      -> "ghc-source-path"
+    LlvmMinVersion     -> "llvm-min-version"
+    LlvmMaxVersion     -> "llvm-max-version"
     GmpIncludeDir      -> "gmp-include-dir"
     GmpLibDir          -> "gmp-lib-dir"
     IconvIncludeDir    -> "iconv-include-dir"
diff --git a/hadrian/src/Rules/Documentation.hs b/hadrian/src/Rules/Documentation.hs
index aa945a996b1f45fd8fecb98f391b659074b0a558..9de31707d7c35a254952cfacd4f84539a64edd6c 100644
--- a/hadrian/src/Rules/Documentation.hs
+++ b/hadrian/src/Rules/Documentation.hs
@@ -356,6 +356,9 @@ buildSphinxInfoGuide = do
   root <- buildRootRules
   let path = "GHCUsersGuide"
   root -/- infoRoot -/- path <.> "info" %> \ file -> do
+
+        needDocDeps
+
         withTempDir $ \dir -> do
             let rstFilesDir = pathPath path
             rstFiles <- getDirectoryFiles rstFilesDir ["**/*.rst"]
@@ -391,6 +394,8 @@ buildManPage = do
     root <- buildRootRules
     root -/- manPageBuildPath %> \file -> do
         need ["docs/users_guide/ghc.rst"]
+        needDocDeps
+
         withTempDir $ \dir -> do
             build $ target docContext (Sphinx ManMode) ["docs/users_guide"] [dir]
             checkSphinxWarnings dir
diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs
index 7a3046381aa61340b7bbbe72582855509e65198f..6a6875c22eeaf720f46a7a191b22e5053f97a612 100644
--- a/hadrian/src/Rules/Generate.hs
+++ b/hadrian/src/Rules/Generate.hs
@@ -324,7 +324,12 @@ templateRules = do
   templateRule "libraries/template-haskell/template-haskell.cabal" $ projectVersion
   templateRule "libraries/prologue.txt" $ packageVersions
   templateRule "docs/index.html" $ packageVersions
-  templateRule "docs/users_guide/ghc_config.py" $ packageUnitIds Stage1
+  templateRule "docs/users_guide/ghc_config.py" $ mconcat
+    [ projectVersion
+    , packageUnitIds Stage1
+    , interpolateSetting "LlvmMinVersion" LlvmMinVersion
+    , interpolateSetting "LlvmMaxVersion" LlvmMaxVersion
+    ]
 
 
 -- Generators