diff --git a/src/tools/hzip.cxx b/src/tools/hzip.cxx
index d7d2d2464..30bb5a32c 100644
--- a/src/tools/hzip.cxx
+++ b/src/tools/hzip.cxx
@@ -38,10 +38,13 @@
 /* hzip: file compression for sorted dictionaries with optional encryption,
  * algorithm: prefix-suffix encoding and 16-bit Huffman encoding */
 
+#include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif /* HAVE_UNISTD_H */
 #include <string>
 #include <sys/stat.h>
 
diff --git a/src/tools/munch.cxx b/src/tools/munch.cxx
index e33ac71e3..1e8342ff5 100644
--- a/src/tools/munch.cxx
+++ b/src/tools/munch.cxx
@@ -40,7 +40,6 @@
 #include <ctype.h>
 #include <string.h>
 #include <string>
-#include <unistd.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <stdio.h>
diff --git a/src/tools/unmunch.cxx b/src/tools/unmunch.cxx
index 5a73e6fe9..3d9e31832 100644
--- a/src/tools/unmunch.cxx
+++ b/src/tools/unmunch.cxx
@@ -42,7 +42,6 @@
 #include <ctype.h>
 #include <string.h>
 #include <string>
-#include <unistd.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <stdio.h>