diff --git a/glib.c b/glib.c
index d2b785e86415da8eee78f5430a6d1f3b964777e0..cabc3815f73cd5f7a2c841a027076891835ccb23 100644
--- a/glib.c
+++ b/glib.c
@@ -18,6 +18,14 @@
 #include <poll.h>
 #endif
 
+#ifdef HAVE_STRING_H
+#  include <string.h>	/* Needed on NetBSD1.1/SPARC due to bzero/FD_ZERO. */
+#endif
+
+#ifdef HAVE_STRINGS_H
+#  include <strings.h>  /* Needed on AIX 4.2 due to bzero/FD_ZERO. */
+#endif
+
 static int use_count = 0;
 static oop_source_sys *sys;
 static oop_adapter_select *sel;
diff --git a/select.c b/select.c
index edf48a67ad1e34b02120943114f839cf226a69a3..c838b20399ecf843755d66127bd5ed24c8974ea2 100644
--- a/select.c
+++ b/select.c
@@ -8,6 +8,14 @@
 
 #include <assert.h>
 
+#ifdef HAVE_STRING_H
+#  include <string.h>	/* Needed on NetBSD1.1/SPARC due to bzero/FD_ZERO. */
+#endif
+
+#ifdef HAVE_STRINGS_H
+#  include <strings.h>  /* Needed on AIX 4.2 due to bzero/FD_ZERO. */
+#endif
+
 struct select_set {
 	fd_set rfd,wfd,xfd;
 };