diff --git configure.ac.orig configure.ac
index e1b213f..9ceed92 100644
old
|
new
|
PKG_CHECK_MODULES(NICE, nice >= 0.0.11) |
273 | 273 | AC_SUBST(NICE_CFLAGS) |
274 | 274 | AC_SUBST(NICE_LIBS) |
275 | 275 | |
276 | | PKG_CHECK_MODULES([UUID], [uuid]) |
277 | | AC_SUBST([UUID_CFLAGS]) |
278 | | AC_SUBST([UUID_LIBS]) |
| 276 | dnl Check for libuuid |
| 277 | PKG_CHECK_MODULES([UUID], [uuid], [HAVE_UUID=yes], [HAVE_UUID=no]) |
| 278 | if test x"$HAVE_UUID" = xyes; then |
| 279 | AC_SUBST([UUID_CFLAGS]) |
| 280 | AC_SUBST([UUID_LIBS]) |
| 281 | AC_DEFINE([HAVE_UUID], [1], [Define if libuuid is available]) |
| 282 | else |
| 283 | AC_MSG_WARN([libuuid not found, falling back to generating random IDs]) |
| 284 | fi |
279 | 285 | |
280 | 286 | dnl Check for MCE, a Maemo service used by Gabble to determine when the device |
281 | 287 | dnl is idle. |
diff --git src/util.c.orig src/util.c
index 15dc1ae..4ca3743 100644
old
|
new
|
|
36 | 36 | |
37 | 37 | #include <extensions/extensions.h> |
38 | 38 | |
39 | | #include <uuid.h> |
| 39 | #ifdef HAVE_UUID |
| 40 | # include <uuid.h> |
| 41 | #endif |
40 | 42 | |
41 | 43 | #define DEBUG_FLAG GABBLE_DEBUG_JID |
42 | 44 | |
… |
… |
gchar * |
84 | 86 | gabble_generate_id (void) |
85 | 87 | { |
86 | 88 | /* generate random UUIDs */ |
87 | | uuid_t uu; |
88 | 89 | gchar *str; |
89 | 90 | |
90 | 91 | str = g_new0 (gchar, 37); |
91 | | uuid_generate_random (uu); |
92 | | uuid_unparse_lower (uu, str); |
93 | | return str; |
| 92 | |
| 93 | #ifdef HAVE_UUID |
| 94 | { |
| 95 | uuid_t uu; |
| 96 | |
| 97 | uuid_generate_random (uu); |
| 98 | uuid_unparse_lower (uu, str); |
| 99 | } |
| 100 | #else |
| 101 | { |
| 102 | const char *hex = "0123456789abcdef"; |
| 103 | int i; |
| 104 | |
| 105 | for (i = 0; i < 36; i++) |
| 106 | str[i] = hex[g_random_int_range (0, 16)]; |
| 107 | |
| 108 | str[8] = str[13] = str[18] = str[23] = '-'; |
| 109 | } |
| 110 | #endif |
| 111 | |
| 112 | return str; |
94 | 113 | } |
95 | 114 | |
96 | 115 | static void |