$NetBSD: patch-configure,v 1.2 2018/10/24 11:27:28 jperkin Exp $

* Add DragonFly support.
* Use proper link options for NetBSD.
* Link proper postgresql library.

--- configure.orig	2018-10-06 01:36:17.000000000 +0000
+++ configure
@@ -15415,6 +15415,8 @@ case $host in
 	use_threads=false ;;
 *-freebsd*)
 	use_threads=true ;;
+*-dragonfly*)
+	use_threads=false ;;
 *-bsdi[234]*)
 	# Thread signals do not work reliably on some versions of BSD/OS.
 	use_threads=false ;;
@@ -17962,27 +17964,10 @@ case "$use_libjson" in
 		libjson_libs=""
 		;;
 	auto|yes)
-		for d in /usr /usr/local /opt/local
-		do
-			if test -f "${d}/include/json/json.h"
-			then
-				if test ${d} != /usr
-				then
-					libjson_cflags="-I ${d}/include"
-					LIBS="$LIBS -L${d}/lib"
-				fi
-				have_libjson="yes"
-			elif test -f "${d}/include/json-c/json.h"
-			then
-				if test ${d} != /usr
-				then
-					libjson_cflags="-I ${d}/include"
-					LIBS="$LIBS -L${d}/lib"
-				fi
-				have_libjson="yes"
-				have_libjson_c="yes"
-			fi
-		done
+		libjson_cflags="`pkg-config --cflags json-c`"
+		LIBS="`pkg-config --libs json-c`"
+		have_libjson="yes"
+		have_libjson_c="yes"
 		;;
 	*)
 		if test -f "${use_libjson}/include/json/json.h"
@@ -23436,7 +23421,7 @@ if test "yes" = "$dlopen"; then
 				SO_LD="ld"
 			fi
 			;;
-		*-freebsd*|*-openbsd*)
+		*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
 			LDFLAGS="${LDFLAGS} -Wl,-E"
 			SO_CFLAGS="-fpic"
 			if test "yes" = "$use_libtool"; then
@@ -23447,16 +23432,10 @@ if test "yes" = "$dlopen"; then
 				SO_LD="${CC}"
 			fi
 			;;
-		*-netbsd*)
-			SO_CFLAGS="-fpic"
-			SO_LDFLAGS="-Bshareable -x"
-			SO_LD="ld"
-			SO_STRIP="sed -e s/-Wl,//g"
-			;;
 		*-solaris*)
-			SO_CFLAGS="-KPIC"
-			SO_LDFLAGS="-G -z text"
-			SO_LD="ld"
+			SO_CFLAGS="-fPIC"
+			SO_LDFLAGS="-Xcompiler -shared -Wl,-z -Wl,text"
+			SO_LD="${CC}"
 			;;
 		*-hp-hpux*)
 			SO=sl
@@ -23705,8 +23684,8 @@ $as_echo "no" >&6; }
 	fi
 	if test -n "-L$use_dlz_postgres_lib -lpq"
 	then
-		DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS -L$use_dlz_postgres_lib -lpq"
-		DLZ_DRIVER_POSTGRES_LIBS="-L$use_dlz_postgres_lib -lpq"
+		DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS -L${PREFIX}/lib -lpq"
+		DLZ_DRIVER_POSTGRES_LIBS="-L${PREFIX}/lib -lpq"
 	fi
 
 
