diff --git a/configure b/configure
index f2d30666192f88ee67c9854a5469d75e6da4fea7..dc5b2f36c0f4b5fa34fc2f88a0fd9b029138b3af 100755
--- a/configure
+++ b/configure
@@ -1217,8 +1217,6 @@ esac
 
 add_extralibs $osextralibs
 
-check_ldflags -lm
-
 if ! disabled logging ; then
     enabled logging || logfile="$logging"
     echo "# $0 $@" >$logfile
@@ -1547,6 +1545,8 @@ for thread in $THREADS_LIST; do
     fi
 done
 
+check_lib math.h sin -lm
+
 # test for lrintf in math.h
 check_exec <<EOF && enable lrintf || disable lrintf
 #define _ISOC9X_SOURCE  1