diff --git a/src/configure.in b/src/configure.in
index 70b4203dfebe514a0c70a0d733b0a22ea65cd053..995c87b678185129befcb7336725f726ea999009 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -3275,7 +3275,7 @@ AC_CHECK_HEADERS(winsock2.h sys/rusage.h time.h sys/time.h sys/types.h \
 		 mach/mach_init.h syscall.h sys/syscall.h devices/timer.h \
 		 direct.h CoreServices/CoreServices.h execinfo.h \
 		 mach/mach.h mach/thread_act.h mach/clock.h urcu.h \
-		 machine/bswap.h sys/endian.h,,,[
+		 machine/bswap.h sys/endian.h util.h,,,[
 #if (defined(__WINNT__) || defined(__WIN32__)) && !defined(__NT__)
 #define __NT__
 #endif
diff --git a/src/fdlib.h b/src/fdlib.h
index 5915219b8edba1b55b2a10e0e889a6cf0ec8592a..68906cc48fa381a5c1c4728ac793da775161df70 100644
--- a/src/fdlib.h
+++ b/src/fdlib.h
@@ -623,6 +623,9 @@ typedef struct my_fd_set_s my_fd_set;
 #define TTY_CAPABILITIES (fd_TTY | fd_INTERPROCESSABLE | fd_BIDIRECTIONAL | fd_CAN_NONBLOCK)
 
 #ifdef HAVE_OPENPTY
+#ifdef HAVE_UTIL_H
+#include <util.h>
+#endif
 #define fd_openpty	openpty	/* FIXME */
 #endif
 
diff --git a/src/modules/HTTPLoop/util.h b/src/modules/HTTPLoop/util.h
index fe7cac9278091f499accf6aba9043ac2f24abf7c..5fe4c0e3785d5e9a15076d74b1f2975bf938e46c 100644
--- a/src/modules/HTTPLoop/util.h
+++ b/src/modules/HTTPLoop/util.h
@@ -12,4 +12,5 @@ ptrdiff_t aap_swrite(int to, char *buf, size_t towrite);
 #define H_STRING 2
 
 
+struct args;
 int aap_get_header(struct args *req, char *header, int operation, void *res);