diff --git a/SOURCES/libmemcached-fix-linking-with-libpthread.patch b/SOURCES/libmemcached-fix-linking-with-libpthread.patch
new file mode 100644
index 0000000..e5e21c4
--- /dev/null
+++ b/SOURCES/libmemcached-fix-linking-with-libpthread.patch
@@ -0,0 +1,19 @@
+diff -up libmemcached-1.0.16/build-aux/ltmain.sh.orig libmemcached-1.0.16/build-aux/ltmain.sh
+--- libmemcached-1.0.16/build-aux/ltmain.sh.orig	2013-12-03 16:36:53.222107642 +0100
++++ libmemcached-1.0.16/build-aux/ltmain.sh	2013-12-03 16:37:35.770132249 +0100
+@@ -5664,6 +5664,15 @@ func_mode_link ()
+ 	    *" $arg "*) ;;
+ 	    * ) func_append new_inherited_linker_flags " $arg" ;;
+ 	esac
++	# As we are forced to pass -nostdlib to g++ during linking, the option
++	# -pthread{,s} is not in effect;  add the -lpthread to $deplist
++	# explicitly to link correctly.
++	if test "$tagname" = CXX -a x"$with_gcc" = xyes; then
++	  case "$arg" in
++	    -pthread*) func_append deplibs " -lpthread" ;;
++	  esac
++	fi
++
+ 	continue
+ 	;;
+ 
diff --git a/SPECS/libmemcached.spec b/SPECS/libmemcached.spec
index abbae0b..804d43d 100644
--- a/SPECS/libmemcached.spec
+++ b/SPECS/libmemcached.spec
@@ -5,7 +5,7 @@
 Name:      libmemcached
 Summary:   Client library and command line tools for memcached server
 Version:   1.0.16
-Release:   3%{?dist}
+Release:   5%{?dist}
 License:   BSD
 Group:     System Environment/Libraries
 URL:       http://libmemcached.org/
@@ -30,6 +30,7 @@ BuildRequires: systemtap-sdt-devel
 %endif
 BuildRequires: libevent-devel
 
+Patch0: libmemcached-fix-linking-with-libpthread.patch
 
 %description
 libmemcached is a C/C++ client library and tools for the memcached server
@@ -71,10 +72,13 @@ you will need to install %{name}-devel.
 
 %prep
 %setup -q
+%patch0 -p1 -b .pthread
 
 mkdir examples
 cp -p tests/*.{cc,h} examples/
 
+# Don't test memaslap: https://bugs.launchpad.net/libmemcached/+bug/1115357
+sed -i '/^TESTS = /s|\($(bin_PROGRAMS)\)|$(filter-out clients/memaslap,\1)|' Makefile.in
 
 %build
 # option --with-memcached=false to disable server binary check (as we don't run test)
@@ -118,15 +122,7 @@ fi
 
 %check
 %if %{runselftest}
-make test 2>&1 | tee rpmtests.log
-# Ignore test result for memaslap (XFAIL but PASS)
-# https://bugs.launchpad.net/libmemcached/+bug/1115357
-if grep "XPASS: clients/memaslap" rpmtests.log && grep "1 of 21" rpmtests.log
-then
-  exit 0
-else
-  exit 1
-fi
+make test
 %endif
 
 
@@ -174,6 +170,13 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Thu Jul 02 2015 Miroslav Lichvar <mlichvar@redhat.com> - 1.0.16-5
+- don't test memaslap in make check (#1231828)
+- rebuild with fixed binutils (#1238466)
+
+* Wed Apr 22 2015 Miroslav Lichvar <mlichvar@redhat.com> - 1.0.16-4
+- fix linking with libpthread (#1116949)
+
 * Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 1.0.16-3
 - Mass rebuild 2014-01-24