$NetBSD: patch-configure,v 1.2 2019/06/20 02:16:53 taca Exp $

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

--- configure.orig	2019-06-04 15:20:04.000000000 +0000
+++ configure
@@ -725,6 +725,9 @@ purify_path
 MKDEPPROG
 MKDEPCFLAGS
 MKDEPCC
+BLACKLIST
+BLACKLISTLINKOBJS
+BLACKLISTLINKSRCS
 ZLIB_LIBS
 ZLIB_CFLAGS
 JSON_C_LIBS
@@ -1712,6 +1715,7 @@ Optional Packages:
   --with-dlz-stub=ARG     Build with stub DLZ driver [yes|no]. (Required to
                           use stub driver with DLZ)
   --with-make-clean       run "make clean" at end of configure [yes|no]
+  --with-blacklist	  Build with blacklist
 
 Some influential environment variables:
   CC          C compiler command
@@ -3908,7 +3912,7 @@ fi
 
 # On IRIX 5.3, sys/types and inttypes.h are conflicting.
 for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-		  inttypes.h stdint.h unistd.h
+		  inttypes.h stdint.h unistd.h blacklist.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
@@ -18141,6 +18145,139 @@ fi ;; #(
 esac
 
 
+#
+# was --with-blacklist specified?
+#
+BLACKLISTLINKOBJS=
+BLACKLISTLINKSRCS=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for blacklist library" >&5
+$as_echo_n "checking for blacklist library... " >&6; }
+
+# Check whether --with-blacklist was given.
+if test "${with_blacklist+set}" = set; then :
+  withval=$with_blacklist; with_blacklist="$withval"
+else
+  with_blacklist="auto"
+fi
+
+
+have_blacklist=""
+case "$with_blacklist" in
+       no)
+               blacklist_libs=""
+               ;;
+       auto|yes)
+               for d in /usr /usr/local /opt/local
+               do
+                       if test -f "${d}/include/blacklist.h"
+                       then
+                               if test ${d} != /usr
+                               then
+                                       blacklist_cflags="-I ${d}/include"
+                                       LIBS="$LIBS -L${d}/lib"
+                               fi
+                               have_blacklist="yes"
+                       fi
+               done
+               ;;
+       *)
+               if test -f "${with_blacklist}/include/blacklist.h"
+               then
+                       blacklist_cflags="-I${with_blacklist}/include"
+                       LIBS="$LIBS -L${with_blacklist}/lib"
+                       have_blacklist="yes"
+               else
+                       as_fn_error $? "$with_blacklist/include/blacklist.h not found." "$LINENO" 5
+               fi
+               ;;
+esac
+
+if test "X${have_blacklist}" != "X"
+then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing blacklist" >&5
+$as_echo_n "checking for library containing blacklist... " >&6; }
+if ${ac_cv_search_blacklist+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char blacklist_open(void);
+int
+main ()
+{
+return blacklist_open();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' blacklist; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_blacklist=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_blacklist+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_blacklist+:} false; then :
+
+else
+  ac_cv_search_blacklist=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_blacklist" >&5
+$as_echo "$ac_cv_search_blacklist" >&6; }
+ac_res=$ac_cv_search_blacklist
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+else
+  as_fn_error $? "found blacklist include but not library." "$LINENO" 5
+                       have_blacklist=""
+fi
+
+elif test "X$with_blacklist" = Xyes
+then
+       as_fn_error $? "include/blacklist.h not found." "$LINENO" 5
+else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+BLACKLIST=
+if test "X${have_blacklist}" != "X"
+then
+       CFLAGS="$CFLAGS $blacklist_cflags"
+
+$as_echo "#define HAVE_BLACKLIST 1" >>confdefs.h
+
+       BLACKLIST=1
+fi
+if  test "X${blacklist_libs}" != "X"
+then
+       BLACKLISTLINKSRCS='${BLACKLISTLINKSRCS}'
+       BLACKLISTLINKOBJS='${BLACKLISTLINKOBJS}'
+fi
 
 
 
@@ -22407,7 +22544,7 @@ else
 
 fi
 	        ;; #(
-  *-freebsd*|*-openbsd*|*-netbsd*) :
+  *-dragonfly*|*-freebsd*|*-openbsd*|*-netbsd*) :
 
 		 LDFLAGS="${LDFLAGS} -Wl,-E"
 		 SO_CFLAGS="-fpic"
@@ -22439,9 +22576,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*) :
 
@@ -22870,8 +23007,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
 
 
@@ -26070,6 +26207,7 @@ report() {
 	test "X$PYTHON" = "X" || echo "    Python tools (--with-python)"
 	test "X$LIBXML2_LIBS" = "X" || echo "    XML statistics (--with-libxml2)"
 	test "X$JSON_C_LIBS" = "X" || echo "    JSON statistics (--with-json-c): $JSON_C_CFLAGS $JSON_C_LIBS"
+	test "X$BLACKLIST" = "X" || echo "    blacklist support (--with-blacklist)"
 	test "X$ZLIB_LIBS" = "X" || echo "    HTTP zlib compression (--with-zlib)"
 	test "X$NZD_TOOLS" = "X" || echo "    LMDB database to store configuration for 'addzone' zones (--with-lmdb)"
 	test "no" = "$with_libidn2" || echo "    IDN support (--with-libidn2)"
@@ -26148,6 +26286,7 @@ report() {
     test "X$PYTHON" = "X" && echo "    Python tools (--with-python)"
     test "X$LIBXML2_LIBS" = "X" && echo "    XML statistics (--with-libxml2)"
     test "X$JSON_C_LIBS" = "X" && echo "    JSON statistics (--with-json-c)"
+    test "X$BLACKLIST" = "X" && echo "    blacklist support (--with-blacklist)"
     test "X$ZLIB_LIBS" = "X" && echo "    HTTP zlib compression (--with-zlib)"
     test "X$NZD_TOOLS" = "X" && echo "    LMDB database to store configuration for 'addzone' zones (--with-lmdb)"
     test "no" = "$with_libidn2" && echo "    IDN support (--with-libidn2)"
