|
|
5544c1 |
From 39b2ed0e73ac5b220accf7116bdaecb71ce759af Mon Sep 17 00:00:00 2001
|
|
|
5544c1 |
From: Natanael Copa <natanael.copa@gmail.com>
|
|
|
5544c1 |
Date: Wed, 12 Sep 2012 09:06:51 +0000
|
|
|
5544c1 |
Subject: [PATCH] configure: properly check if -lrt and -lm is needed
|
|
|
5544c1 |
|
|
|
5544c1 |
Fixes build against uClibc.
|
|
|
5544c1 |
|
|
|
5544c1 |
uClibc provides 2 versions of clock_gettime(), one with realtime
|
|
|
5544c1 |
support and one without (this is so you can avoid linking in -lrt
|
|
|
5544c1 |
unless actually needed). This means that the clock_gettime() don't
|
|
|
5544c1 |
need -lrt. We still need it for timer_create() so we check for this
|
|
|
5544c1 |
function in addition.
|
|
|
5544c1 |
|
|
|
5544c1 |
We also need check if -lm is needed for isnan().
|
|
|
5544c1 |
|
|
|
5544c1 |
Both -lm and -lrt are needed for libs_qga.
|
|
|
5544c1 |
|
|
|
5544c1 |
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
|
|
|
5544c1 |
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
|
|
|
5544c1 |
(cherry picked from commit 8bacde8d86a09699207d85d4bab06162aed18dc4)
|
|
|
5544c1 |
|
|
|
5544c1 |
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
|
|
|
5544c1 |
---
|
|
|
5544c1 |
configure | 31 +++++++++++++++++++++++++++++--
|
|
|
5544c1 |
1 file changed, 29 insertions(+), 2 deletions(-)
|
|
|
5544c1 |
|
|
|
5544c1 |
diff --git a/configure b/configure
|
|
|
5544c1 |
index 9e53cc2..a1f256c 100755
|
|
|
5544c1 |
--- a/configure
|
|
|
5544c1 |
+++ b/configure
|
|
|
5544c1 |
@@ -2645,17 +2645,44 @@ fi
|
|
|
5544c1 |
|
|
|
5544c1 |
|
|
|
5544c1 |
##########################################
|
|
|
5544c1 |
+# Do we need libm
|
|
|
5544c1 |
+cat > $TMPC << EOF
|
|
|
5544c1 |
+#include <math.h>
|
|
|
5544c1 |
+int main(void) { return isnan(sin(0.0)); }
|
|
|
5544c1 |
+EOF
|
|
|
5544c1 |
+if compile_prog "" "" ; then
|
|
|
5544c1 |
+ :
|
|
|
5544c1 |
+elif compile_prog "" "-lm" ; then
|
|
|
5544c1 |
+ LIBS="-lm $LIBS"
|
|
|
5544c1 |
+ libs_qga="-lm $libs_qga"
|
|
|
5544c1 |
+else
|
|
|
5544c1 |
+ echo
|
|
|
5544c1 |
+ echo "Error: libm check failed"
|
|
|
5544c1 |
+ echo
|
|
|
5544c1 |
+ exit 1
|
|
|
5544c1 |
+fi
|
|
|
5544c1 |
+
|
|
|
5544c1 |
+##########################################
|
|
|
5544c1 |
# Do we need librt
|
|
|
5544c1 |
+# uClibc provides 2 versions of clock_gettime(), one with realtime
|
|
|
5544c1 |
+# support and one without. This means that the clock_gettime() don't
|
|
|
5544c1 |
+# need -lrt. We still need it for timer_create() so we check for this
|
|
|
5544c1 |
+# function in addition.
|
|
|
5544c1 |
cat > $TMPC <
|
|
|
5544c1 |
#include <signal.h>
|
|
|
5544c1 |
#include <time.h>
|
|
|
5544c1 |
-int main(void) { return clock_gettime(CLOCK_REALTIME, NULL); }
|
|
|
5544c1 |
+int main(void) {
|
|
|
5544c1 |
+ timer_create(CLOCK_REALTIME, NULL, NULL);
|
|
|
5544c1 |
+ return clock_gettime(CLOCK_REALTIME, NULL);
|
|
|
5544c1 |
+}
|
|
|
5544c1 |
EOF
|
|
|
5544c1 |
|
|
|
5544c1 |
if compile_prog "" "" ; then
|
|
|
5544c1 |
:
|
|
|
5544c1 |
-elif compile_prog "" "-lrt" ; then
|
|
|
5544c1 |
+# we need pthread for static linking. use previous pthread test result
|
|
|
5544c1 |
+elif compile_prog "" "-lrt $pthread_lib" ; then
|
|
|
5544c1 |
LIBS="-lrt $LIBS"
|
|
|
5544c1 |
+ libs_qga="-lrt $libs_qga"
|
|
|
5544c1 |
fi
|
|
|
5544c1 |
|
|
|
5544c1 |
if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
|
|
|
5544c1 |
--
|
|
|
5544c1 |
1.7.12.1
|
|
|
5544c1 |
|