diff --git a/libavcodec/os2threads.h b/compat/os2threads.h
similarity index 100%
rename from libavcodec/os2threads.h
rename to compat/os2threads.h
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index ad42d1aebbcba147f56fc6096cfb73ada2188d1a..32d51a10665dddabd2205ed471efd5b2063a6107 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -803,7 +803,6 @@ SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h
 SKIPHEADERS-$(CONFIG_VAAPI)            += vaapi_internal.h
 SKIPHEADERS-$(CONFIG_VDA)              += vda.h
 SKIPHEADERS-$(CONFIG_VDPAU)            += vdpau.h
-SKIPHEADERS-$(HAVE_OS2THREADS)         += os2threads.h
 
 TESTPROGS = cabac                                                       \
             dct                                                         \
diff --git a/libavcodec/frame_thread_encoder.c b/libavcodec/frame_thread_encoder.c
index 80577ec9c4dd1cb680a1e88382766566010e96f1..b9acefc1101bd89b29a32f6fb2cbadeea41bda72 100644
--- a/libavcodec/frame_thread_encoder.c
+++ b/libavcodec/frame_thread_encoder.c
@@ -32,7 +32,7 @@
 #elif HAVE_W32THREADS
 #include "compat/w32pthreads.h"
 #elif HAVE_OS2THREADS
-#include "os2threads.h"
+#include "compat/os2threads.h"
 #endif
 
 #define MAX_THREADS 64
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 259dab0d8c309134d71be058d7771d9397adead8..7968a613586b27fd70cba86a7b82008e300f5f40 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -43,7 +43,7 @@
 #elif HAVE_W32THREADS
 #include "compat/w32pthreads.h"
 #elif HAVE_OS2THREADS
-#include "os2threads.h"
+#include "compat/os2threads.h"
 #endif
 
 typedef int (action_func)(AVCodecContext *c, void *arg);
diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h
index 1bba79e41565180598fbf8871001aba4286a5a16..3bc06a7c58bf1c4ab3e9161621195b40f7e76115 100644
--- a/libavcodec/vp8.h
+++ b/libavcodec/vp8.h
@@ -38,7 +38,7 @@
 #elif HAVE_W32THREADS
 #include "compat/w32pthreads.h"
 #elif HAVE_OS2THREADS
-#include "os2threads.h"
+#include "compat/os2threads.h"
 #endif
 
 #define VP8_MAX_QUANT 127
diff --git a/libavfilter/pthread.c b/libavfilter/pthread.c
index 0630ad2f501b352b0ad48edc2c368db05e5d056e..eb40f0058ee61312a1a845ba46904b9cc86db80a 100644
--- a/libavfilter/pthread.c
+++ b/libavfilter/pthread.c
@@ -34,6 +34,8 @@
 
 #if HAVE_PTHREADS
 #include <pthread.h>
+#elif HAVE_OS2THREADS
+#include "compat/os2threads.h"
 #elif HAVE_W32THREADS
 #include "compat/w32pthreads.h"
 #endif
diff --git a/libavformat/network.c b/libavformat/network.c
index abb89b331e9cae72be5e4b2056f5e1e6a75393c7..766351eb6eb037f15d70d1db98d1da1aaa0e0630 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -29,7 +29,7 @@
 #if HAVE_PTHREADS
 #include <pthread.h>
 #elif HAVE_OS2THREADS
-#include "libavcodec/os2threads.h"
+#include "compat/os2threads.h"
 #else
 #include "compat/w32pthreads.h"
 #endif