qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 2 of 3] Optionally link against libuuid if present


From: Ryan Harper
Subject: [Qemu-devel] [PATCH 2 of 3] Optionally link against libuuid if present
Date: Fri, 07 Dec 2007 14:45:53 -0600

3 files changed, 38 insertions(+), 2 deletions(-)
Makefile.target |    5 ++++-
configure       |   26 ++++++++++++++++++++++++++
smbios.c        |    9 ++++++++-


# HG changeset patch
# User Ryan Harper <address@hidden>
# Date 1197058922 21600
# Node ID 3470dd05f46cc9f14c3fc9561d06031a4bc0ce7a
# Parent  37bf559ffcf74bfe62ec038c5818e4cf29b817f5
Optionally link against libuuid if present.

This patch makes libuuid optional.  If not detected, SMBIOS tables will use
canned UUID.

Signed-off-by: Ryan Harper <address@hidden>

diff -r 37bf559ffcf7 -r 3470dd05f46c Makefile.target
--- a/Makefile.target   Fri Dec 07 14:22:02 2007 -0600
+++ b/Makefile.target   Fri Dec 07 14:22:02 2007 -0600
@@ -402,6 +402,9 @@ VL_OBJS+=block-raw.o
 
 ifdef CONFIG_ALSA
 LIBS += -lasound
+endif
+ifdef CONFIG_UUID
+LIBS += -luuid
 endif
 ifdef CONFIG_DSOUND
 LIBS += -lole32 -ldxguid
@@ -535,7 +538,7 @@ ifndef CONFIG_DARWIN
 ifndef CONFIG_DARWIN
 ifndef CONFIG_WIN32
 ifndef CONFIG_SOLARIS
-VL_LIBS+=-lutil -luuid
+VL_LIBS+=-lutil
 endif
 endif
 endif
diff -r 37bf559ffcf7 -r 3470dd05f46c configure
--- a/configure Fri Dec 07 14:22:02 2007 -0600
+++ b/configure Fri Dec 07 14:22:02 2007 -0600
@@ -89,6 +89,7 @@ dsound="no"
 dsound="no"
 coreaudio="no"
 alsa="no"
+uuid="yes"
 fmod="no"
 fmod_lib=""
 fmod_inc=""
@@ -260,6 +261,8 @@ for opt do
   ;;
   --enable-alsa) alsa="yes"
   ;;
+  --enable-uuid) uuid="yes"
+  ;;
   --enable-dsound) dsound="yes"
   ;;
   --enable-fmod) fmod="yes"
@@ -404,6 +407,7 @@ echo "  --enable-adlib           enable 
 echo "  --enable-adlib           enable Adlib emulation"
 echo "  --enable-coreaudio       enable Coreaudio audio driver"
 echo "  --enable-alsa            enable ALSA audio driver"
+echo "  --enable-uuid            enable UUID generation for machines"
 echo "  --enable-fmod            enable FMOD audio driver"
 echo "  --enable-dsound          enable DirectSound audio driver"
 echo "  --disable-vnc-tls        disable TLS encryption for VNC server"
@@ -662,6 +666,23 @@ EOF
   fi
 fi
 
+##########################################
+# uuid library
+if test "$uuid" = "yes" ; then
+  cat > $TMPC << EOF
+#include <uuid/uuid.h>
+int main(void) { uuid_t u; return 0; }
+EOF
+  if $cc -o $TMPE $TMPC -luuid 2> /dev/null ; then
+    :
+  else
+    echo
+    echo "Error: Could not find uuid"
+    echo "Make sure to have the uuid libs and headers installed."
+    echo
+    exit 1
+  fi
+fi
 # Check if tools are available to build documentation.
 if [ -x "`which texi2html 2>/dev/null`" ] && \
    [ -x "`which pod2man 2>/dev/null`" ]; then
@@ -716,6 +737,7 @@ echo "Adlib support     $adlib"
 echo "Adlib support     $adlib"
 echo "CoreAudio support $coreaudio"
 echo "ALSA support      $alsa"
+echo "UUID support      $uuid"
 echo "DSound support    $dsound"
 if test "$fmod" = "yes"; then
     if test -z $fmod_lib || test -z $fmod_inc; then
@@ -901,6 +923,10 @@ if test "$alsa" = "yes" ; then
   echo "CONFIG_ALSA=yes" >> $config_mak
   echo "#define CONFIG_ALSA 1" >> $config_h
 fi
+if test "$uuid" = "yes" ; then
+  echo "CONFIG_UUID=yes" >> $config_mak
+  echo "#define CONFIG_UUID 1" >> $config_h
+fi
 if test "$dsound" = "yes" ; then
   echo "CONFIG_DSOUND=yes" >> $config_mak
   echo "#define CONFIG_DSOUND 1" >> $config_h
diff -r 37bf559ffcf7 -r 3470dd05f46c smbios.c
--- a/smbios.c  Fri Dec 07 14:22:02 2007 -0600
+++ b/smbios.c  Fri Dec 07 14:22:02 2007 -0600
@@ -25,11 +25,14 @@
 #include <stdio.h>
 #include <stdint.h>
 #include <string.h>
-#include <uuid/uuid.h>
 #include "hw/hw.h"
 #include "sysemu.h"
 #include "smbios_types.h"
 #include "config-host.h"
+
+#ifdef CONFIG_UUID
+#include <uuid/uuid.h>
+#endif
 
 CPUState *first_cpu;
 
@@ -491,9 +494,13 @@ load_smbios_tables(uint8_t *entry, uint8
     int len;
     uint32_t major_version = 0;
     uint32_t minor_version = 9;
+#ifdef CONFIG_UUID
     uuid_t uuid;
 
     uuid_generate(uuid);
+#else
+    uint8_t uuid[16] = "QEMUQEMUQEMUQEMU";
+#endif
 
     len = write_smbios_tables(entry, table, phys_table_start,
                               smp_cpus, (ram_size >> 20),




reply via email to

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