qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/3] build: check if libm is needed in configure


From: Roger Pau Monne
Subject: [Qemu-devel] [PATCH 3/3] build: check if libm is needed in configure
Date: Mon, 12 Mar 2012 15:34:58 -0000

Remove the hardcoded use of libm and instead rely on configure to
check for it. It is needed at least for qemu-ga and qemu-system.

Signed-off-by: Roger Pau Monne <address@hidden>
---
 Makefile.target |    4 ----
 configure       |   14 ++++++++++++++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index 68a5641..c230aff 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -42,10 +42,6 @@ PROGS+=$(QEMU_PROGW)
 endif
 STPFILES=
 
-ifndef CONFIG_HAIKU
-LIBS+=-lm
-endif
-
 config-target.h: config-target.h-timestamp
 config-target.h-timestamp: config-target.mak
 
diff --git a/configure b/configure
index 790d495..b0cb175 100755
--- a/configure
+++ b/configure
@@ -2524,6 +2524,20 @@ elif compile_prog "" "-lrt" ; then
   libs_qga="-lrt $libs_qga"
 fi
 
+##########################################
+# Do we need libm
+cat > $TMPC <<EOF
+#include <math.h>
+int main(void) { double a, b; return modf(a, &b);}
+EOF
+
+if compile_prog "" "" ; then
+  :
+elif compile_prog "" "-lm" ; then
+  LIBS="-lm $LIBS"
+  libs_qga="-lm $libs_qga"
+fi
+
 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
         "$aix" != "yes" -a "$haiku" != "yes" ; then
     libs_softmmu="-lutil $libs_softmmu"
-- 
1.7.9




reply via email to

[Prev in Thread] Current Thread [Next in Thread]