Index: src/Makefile.shlib
--- src/Makefile.shlib.orig	2010-07-06 05:55:33.000000000 +0200
+++ src/Makefile.shlib	2010-09-21 08:58:56.000000000 +0200
@@ -329,7 +329,7 @@
 
 .PHONY: all-lib all-static-lib all-shared-lib
 
-all-lib: all-shared-lib
+all-lib:
 ifdef soname
 # no static library when building a dynamically loadable module
 all-lib: all-static-lib
Index: src/backend/Makefile
--- src/backend/Makefile.orig	2010-07-05 20:54:37.000000000 +0200
+++ src/backend/Makefile	2010-09-21 08:58:56.000000000 +0200
@@ -41,7 +41,7 @@
 LIBS := $(filter-out -lpgport, $(LIBS)) $(LDAP_LIBS_BE)
 
 # The backend doesn't need everything that's in LIBS, however
-LIBS := $(filter-out -lz -lreadline -ledit -ltermcap -lncurses -lcurses, $(LIBS))
+LIBS := $(filter-out -lreadline -ledit -ltermcap -lncurses -lcurses, $(LIBS))
 
 ##########################################################################
 
Index: src/include/port.h
--- src/include/port.h.orig	2010-05-15 16:44:13.000000000 +0200
+++ src/include/port.h	2010-09-21 08:58:56.000000000 +0200
@@ -374,7 +374,7 @@
 extern int	getopt(int nargc, char *const * nargv, const char *ostr);
 #endif
 
-#ifndef HAVE_ISINF
+#if !defined(HAVE_ISINF) && !defined(__FreeBSD__)
 extern int	isinf(double x);
 #endif
 
Index: src/makefiles/Makefile.freebsd
--- src/makefiles/Makefile.freebsd.orig	2010-07-05 20:54:38.000000000 +0200
+++ src/makefiles/Makefile.freebsd	2010-09-21 09:00:42.000000000 +0200
@@ -17,7 +17,7 @@
 # Rule for building a shared library from a single .o file
 %.so: %.o
 ifdef ELF_SYSTEM
-	$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ $<
+	$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ $< $(SHLIB_LINK)
 else
 	$(LD) $(LDREL) $(LDOUT) $<.obj -x $<
 	@echo building shared object $@
Index: src/makefiles/Makefile.linux
--- src/makefiles/Makefile.linux.orig	2010-07-05 20:54:38.000000000 +0200
+++ src/makefiles/Makefile.linux	2010-09-21 09:01:01.000000000 +0200
@@ -14,4 +14,4 @@
 
 # Rule for building a shared library from a single .o file
 %.so: %.o
-	$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ $<
+	$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ $< $(SHLIB_LINK)
Index: src/makefiles/Makefile.solaris
--- src/makefiles/Makefile.solaris.orig	2010-07-05 20:54:38.000000000 +0200
+++ src/makefiles/Makefile.solaris	2010-09-21 09:01:22.000000000 +0200
@@ -19,9 +19,9 @@
 # Rule for building a shared library from a single .o file
 %.so: %.o
 ifeq ($(GCC), yes)
-	$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ $<
+	$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ $< $(SHLIB_LINK)
 else
-	$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -G -o $@ $<
+	$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -G -o $@ $< $(SHLIB_LINK)
 endif
 
 sqlmansect = 5sql
Index: contrib/pgxc_monitor/pgxc_monitor.c
--- contrib/pgxc_monitor/pgxc_monitor.c.orig	2016-05-12 10:20:42.000000000 +0200
+++ contrib/pgxc_monitor/pgxc_monitor.c	2016-06-26 16:21:09.026341300 +0200
@@ -49,6 +49,8 @@
 
 #include <stdlib.h>
 #include <getopt.h>
+#include <sys/types.h>
+#include <sys/wait.h>
 
 /* Define all the node types */
 typedef enum
