--- configure
+++ configure
@@ -15535,6 +15535,7 @@
 
 
 if test "$have_win" != "yes";then
+if test "${with_libpthread_prefix}" != "no"; then
   for ac_func in pthread_mutex_lock
 do :
   ac_fn_c_check_func "$LINENO" "pthread_mutex_lock" "ac_cv_func_pthread_mutex_lock"
@@ -15545,6 +15546,7 @@
 
 fi
 done
+fi
 
   if test "$ac_cv_func_pthread_mutex_lock" != "yes";then
 
@@ -15613,7 +15615,11 @@
   rpathdirs=
   ltrpathdirs=
   names_already_handled=
-  names_next_round='pthread '
+  if test "${with_libpthread_prefix}" != "no"; then
+    names_next_round='pthread '
+  else
+    names_next_round=''
+  fi
   while test -n "$names_next_round"; do
     names_this_round="$names_next_round"
     names_next_round=
