--- configure.orig	2016-04-22 16:19:50 UTC
+++ configure
@@ -18716,9 +18716,9 @@ then
     as_fn_error $? "Please install zlib and zlib-devel packages" "$LINENO" 5
 else
 
-    vuln=`grep "ZLIB_VERSION \"1.2.0" $ZLIB_HOME/include/zlib.h`
+    vuln=`grep "ZLIB_VERSION \"1.2.0\"" $ZLIB_HOME/include/zlib.h`
     if test -z "$vuln"; then
-	vuln=`grep "ZLIB_VERSION \"1.2.1" $ZLIB_HOME/include/zlib.h`
+	vuln=`grep "ZLIB_VERSION \"1.2.1\"" $ZLIB_HOME/include/zlib.h`
     fi
 
     if test -n "$vuln"; then
@@ -20758,7 +20758,7 @@ $as_echo "#define C_BSD 1" >>confdefs.h
     ;;
 freebsd*)
     if test "$have_pthreads" = "yes"; then
-	THREAD_LIBS="-lthr"
+	THREAD_LIBS="%%PTHREAD_LIBS%%"
 	TH_SAFE="-thread-safe"
     fi
 
@@ -20934,7 +20934,7 @@ esac
 if test "$have_milter" = "yes"; then
 
         save_LIBS="$LIBS"
-    CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
+    CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS $THREAD_LIBS"
     if test -d /usr/lib/libmilter ; then
 	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -L/usr/lib/libmilter"
     fi
