diff --git a/src/stream.c b/src/stream.c
index 7264d353566a1e94c0ab55bec832444762c379f8..8da402e54315b32ad325dd10d22a20672be9b5e9 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -671,11 +671,17 @@ streamOpenID(const char *filename, char filemode, int filetype, int resH)
 #ifndef HAVE_NC4HDF5_THREADSAFE
   if (CDI_Threadsafe)
     {
-#ifndef HAVE_LIBPTHREAD
-      Error("CDI threadsafe failed, pthread support not compiled in!");
-#endif
+#ifdef HAVE_LIBPTHREAD
       if (filetype == CDI_FILETYPE_NC4 || filetype == CDI_FILETYPE_NC4C || filetype == CDI_FILETYPE_NCZARR)
         streamptr->lockIO = true;
+#else
+      static bool lwarn = true;
+      if (lwarn)
+        {
+          lwarn = false;
+          Warning("CDI threadsafe failed, pthread support not compiled in!");
+        }
+#endif
     }
 #endif