configure.ac: fix libm checks (Trac #3730)
configure.ac: fix libm checks (Trac #3730)

libbfd pulled libm as dependency and broke LIBM= detection.

Patch moves libm in library tests as early as possible.
Thanks to asuffield for suggesting such a simple fix.
Thanks to Roie Kerstein and Renato Gallo for finding
and tracking down the issue.

mfine/ghc,frantisekfarka/ghc-dsi,siddhanathan/ghc,green-haskell/ghc,tjakway/ghcjvm,mcmaniac/ghc,forked-upstream-packages-for-ghcjs/ghc,mfine/ghc,tibbe/ghc,nushio3/ghc,wxwxwwxxx/ghc,vTurbine/ghc,ghc-android/ghc,snoyberg/ghc,vikraman/ghc,nomeata/ghc,snoyberg/ghc,ilyasergey/GHC-XAppFix,sgillespie/ghc,siddhanathan/ghc,mcmaniac/ghc,nushio3/ghc,ezyang/ghc,ekmett/ghc,acowley/ghc,GaloisInc/halvm-ghc,frantisekfarka/ghc-dsi,forked-upstream-packages-for-ghcjs/ghc,green-haskell/ghc,nushio3/ghc,vTurbine/ghc,nathyong/microghc-ghc,sgillespie/ghc,mcschroeder/ghc,holzensp/ghc,elieux/ghc,elieux/ghc,ezyang/ghc,tibbe/ghc,ml9951/ghc,TomMD/ghc,mfine/ghc,nushio3/ghc,christiaanb/ghc,ilyasergey/GHC-XAppFix,gridaphobe/ghc,TomMD/ghc,vTurbine/ghc,siddhanathan/ghc,GaloisInc/halvm-ghc,jstolarek/ghc,jstolarek/ghc,mcschroeder/ghc,christiaanb/ghc,mcmaniac/ghc,olsner/ghc,christiaanb/ghc,gcampax/ghc,nkaretnikov/ghc,ghc-android/ghc,acowley/ghc,wxwxwwxxx/ghc,nkaretnikov/ghc,jstolarek/ghc,nomeata/ghc,sdiehl/ghc,nomeata/ghc,gcampax/ghc,gcampax/ghc,ezyang/ghc,siddhanathan/ghc,mettekou/ghc,elieux/ghc,sdiehl/ghc,mfine/ghc,tibbe/ghc,TomMD/ghc,vikraman/ghc,sdiehl/ghc,olsner/ghc,ryantm/ghc,snoyberg/ghc,hferreiro/replay,da-x/ghc,lukexi/ghc,TomMD/ghc,lukexi/ghc,mcschroeder/ghc,ml9951/ghc,forked-upstream-packages-for-ghcjs/ghc,bitemyapp/ghc,TomMD/ghc,TomMD/ghc,shlevy/ghc,tibbe/ghc,green-haskell/ghc,oldmanmike/ghc,vTurbine/ghc,tjakway/ghcjvm,siddhanathan/ghc,forked-upstream-packages-for-ghcjs/ghc,sgillespie/ghc,snoyberg/ghc,holzensp/ghc,sdiehl/ghc,spacekitteh/smcghc,AlexanderPankiv/ghc,sdiehl/ghc,vikraman/ghc,christiaanb/ghc,green-haskell/ghc,fmthoma/ghc,shlevy/ghc,mfine/ghc,tjakway/ghcjvm,mcmaniac/ghc,nushio3/ghc,mettekou/ghc,holzensp/ghc,GaloisInc/halvm-ghc,AlexanderPankiv/ghc,urbanslug/ghc,vikraman/ghc,ekmett/ghc,tjakway/ghcjvm,holzensp/ghc,ghc-android/ghc,AlexanderPankiv/ghc,anton-dessiatov/ghc,ezyang/ghc,jstolarek/ghc,da-x/ghc,ryantm/ghc,fmthoma/ghc,nkaretnikov/ghc,ekmett/ghc,gcampax/ghc,anton-dessiatov/ghc,anton-dessiatov/ghc,acowley/ghc,fmthoma/ghc,lukexi/ghc,nkaretnikov/ghc,ghc-android/ghc,nomeata/ghc,spacekitteh/smcghc,AlexanderPankiv/ghc,hferreiro/replay,ekmett/ghc,elieux/ghc,nathyong/microghc-ghc,snoyberg/ghc,da-x/ghc,acowley/ghc,olsner/ghc,gridaphobe/ghc,forked-upstream-packages-for-ghcjs/ghc,sgillespie/ghc,urbanslug/ghc,gridaphobe/ghc,oldmanmike/ghc,wxwxwwxxx/ghc,nathyong/microghc-ghc,ekmett/ghc,vikraman/ghc,ml9951/ghc,lukexi/ghc-7.8-arm64,wxwxwwxxx/ghc,tjakway/ghcjvm,olsner/ghc,vTurbine/ghc,nathyong/microghc-ghc,fmthoma/ghc,ryantm/ghc,lukexi/ghc,siddhanathan/ghc,oldmanmike/ghc,mcschroeder/ghc,ghc-android/ghc,GaloisInc/halvm-ghc,sgillespie/ghc,urbanslug/ghc,da-x/ghc,tibbe/ghc,spacekitteh/smcghc,shlevy/ghc,ml9951/ghc,olsner/ghc,snoyberg/ghc,gridaphobe/ghc,nathyong/microghc-ghc,mettekou/ghc,oldmanmike/ghc,anton-dessiatov/ghc,frantisekfarka/ghc-dsi,acowley/ghc,gcampax/ghc,vTurbine/ghc,hferreiro/replay,ryantm/ghc,tjakway/ghcjvm,lukexi/ghc-7.8-arm64,ml9951/ghc,mfine/ghc,christiaanb/ghc,gridaphobe/ghc,lukexi/ghc,bitemyapp/ghc,ezyang/ghc,AlexanderPankiv/ghc,ilyasergey/GHC-XAppFix,gridaphobe/ghc,urbanslug/ghc,nkaretnikov/ghc,hferreiro/replay,vikraman/ghc,christiaanb/ghc,anton-dessiatov/ghc,hferreiro/replay,bitemyapp/ghc,ml9951/ghc,sgillespie/ghc,fmthoma/ghc,nomeata/ghc,lukexi/ghc-7.8-arm64,mcmaniac/ghc,mcschroeder/ghc,lukexi/ghc-7.8-arm64,vTurbine/ghc,GaloisInc/halvm-ghc,nathyong/microghc-ghc,shlevy/ghc,holzensp/ghc,da-x/ghc,elieux/ghc,fmthoma/ghc,mcschroeder/ghc,mettekou/ghc,ghc-android/ghc,fmthoma/ghc,hferreiro/replay,elieux/ghc,GaloisInc/halvm-ghc,gcampax/ghc,da-x/ghc,siddhanathan/ghc,urbanslug/ghc,tjakway/ghcjvm,snoyberg/ghc,acowley/ghc,nushio3/ghc,AlexanderPankiv/ghc,acowley/ghc,ezyang/ghc,nushio3/ghc,lukexi/ghc-7.8-arm64,bitemyapp/ghc,GaloisInc/halvm-ghc,wxwxwwxxx/ghc,nkaretnikov/ghc,oldmanmike/ghc,christiaanb/ghc,frantisekfarka/ghc-dsi,shlevy/ghc,gcampax/ghc,wxwxwwxxx/ghc,green-haskell/ghc,anton-dessiatov/ghc,jstolarek/ghc,mfine/ghc,anton-dessiatov/ghc,ml9951/ghc,forked-upstream-packages-for-ghcjs/ghc,AlexanderPankiv/ghc,mettekou/ghc,frantisekfarka/ghc-dsi,ryantm/ghc,ghc-android/ghc,urbanslug/ghc,mcschroeder/ghc,sdiehl/ghc,ml9951/ghc,vikraman/ghc,elieux/ghc,gridaphobe/ghc,mettekou/ghc,spacekitteh/smcghc,nkaretnikov/ghc,sgillespie/ghc,nathyong/microghc-ghc,olsner/ghc,forked-upstream-packages-for-ghcjs/ghc,sdiehl/ghc,oldmanmike/ghc,urbanslug/ghc,ezyang/ghc,shlevy/ghc,olsner/ghc,wxwxwwxxx/ghc,TomMD/ghc,oldmanmike/ghc,bitemyapp/ghc,hferreiro/replay,shlevy/ghc,ilyasergey/GHC-XAppFix,spacekitteh/smcghc,da-x/ghc,mettekou/ghc