diff --git a/.gitignore b/.gitignore
index 39bf855af36aee50ca84353e1d331fcb3024a4a6..1ff4a8c36361f4d945260c5b09e86310cd1a062e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -184,8 +184,8 @@ _darcs/
 /linter.log
 /mk/are-validating.mk
 /mk/build.mk
-/mk/config.h
-/mk/config.h.in
+/mk/unused.h
+/mk/unused.h.in
 /mk/config.mk
 /mk/config.mk.old
 /mk/system-cxx-std-lib-1.0.conf
diff --git a/compiler/GHC/Builtin/primops.txt.pp b/compiler/GHC/Builtin/primops.txt.pp
index fd8ebd3d7e7a82481d9055fc65c025aa3fa7a46f..fd3518ab82b8bb0b45df92dd95f38b38f5d3fe37 100644
--- a/compiler/GHC/Builtin/primops.txt.pp
+++ b/compiler/GHC/Builtin/primops.txt.pp
@@ -229,7 +229,7 @@ section "The word size story."
          must contain at least 30 bits. GHC always implements
          'Int' using the primitive type 'Int#', whose size equals
          the @MachDeps.h@ constant @WORD\_SIZE\_IN\_BITS@.
-         This is normally set based on the @config.h@ parameter
+         This is normally set based on the RTS @ghcautoconf.h@ parameter
          @SIZEOF\_HSWORD@, i.e., 32 bits on 32-bit machines, 64
          bits on 64-bit machines.
 
diff --git a/configure.ac b/configure.ac
index b593fbe32e7855ab99e9789d8f2dc094f11932f7..31c3c259d7602ae890b6e3b29482cdb113211927 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,8 +32,8 @@ AC_CONFIG_MACRO_DIRS([m4])
 # checkout), then we ship a file 'VERSION' containing the full version
 # when the source distribution was created.
 
-if test ! -f mk/config.h.in; then
-   echo "mk/config.h.in doesn't exist: perhaps you haven't run 'python3 boot'?"
+if test ! -f rts/ghcautoconf.h.autoconf.in; then
+   echo "rts/ghcautoconf.h.autoconf.in doesn't exist: perhaps you haven't run 'python3 boot'?"
    exit 1
 fi
 
@@ -84,8 +84,11 @@ AC_PREREQ([2.69])
 # Prepare to generate the following header files
 #
 
-# This one is autogenerated by autoheader.
-AC_CONFIG_HEADER(mk/config.h)
+dnl so the next header, which is manually maintained, doesn't get
+dnl overwritten by an autogenerated header. Once we have no more
+dnl `AC_CONFIG_HEADER` calls (issue #23966) we can delete all mention
+dnl of `mk/unused.h`.
+AC_CONFIG_HEADER(mk/unused.h)
 # This one is manually maintained.
 AC_CONFIG_HEADER(compiler/ghc-llvm-version.h)
 
diff --git a/distrib/cross-port b/distrib/cross-port
index 29dd804e825b86e884505e835e45b633bae1edac..ad18daa4751fec0851e21bcfd3bf158d061f1f1a 100644
--- a/distrib/cross-port
+++ b/distrib/cross-port
@@ -28,7 +28,7 @@ if [ ! -f b1-stamp ]; then
 
    # For cross-compilation, at this stage you may want to set up a source
    # tree on the target machine, run the configure script there, and bring
-   # the resulting mk/config.h file back into this tree before building
+   # the resulting rts/ghcautoconf.h.autoconf file back into this tree before building
    # the libraries.
 
    touch mk/build.mk
@@ -38,7 +38,7 @@ if [ ! -f b1-stamp ]; then
 
    # We could optimise slightly by not building hslibs here.  Also, building
    # the RTS is not necessary (and might not be desirable if we're using
-   # a config.h from the target system).
+   # a ghcautoconf.h from the target system).
    make stage1
 
   cd ..
diff --git a/docs/coding-style.html b/docs/coding-style.html
index 29112bf60f9a2f3223732e5a6c510eaa583d04bf..71712804df34c78c15ed49edb11ed0dc4c961dbc 100644
--- a/docs/coding-style.html
+++ b/docs/coding-style.html
@@ -108,7 +108,7 @@ POSIX-compliant to explicitly say so by having <code>#include
 
 <p><li> Some architectures have memory alignment constraints.  Others
 don't have any constraints but go faster if you align things.  These
-macros (from <tt>config.h</tt>) tell you which alignment to use
+macros (from <tt>ghcautoconf.h</tt>) tell you which alignment to use
 
 <pre>
   /* minimum alignment of unsigned int */
diff --git a/hadrian/src/Rules/SourceDist.hs b/hadrian/src/Rules/SourceDist.hs
index cd90032814fec332d51e3c25f577b3ebe6ae2436..f11a0e7ae312bdd014f688c00407b6ddaf2b7f3c 100644
--- a/hadrian/src/Rules/SourceDist.hs
+++ b/hadrian/src/Rules/SourceDist.hs
@@ -156,7 +156,8 @@ prepareTree dest = do
       , pkgPath terminfo -/- "configure"
       , "configure"
       , "aclocal.m4"
-      , "mk" -/- "config.h.in" ]
+      , "mk" -/- "unused.h.in"
+      ]
 
     copyAlexHappyFiles =
       forM_ alexHappyFiles $ \(stg, pkg, inp, out) -> do
diff --git a/rts/configure.ac b/rts/configure.ac
index 94ae2d30d9a06726bee2008188c4c5ec0c45fd47..4a016b15a4861149ecb227872d75904e528990b5 100644
--- a/rts/configure.ac
+++ b/rts/configure.ac
@@ -390,9 +390,9 @@ touch include/ghcautoconf.h
 
 echo "#if !defined(__GHCAUTOCONF_H__)" >> include/ghcautoconf.h
 echo "#define __GHCAUTOCONF_H__" >> include/ghcautoconf.h
-# Copy the contents of $srcdir/../mk/config.h, turning '#define PACKAGE_FOO
+# Copy the contents of ghcautoconf.h.autoconf, turning '#define PACKAGE_FOO
 # "blah"' into '/* #undef PACKAGE_FOO */' to avoid clashes.
-cat $srcdir/../mk/config.h ghcautoconf.h.autoconf | sed \
+cat ghcautoconf.h.autoconf | sed \
    -e 's,^\([	 ]*\)#[	 ]*define[	 ][	 ]*\(PACKAGE_[A-Z]*\)[	 ][ 	]*".*".*$,\1/* #undef \2 */,' \
    -e '/__GLASGOW_HASKELL/d' \
    -e '/REMOVE ME/d' \