aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorAlexey Kardashevskiy <aik@ozlabs.ru>2014-07-01 17:30:27 +1000
committerPaolo Bonzini <pbonzini@redhat.com>2014-07-01 10:36:28 +0200
commitf80ea9862fed7ca89a672785bdce0e2611f9ba97 (patch)
tree45a86142fb457318c12b712e4dcb3a19552577cb /configure
parent424baff549a9c8a7b5e814ce2bcb857d25163468 (diff)
configure: Fix -lm test, so that tools can be compiled on hosts that require -lm
The existing test whether "-lm" needs to be included or not is insufficient as it reports false negative on Fedora20/ppc64. This happens because sin(0.0) is a constant value which compiler can safely throw away and therefore there is no need to add "-lm". As the result, qemu-nbd/qemu-io/qemu-img tools cannot compile. This adds a global variable and uses it in the test to prevent from optimization. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> [Use Peter's improvement on the test to fool LTO, and remove the now useless -lm addition in Makefile.target. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure2
1 files changed, 1 insertions, 1 deletions
diff --git a/configure b/configure
index 23ecb37c43..ed41eda4d3 100755
--- a/configure
+++ b/configure
@@ -3453,7 +3453,7 @@ fi
# Do we need libm
cat > $TMPC << EOF
#include <math.h>
-int main(void) { return isnan(sin(0.0)); }
+int main(int argc, char **argv) { return isnan(sin((double)argc)); }
EOF
if compile_prog "" "" ; then
: