configure: Use correct libm linker flag during math function checks