Skip to contentSkip to conversation

[5997] Make sure to link librt if we need to.

Qemu-devel Anthony Liguori 1 participant 1 message Dec 12, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 5997

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5997
Author:   aliguori
Date:     2008-12-12 20:02:52 +0000 (Fri, 12 Dec 2008)

Log Message:
-----------
Make sure to link librt if we need to.

This is really a stop-gap. The recent thread pool changes uncovered a deeper issue with how we use librt. We really should be probing for timer_create and then conditionally enabling that code.

Modified Paths:
--------------
trunk/configure

Modified: trunk/configure
===================================================================

configure +20 -0
@@ -972,6 +972,26 @@
   build_docs="yes"
 fi
 
+##########################################
+# Do we need librt
+cat > $TMPC <<EOF
+#include <signal.h>
+#include <time.h>
+int main(void) { clockid_t id; return clock_gettime(id, NULL); }
+EOF
+
+rt=no
+if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+  :
+elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt 2> /dev/null ; then
+  rt=yes
+fi
+
+if test "$rt" = "yes" ; then
+  # Hack, we should have a general purpose LIBS for this sort of thing
+  AIOLIBS="$AIOLIBS -lrt"
+fi
+
 if test "$mingw32" = "yes" ; then
   if test -z "$prefix" ; then
       prefix="c:\\\\Program Files\\\\Qemu"