diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index c4cde86..c1f712a 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3313,7 +3313,19 @@ AC_DEFUN([GLIBCXX_ENABLE_THREADS], [
   target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
   AC_MSG_RESULT([$target_thread_file])
 
-  glibcxx_thread_h=gthr-$target_thread_file.h
+  case $target_thread_file in
+    aix)        glibcxx_thread_h=config/rs6000/gthr-aix.h ;;
+    dce)        glibcxx_thread_h=config/pa/gthr-dce.h ;;
+    lynx)       glibcxx_thread_h=config/gthr-lynx.h ;;
+    mipssde)    glibcxx_thread_h=config/mips/gthr-mipssde.h ;;
+    posix)      glibcxx_thread_h=gthr-posix.h ;;
+    rtems)      glibcxx_thread_h=config/gthr-rtems.h ;;
+    single)     glibcxx_thread_h=gthr-single.h ;;
+    tpf)        glibcxx_thread_h=config/s390/gthr-tpf.h ;;
+    vxworks)    glibcxx_thread_h=config/gthr-vxworks.h ;;
+    win32)      glibcxx_thread_h=config/i386/gthr-win32.h ;;
+  esac
+
   AC_SUBST(glibcxx_thread_h)
 ])
 
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 912c034..e6666fa 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -15161,7 +15161,19 @@ $as_echo_n "checking for thread model used by GCC... " >&6; }
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $target_thread_file" >&5
 $as_echo "$target_thread_file" >&6; }
 
-  glibcxx_thread_h=gthr-$target_thread_file.h
+  case $target_thread_file in
+    aix)        glibcxx_thread_h=config/rs6000/gthr-aix.h ;;
+    dce)        glibcxx_thread_h=config/pa/gthr-dce.h ;;
+    lynx)       glibcxx_thread_h=config/gthr-lynx.h ;;
+    mipssde)    glibcxx_thread_h=config/mips/gthr-mipssde.h ;;
+    posix)      glibcxx_thread_h=gthr-posix.h ;;
+    rtems)      glibcxx_thread_h=config/gthr-rtems.h ;;
+    single)     glibcxx_thread_h=gthr-single.h ;;
+    tpf)        glibcxx_thread_h=config/s390/gthr-tpf.h ;;
+    vxworks)    glibcxx_thread_h=config/gthr-vxworks.h ;;
+    win32)      glibcxx_thread_h=config/i386/gthr-win32.h ;;
+  esac
+
 
 
 
@@ -15371,7 +15383,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
   # Fake what AC_TRY_COMPILE does.
 
     cat > conftest.$ac_ext << EOF
-#line 15374 "configure"
+#line 15386 "configure"
 int main()
 {
   typedef bool atomic_type;
@@ -15406,7 +15418,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 15409 "configure"
+#line 15421 "configure"
 int main()
 {
   typedef short atomic_type;
@@ -15441,7 +15453,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 15444 "configure"
+#line 15456 "configure"
 int main()
 {
   // NB: _Atomic_word not necessarily int.
@@ -15477,7 +15489,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 15480 "configure"
+#line 15492 "configure"
 int main()
 {
   typedef long long atomic_type;
@@ -15556,7 +15568,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu
   # unnecessary for this test.
 
     cat > conftest.$ac_ext << EOF
-#line 15559 "configure"
+#line 15571 "configure"
 int main()
 {
   _Decimal32 d1;
@@ -15598,7 +15610,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
   # unnecessary for this test.
 
     cat > conftest.$ac_ext << EOF
-#line 15601 "configure"
+#line 15613 "configure"
 template<typename T1, typename T2>
   struct same
   { typedef T2 type; };
@@ -15632,7 +15644,7 @@ $as_echo "$enable_int128" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 15635 "configure"
+#line 15647 "configure"
 template<typename T1, typename T2>
   struct same
   { typedef T2 type; };
