diff -Nuar memcached-1.4.4.orig/configure.ac memcached-1.4.4/configure.ac
--- memcached-1.4.4.orig/configure.ac	2009-11-24 16:40:29.000000000 -0800
+++ memcached-1.4.4/configure.ac	2009-11-27 15:20:38.000000000 -0800
@@ -115,6 +115,14 @@
 AC_SUBST(ENABLE_SASL)
 AC_SUBST(PROFILER_LDFLAGS)
 
+dnl Check whether the user's system supports pthread before adding -pthread to CFLAGS
+dnl otherwise we won't get -l{threads} in LIBS
+dnl AFAIK -pthread should be added to LDFLAGS on BSD systems
+AC_SEARCH_LIBS(pthread_create, [pthread pthreads thread threads] )
+if test "x$ac_cv_search_pthread_create" == "xno"; then
+  AC_MSG_ERROR([Can't enable threads without the POSIX thread library.])
+fi
+
 AC_ARG_ENABLE(coverage,
   [AS_HELP_STRING([--disable-coverage],[Disable code coverage])])
 
@@ -376,12 +384,6 @@
 
 AC_C_HTONLL
 
-dnl Check whether the user's system supports pthread
-AC_SEARCH_LIBS(pthread_create, pthread)
-if test "x$ac_cv_search_pthread_create" = "xno"; then
-  AC_MSG_ERROR([Can't enable threads without the POSIX thread library.])
-fi
-
 AC_CHECK_FUNCS(mlockall)
 AC_CHECK_FUNCS(getpagesizes)
 AC_CHECK_FUNCS(memcntl)
