diff --git a/src/configure.in b/src/configure.in
index 673034aba4aee152726e554be115e59482ebc66a..57e75c1790579c9f2352ea755ff1ad69c6fbeaa0 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -594,7 +594,12 @@ if test "x$pike_cv_sys_os" = xWindows_NT; then
   PIKE_FUNCS_NEED_DECLS(yes)
 fi
 
-AC_CHECK_HEADERS(stdlib.h string.h unistd.h sys/stat.h sys/types.h sys/errno.h)
+# NB: We need to have gmp.h in the search path for the entirety of Pike,
+#     since gmp.h is included by bignum.h, which in turn is included
+#     by much of Pike.
+PIKE_PKG_CONFIG(libgmp)
+
+AC_CHECK_HEADERS(gmp.h stdlib.h string.h unistd.h sys/stat.h sys/types.h sys/errno.h)
 
 if test "$GCC" = "yes"; then :; else
 #