--- a/lib/nanosleep.c
+++ b/lib/nanosleep.c
@@ -82,6 +82,7 @@
 }
 
 #elif defined _WIN32 && ! defined __CYGWIN__
+#if !(defined(_POSIX_THREADS) && _POSIX_THREADS > 0)
 /* Native Windows platforms.  */
 
 # define WIN32_LEAN_AND_MEAN
@@ -174,7 +175,7 @@
     }
   return 0;
 }
-
+#endif
 #else
 /* Other platforms lacking nanosleep.
    It's not clear whether these are still practical porting targets.
