Do not define and initialize global mutexes on configurations that do not use them.
diff --git a/include/mbedtls/threading.h b/include/mbedtls/threading.h
index b0c34ec..3218f5c 100644
--- a/include/mbedtls/threading.h
+++ b/include/mbedtls/threading.h
@@ -95,8 +95,12 @@
 /*
  * Global mutexes
  */
+#if defined(MBEDTLS_FS_IO)
 extern mbedtls_threading_mutex_t mbedtls_threading_readdir_mutex;
+#endif
+#if defined(MBEDTLS_HAVE_TIME_DATE)
 extern mbedtls_threading_mutex_t mbedtls_threading_gmtime_mutex;
+#endif
 #endif /* MBEDTLS_THREADING_C */
 
 #ifdef __cplusplus