Magellan Linux

Contents of /trunk/qemu-kvm/patches/qemu-1.2.0-glibc.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2550 - (show annotations) (download)
Tue Mar 17 10:20:51 2015 UTC (9 years, 1 month ago) by niro
File size: 2194 byte(s)
-fix build against newer glibc or ulibc
1 From 8bacde8d86a09699207d85d4bab06162aed18dc4 Mon Sep 17 00:00:00 2001
2 From: Natanael Copa <natanael.copa@gmail.com>
3 Date: Wed, 12 Sep 2012 09:06:51 +0000
4 Subject: [PATCH] configure: properly check if -lrt and -lm is needed
5
6 Fixes build against uClibc.
7
8 uClibc provides 2 versions of clock_gettime(), one with realtime
9 support and one without (this is so you can avoid linking in -lrt
10 unless actually needed). This means that the clock_gettime() don't
11 need -lrt. We still need it for timer_create() so we check for this
12 function in addition.
13
14 We also need check if -lm is needed for isnan().
15
16 Both -lm and -lrt are needed for libs_qga.
17
18 Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
19 Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
20 ---
21 configure | 31 +++++++++++++++++++++++++++++--
22 1 files changed, 29 insertions(+), 2 deletions(-)
23
24 diff --git a/configure b/configure
25 index 7656c32..9ab13db 100755
26 --- a/configure
27 +++ b/configure
28 @@ -2671,17 +2671,44 @@ fi
29
30
31 ##########################################
32 +# Do we need libm
33 +cat > $TMPC << EOF
34 +#include <math.h>
35 +int main(void) { return isnan(sin(0.0)); }
36 +EOF
37 +if compile_prog "" "" ; then
38 + :
39 +elif compile_prog "" "-lm" ; then
40 + LIBS="-lm $LIBS"
41 + libs_qga="-lm $libs_qga"
42 +else
43 + echo
44 + echo "Error: libm check failed"
45 + echo
46 + exit 1
47 +fi
48 +
49 +##########################################
50 # Do we need librt
51 +# uClibc provides 2 versions of clock_gettime(), one with realtime
52 +# support and one without. This means that the clock_gettime() don't
53 +# need -lrt. We still need it for timer_create() so we check for this
54 +# function in addition.
55 cat > $TMPC <<EOF
56 #include <signal.h>
57 #include <time.h>
58 -int main(void) { return clock_gettime(CLOCK_REALTIME, NULL); }
59 +int main(void) {
60 + timer_create(CLOCK_REALTIME, NULL, NULL);
61 + return clock_gettime(CLOCK_REALTIME, NULL);
62 +}
63 EOF
64
65 if compile_prog "" "" ; then
66 :
67 -elif compile_prog "" "-lrt" ; then
68 +# we need pthread for static linking. use previous pthread test result
69 +elif compile_prog "" "-lrt $pthread_lib" ; then
70 LIBS="-lrt $LIBS"
71 + libs_qga="-lrt $libs_qga"
72 fi
73
74 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
75 --
76 1.7.0.4
77