diff --git a/dist/Makefile.in b/dist/Makefile.in
index c4b0739..d3860b4 100644
--- a/dist/Makefile.in
+++ b/dist/Makefile.in
@@ -11,7 +11,7 @@ exec_prefix=@exec_prefix@
 bindir=	@bindir@
 includedir=@includedir@
 libdir=	@libdir@
-docdir=	$(prefix)/docs
+docdir=	@docdir@
 
 dmode=	755
 emode=	555
diff --git a/dist/configure b/dist/configure
index 295fec1..e05e451 100755
--- a/dist/configure
+++ b/dist/configure
@@ -4533,6 +4533,8 @@ irix*)	optimize_debug="-O2"
 	CPPFLAGS="$CPPFLAGS -D_SGI_MP_SOURCE";;
 mpeix*)	CPPFLAGS="$CPPFLAGS -D_POSIX_SOURCE -D_SOCKET_SOURCE"
 	LIBSO_LIBS="$LIBSO_LIBS -lsocket -lsvipc";;
+haiku*)
+	LIBSO_LIBS="$LIBSO_LIBS -lnetwork";;
 osf*)	CPPFLAGS="$CPPFLAGS -pthread";;
 *qnx*)	qnx_build="yes"
 	$as_echo "#define HAVE_QNX 1" >>confdefs.h
diff --git a/dist/configure.ac b/dist/configure.ac
index 4a99779..85dfb93 100644
--- a/dist/configure.ac
+++ b/dist/configure.ac
@@ -184,6 +184,8 @@ irix*)	optimize_debug="-O2"
 	CPPFLAGS="$CPPFLAGS -D_SGI_MP_SOURCE";;
 mpeix*)	CPPFLAGS="$CPPFLAGS -D_POSIX_SOURCE -D_SOCKET_SOURCE"
 	LIBSO_LIBS="$LIBSO_LIBS -lsocket -lsvipc";;
+haiku*)
+	LIBSO_LIBS="$LIBSO_LIBS -lnetwork";;
 osf*)	CPPFLAGS="$CPPFLAGS -pthread";;
 *qnx*)	qnx_build="yes"
 	AC_DEFINE(HAVE_QNX)
@@ -519,6 +521,9 @@ AC_SEARCH_LIBS(sched_yield, rt)
 # The Berkeley DB library calls fdatasync, only available in -lrt on Solaris.
 AC_SEARCH_LIBS(fdatasync, rt)
 
+# Socket only available in -lnetwork on Haiku
+AC_SEARCH_LIBS(socket, network)
+
 AC_SEARCH_LIBS(getaddrinfo, nsl socket)
 AC_SEARCH_LIBS(hstrerror, resolv)
 
diff --git a/repmgr/repmgr_posix.c b/repmgr/repmgr_posix.c
index 741f378..6892469 100644
--- a/repmgr/repmgr_posix.c
+++ b/repmgr/repmgr_posix.c
@@ -488,11 +488,7 @@ __repmgr_wake_main_thread(env)
  * PUBLIC: int __repmgr_writev __P((socket_t, db_iovec_t *, int, size_t *));
  */
 int
-__repmgr_writev(fd, iovec, buf_count, byte_count_p)
-	socket_t fd;
-	db_iovec_t *iovec;
-	int buf_count;
-	size_t *byte_count_p;
+__repmgr_writev(socket_t fd, db_iovec_t *iovec, int buf_count, size_t *byte_count_p)
 {
 	int nw;
 
@@ -506,11 +502,7 @@ __repmgr_writev(fd, iovec, buf_count, byte_count_p)
  * PUBLIC: int __repmgr_readv __P((socket_t, db_iovec_t *, int, size_t *));
  */
 int
-__repmgr_readv(fd, iovec, buf_count, byte_count_p)
-	socket_t fd;
-	db_iovec_t *iovec;
-	int buf_count;
-	size_t *byte_count_p;
+__repmgr_readv(socket_t fd, db_iovec_t *iovec, int buf_count, size_t *byte_count_p)
 {
 	ssize_t nw;
 
