diff --git a/configure.ac b/configure.ac
index 4e63fe5d7fe346afe2e6e19b71fcb249c0551eed..0a6f5b9161233ae7f0027a311046d06d33d13558 100644
--- a/configure.ac
+++ b/configure.ac
@@ -154,7 +154,7 @@ AC_SEARCH_LIBS([adler32], [z])
 
 # Checks for header files.
 AC_HEADER_RESOLV
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h malloc.h netdb.h netinet/in_systm.h netinet/in.h stdint.h stdlib.h string.h strings.h sys/socket.h sys/time.h sys/select.h sys/wait.h sys/stat.h cap-ng.h syslog.h unistd.h urcu.h ev.h pthread_np.h])
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h malloc.h netdb.h netinet/in_systm.h netinet/in.h stdint.h stdlib.h string.h strings.h sys/socket.h sys/time.h sys/select.h sys/wait.h sys/stat.h cap-ng.h syslog.h unistd.h urcu.h ev.h pthread_np.h signal.h])
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_HEADER_STDBOOL
diff --git a/src/common/fdset.h b/src/common/fdset.h
index 12fc5c7148383d1c87be9b2552cf86a891365e0b..a589145ad47db2aa23d807fadba57be00262ddb6 100644
--- a/src/common/fdset.h
+++ b/src/common/fdset.h
@@ -32,9 +32,16 @@
 #ifndef _KNOTD_FDSET_H_
 #define _KNOTD_FDSET_H_
 
+#include "config.h"
 #include <stddef.h>
 #ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
+ #include <sys/select.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+ #include <sys/time.h>
+#endif
+#ifdef HAVE_SIGNAL_H
+ #include <signal.h>
 #endif
 #include "skip-list.h"
 #include "mempattern.h"