summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac15
-rw-r--r--src/sm_genid.c25
2 files changed, 32 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 9730b70..cf36193 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,12 +42,15 @@ XTRANS_CONNECTION_FLAGS
AC_ARG_WITH(libuuid, AC_HELP_STRING([--with-libuuid], [Build with libuuid support for client IDs]))
-if test x"$with_libuuid" != xno; then
- PKG_CHECK_MODULES(LIBUUID, uuid, [HAVE_LIBUUID=yes], [HAVE_LIBUUID=no])
-fi
-if test x"$with_libuuid" = xyes && test x"$HAVE_LIBUUID" = xno; then
- AC_MSG_ERROR([requested libuuid support but uuid.pc not found])
-fi
+AC_CHECK_FUNCS([uuid_create], [], [
+ if test x"$with_libuuid" != xno && test x"$have_system_uuid" != xyes; then
+ PKG_CHECK_MODULES(LIBUUID, uuid, [HAVE_LIBUUID=yes], [HAVE_LIBUUID=no])
+ fi
+ if test x"$with_libuuid" = xyes && test x"$HAVE_LIBUUID" = xno; then
+ AC_MSG_ERROR([requested libuuid support but uuid.pc not found])
+ fi
+])
+
AM_CONDITIONAL(WITH_LIBUUID, test x"$HAVE_LIBUUID" = xyes)
XORG_RELEASE_VERSION
diff --git a/src/sm_genid.c b/src/sm_genid.c
index 391a10e..f6adda3 100644
--- a/src/sm_genid.c
+++ b/src/sm_genid.c
@@ -76,7 +76,9 @@ in this Software without prior written authorization from The Open Group.
#define TCPCONN
#endif
-#if defined(HAVE_LIBUUID)
+#if defined(HAVE_UUID_CREATE)
+#include <uuid.h>
+#elif defined(HAVE_LIBUUID)
#include <uuid/uuid.h>
#endif
@@ -84,7 +86,26 @@ in this Software without prior written authorization from The Open Group.
char *
SmsGenerateClientID(SmsConn smsConn)
{
-#if defined(HAVE_LIBUUID)
+#if defined(HAVE_UUID_CREATE)
+ char *id;
+ char **temp;
+ uuid_t uuid;
+ uint32_t status;
+
+ uuid_create(&uuid, &status);
+
+ uuid_to_string(&uuid, &temp, &status);
+
+ if ((id = malloc (strlen (temp) + 2)) != NULL)
+ {
+ id[1] = '2';
+ strcpy (id+1, temp);
+ }
+
+ free(temp);
+
+ return id;
+#elif defined(HAVE_LIBUUID)
char *id;
char temp[256];
uuid_t uuid;