diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index c2a2572..4a5cc7c 100644
*** a/src/backend/utils/fmgr/dfmgr.c
--- b/src/backend/utils/fmgr/dfmgr.c
***************
*** 18,24 ****
--- 18,34 ----
  
  #ifdef HAVE_DLOPEN
  #include <dlfcn.h>
+ 
+ /*
+  * On macOS, <dlfcn.h> insists on including <stdbool.h>.  If we're not
+  * using stdbool, undef bool to undo the damage.
+  */
+ #ifndef USE_STDBOOL
+ #ifdef bool
+ #undef bool
  #endif
+ #endif
+ #endif							/* HAVE_DLOPEN */
  
  #include "fmgr.h"
  #include "lib/stringinfo.h"
