diff --git a/configure.in b/configure.in
index 1a4b9ee36dbd5738610bfcdf1c0772da33e596c6..98bc3d426b30be4c3c553b4d4b70cdc032b5b698 100644
--- a/configure.in
+++ b/configure.in
@@ -137,7 +137,7 @@ AC_CHECK_HEADERS(unistd.h string.h signal.h netdb.h ctype.h poll.h sys/stat.h sy
 
 dnl These headers are not essential
 
-AC_CHECK_HEADERS(stdint.h sys/types.h inttypes.h sys/wait.h sys/limits.h netinet/in.h arpa/inet.h)
+AC_CHECK_HEADERS(stdint.h sys/types.h inttypes.h sys/wait.h sys/limits.h netinet/in.h arpa/inet.h machine/limits.h)
 
 AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime)
 AC_REPLACE_FUNCS(strlcat strlcpy)
diff --git a/src/common/util.c b/src/common/util.c
index 3374b951e79cf867942028a042db8ea9d84cf65e..fb92681e93acfdae9b09feb90c6a21db125a8b8d 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -30,6 +30,9 @@
 #ifdef HAVE_SYS_LIMITS_H
 #include <sys/limits.h>
 #endif
+#ifdef HAVE_MACHINE_LIMITS_H
+#include <machine/limits.h>
+#endif
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h> /* Must be included before sys/stat.h for Ultrix */
 #endif
diff --git a/src/or/or.h b/src/or/or.h
index f3f28f4dae5b34788a62fb9a65795766cdf48a24..10b8b6343741e6f8c576a8ccc0431228cda94f12 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -37,6 +37,9 @@
 #ifdef HAVE_SYS_LIMITS_H
 #include <sys/limits.h>
 #endif
+#ifdef HAVE_MACHINE_LIMITS_H
+#include <machine/limits.h>
+#endif
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h> /* Must be included before sys/stat.h for Ultrix */
 #endif