From: Peng Huang Date: Sun, 11 Apr 2010 22:45:50 +0000 (+0800) Subject: Fix compile errors in FreeBSD and NetBSD. X-Git-Tag: 1.3.10~240 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee0f3b1dde90c200df91b3b03a3c1ae3ffcb8fa6;p=platform%2Fupstream%2Fibus-libpinyin.git Fix compile errors in FreeBSD and NetBSD. --- diff --git a/configure.ac b/configure.ac index 22af515..1a0ac62 100644 --- a/configure.ac +++ b/configure.ac @@ -65,9 +65,34 @@ AC_PATH_PROG(SQLITE3, sqlite3) # 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 ]) diff --git a/src/Util.h b/src/Util.h index 4b0dbe7..7bf4cf5 100644 --- a/src/Util.h +++ b/src/Util.h @@ -1,7 +1,17 @@ #ifndef __PY_UTIL_H_ #define __PY_UTIL_H_ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#if defined(HAVE_UUID_H) +#include +#elif defined(HAVE_UUID_UUID_H) #include +#elif defined(HAVE_SYS_UUID_H) +#include +#endif #include #include #include "String.h" @@ -12,8 +22,16 @@ class UUID { 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 {