$NetBSD: patch-configure,v 1.6 2021/10/29 06:02:26 taca Exp $

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

--- configure.orig	2021-10-11 19:35:49.000000000 +0000
+++ configure
@@ -16004,6 +16004,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 ;;
@@ -18667,27 +18669,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"
@@ -24439,7 +24424,7 @@ else
 
 fi
 	        ;; #(
-  *-freebsd*|*-openbsd*|*-netbsd*) :
+  *-dragonfly*|*-freebsd*|*-openbsd*|*-netbsd*) :
 
 		 LDFLAGS="${LDFLAGS} -Wl,-E"
 		 SO_CFLAGS="-fpic"
@@ -24471,9 +24456,9 @@ fi
 	        ;; #(
   *-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}"
 	        ;; #(
   ia64-hp-hpux*) :
 
@@ -24733,8 +24718,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
 
 
