summaryrefslogtreecommitdiffstats
path: root/main/qemu/configure-libm.patch
blob: e57216e53aba67eecfa128cd6292937a0d5bf6f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
--- ./configure.orig
+++ ./configure
@@ -1287,6 +1287,25 @@
 fi
 
 ##########################################
+# libm check
+cat > $TMPC << EOF
+#include <math.h>
+int main(void) { return isnan(0.0); }
+EOF
+    if compile_prog "" "" ; then
+        LIBM=
+    elif compile_prog "" "-lm" ; then
+    	LIBM="-lm"
+    else
+        echo
+        echo "Error: libm check failed"
+        echo
+        exit 1
+    fi
+
+
+
+##########################################
 # zlib check
 
 if test "$zlib" != "no" ; then
--- ./configure.orig
+++ ./configure
@@ -3283,6 +3283,7 @@
 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak
 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
+echo "LIBM=$LIBM" >> $config_host_mak
 
 # generate list of library paths for linker script
 
--- ./Makefile.orig
+++ ./Makefile
@@ -170,7 +170,7 @@
 $(qapi-obj-y): $(GENERATED_HEADERS)
 qapi-dir := $(BUILD_DIR)/qapi-generated
 test-visitor.o test-qmp-commands.o qemu-ga$(EXESUF): QEMU_CFLAGS += -I $(qapi-dir)
-qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
+qemu-ga$(EXESUF): LIBS = $(LIBS_QGA) $(LIBM)
 
 $(qapi-dir)/test-qapi-types.c $(qapi-dir)/test-qapi-types.h :\
 $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
--- ./Makefile.orig
+++ ./Makefile
@@ -34,7 +34,7 @@
 
 $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
 
-LIBS+=-lz $(LIBS_TOOLS)
+LIBS+=-lz $(LIBS_TOOLS) $(LIBM)
 
 ifdef BUILD_DOCS
 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt