# check uuid
PKG_CHECK_MODULES(UUID, [
uuid
+],
+[
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_UUID_UUID_H 1
+#define HAVE_UUID_GENERATE 1
+_ACEOF
+],
+[
+ uuid_revert_save_LIBS=$LIBS
+ AC_CHECK_HEADERS(uuid.h uuid/uuid.h sys/uuid.h)
+ AC_SEARCH_LIBS(uuid_create, uuid, [
+ if test "$ac_cv_search_uuid_create" != "none required"; then
+ UUID_LIBS=$ac_cv_search_uuid_create
+ fi
+ AC_CHECK_FUNCS(uuid_create)
+ ],
+ [
+ AC_SEARCH_LIBS(uuid_generate, uuid, [
+ if test "$ac_cv_search_uuid_generate" != "none required"; then
+ UUID_LIBS=$ac_cv_search_uuid_generate
+ fi
+ AC_CHECK_FUNCS(uuid_generate)
+ ])
+ ])
+ LIBS=$uuid_revert_save_LIBS
])
-# check uuid
+# check sigc
PKG_CHECK_MODULES(SIGC, [
sigc++-2.0
])
#ifndef __PY_UTIL_H_
#define __PY_UTIL_H_
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if defined(HAVE_UUID_H)
+#include <uuid.h>
+#elif defined(HAVE_UUID_UUID_H)
#include <uuid/uuid.h>
+#elif defined(HAVE_SYS_UUID_H)
+#include <sys/uuid.h>
+#endif
#include <sys/utsname.h>
#include <stdlib.h>
#include "String.h"
public:
UUID (void) {
uuid_t u;
+#if defined(HAVE_UUID_CREATE)
+ gchar* uuid;
+ uuid_create (&u, 0);
+ uuid_to_string (&u, &uuid, 0);
+ g_strlcpy (m_uuid, uuid, sizeof(m_uuid));
+ free(uuid);
+#elif defined(HAVE_UUID_GENERATE)
uuid_generate (u);
uuid_unparse (u, m_uuid);
+#endif
}
operator const gchar * (void) const {