]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
build: use correct libraries for clock_gettime
authorEric Blake <eblake@redhat.com>
Tue, 4 Sep 2012 16:57:25 +0000 (10:57 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 4 Sep 2012 16:57:25 +0000 (10:57 -0600)
On OpenBSD, clock_gettime() exists in libc rather than librt, and
blindly linking with -lrt made the build fail.  Gnulib already
did the work for determining which libraries to use, so we should
reuse that work rather than doing it ourselves.

* bootstrap.conf (gnulib_modules): Pull in clock-time.
* configure.ac (RT_LIBS): Drop.
* src/Makefile.am (libvirt_util_la_LIBADD): Use gnulib variable
instead.
* src/util/virtime.c (includes): Simplify.

bootstrap.conf
configure.ac
src/Makefile.am
src/util/virtime.c

index a6cfe24c18002df9ab901cda62f5719fb9205645..7fefb69f43b210a431e183b5f404af3644e085b8 100644 (file)
@@ -30,6 +30,7 @@ c-strcasestr
 calloc-posix
 canonicalize-lgpl
 chown
+clock-time
 close
 connect
 configmake
index e0d00d5f167046f49cbbec019df43add2ca039e8..cb91e7d7294c69ed9d06dc901c63cd5eece614c9 100644 (file)
@@ -183,16 +183,6 @@ LIBS="$LIBS $LIB_PTHREAD $LIBMULTITHREAD"
 AC_CHECK_FUNCS([pthread_mutexattr_init])
 LIBS=$old_libs
 
-old_LIBS=$LIBS
-RT_LIBS=
-LIBS="$LIBS $LIB_PTHREAD -lrt"
-AC_CHECK_FUNC([clock_gettime],[
-     AC_DEFINE([HAVE_CLOCK_GETTIME],[],[Defined if clock_gettime() exists in librt.so])
-     RT_LIBS=-lrt
-])
-LIBS=$old_libs
-AC_SUBST(RT_LIBS)
-
 dnl Availability of various common headers (non-fatal if missing).
 AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/un.h \
   sys/poll.h syslog.h mntent.h net/ethernet.h linux/magic.h \
index 95e1bea16774a3e6c62b08ccbd6ea249c6cf903f..39adeac08c159431c620d9cb3efd36188d6d1c23 100644 (file)
@@ -668,7 +668,7 @@ libvirt_util_la_CFLAGS = $(CAPNG_CFLAGS) $(YAJL_CFLAGS) $(LIBNL_CFLAGS) \
                $(DBUS_CFLAGS) $(LDEXP_LIBM)
 libvirt_util_la_LIBADD = $(CAPNG_LIBS) $(YAJL_LIBS) $(LIBNL_LIBS) \
                $(THREAD_LIBS) $(AUDIT_LIBS) $(DEVMAPPER_LIBS) \
-               $(RT_LIBS) $(DBUS_LIBS) $(MSCOM_LIBS) $(LIBXML_LIBS)
+               $(LIB_CLOCK_GETTIME) $(DBUS_LIBS) $(MSCOM_LIBS) $(LIBXML_LIBS)
 
 
 noinst_LTLIBRARIES += libvirt_conf.la
index 926bb50d81fcae7c5d0c52c1b50d14733aba80ed..d34e8ab786b5659f7e83b2e647521db3082d3e28 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * virtime.c: Time handling functions
  *
- * Copyright (C) 2006-2011 Red Hat, Inc.
+ * Copyright (C) 2006-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -34,9 +34,7 @@
 #include <config.h>
 
 #include <stdio.h>
-#ifndef HAVE_CLOCK_GETTIME
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 
 #include "virtime.h"
 #include "util.h"