diff --git a/contrib/web_ldap/util.c b/contrib/web_ldap/util.c
index 27cc4d6cefe7a60aec89d95050293addd1fa595f..d52365cb9c6da73672e4ab60878ff3b92fd2c68b 100644
--- a/contrib/web_ldap/util.c
+++ b/contrib/web_ldap/util.c
@@ -16,6 +16,9 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
 
 #include <ac/string.h>
 #include <ac/ctype.h>