qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RESEND PATCH v3 5/5] Use libuuid if available.


From: Gleb Natapov
Subject: [Qemu-devel] [RESEND PATCH v3 5/5] Use libuuid if available.
Date: Mon, 16 Jun 2008 16:02:01 +0300
User-agent: StGIT/0.14.2

If libuuid is available use it for UUID generation in case a user does not
provide one.

Signed-off-by: Gleb Natapov <address@hidden>
---

 Makefile.target |    4 ++++
 configure       |   14 ++++++++++++++
 vl.c            |   13 +++++++++++++
 3 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index fc8132a..2eb8481 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -506,6 +506,10 @@ CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
 LIBS += $(CONFIG_VNC_TLS_LIBS)
 endif
 
+ifdef CONFIG_UUID
+LIBS += -luuid
+endif
+
 # SCSI layer
 OBJS+= lsi53c895a.o esp.o
 
diff --git a/configure b/configure
index 64b7b42..02946af 100755
--- a/configure
+++ b/configure
@@ -114,6 +114,7 @@ build_docs="no"
 uname_release=""
 curses="yes"
 nptl="yes"
+uuid="yes"
 
 # OS specific
 targetos=`uname -s`
@@ -317,6 +318,8 @@ for opt do
   ;;
   --enable-uname-release=*) uname_release="$optarg"
   ;;
+  --disable-uuid) uuid="no"
+  ;;
   --sparc_cpu=*)
       sparc_cpu="$optarg"
       case $sparc_cpu in
@@ -732,6 +735,12 @@ if test "$vnc_tls" = "yes" ; then
 fi
 
 ##########################################
+# uuid library
+if test "$uuid" = "yes" ; then
+  `pkg-config uuid 2> /dev/null` || uuid="no"
+fi
+
+##########################################
 # alsa sound support libraries
 
 if test "$alsa" = "yes" ; then
@@ -867,6 +876,7 @@ echo "Documentation     $build_docs"
 [ ! -z "$uname_release" ] && \
 echo "uname -r          $uname_release"
 echo "NPTL support      $nptl"
+echo "UUID support      $uuid"
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -1079,6 +1089,10 @@ if test "$vnc_tls" = "yes" ; then
   echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
   echo "#define CONFIG_VNC_TLS 1" >> $config_h
 fi
+if test "$uuid" = "yes" ; then
+  echo "CONFIG_UUID=yes" >> $config_mak
+  echo "#define CONFIG_UUID 1" >> $config_h
+fi
 qemu_version=`head $source_path/VERSION`
 echo "VERSION=$qemu_version" >>$config_mak
 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
diff --git a/vl.c b/vl.c
index 532045d..6ed9609 100644
--- a/vl.c
+++ b/vl.c
@@ -131,6 +131,11 @@ int inet_aton(const char *cp, struct in_addr *ia);
 
 #include "exec-all.h"
 
+#ifdef CONFIG_UUID
+#include <uuid/uuid.h>
+static int uuid_dont_generate;
+#endif
+
 #define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
 #define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
 #ifdef __sun__
@@ -8264,6 +8269,9 @@ int main(int argc, char **argv)
                             " Wrong format.\n");
                     exit(1);
                 }
+#ifdef CONFIG_UUID
+                uuid_dont_generate = 1;
+#endif
                 break;
            case QEMU_OPTION_daemonize:
                daemonize = 1;
@@ -8347,6 +8355,11 @@ int main(int argc, char **argv)
         }
     }
 
+#if CONFIG_UUID
+    if (!uuid_dont_generate)
+        uuid_generate(qemu_uuid);
+#endif
+
 #ifndef _WIN32
     if (daemonize && !nographic && vnc_display == NULL) {
        fprintf(stderr, "Can only daemonize if using -nographic or -vnc\n");





reply via email to

[Prev in Thread] Current Thread [Next in Thread]