ecore: add Exotic support.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 24 Feb 2012 11:20:25 +0000 (11:20 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 24 Feb 2012 11:20:25 +0000 (11:20 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@68402 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

configure.ac
m4/efl_gettimeofday.m4 [new file with mode: 0644]
src/lib/ecore/Ecore.h
src/lib/ecore/Makefile.am
src/lib/ecore/ecore.c
src/lib/ecore/ecore_getopt.c
src/lib/ecore/ecore_main.c
src/lib/ecore/ecore_pipe.c
src/lib/ecore/ecore_private.h
src/lib/ecore/ecore_time.c

index cfad06f..35e7118 100644 (file)
@@ -473,6 +473,21 @@ case "$host_vendor" in
       ;;
 esac
 
+
+### Checks for portability layer
+
+PKG_CHECK_MODULES([EXOTIC],
+   [exotic],
+   [enable_exotic="yes"],
+   [enable_exotic="no"])
+
+if test "x${enable_exotic}" = "xyes"; then
+    requirement_exotic="exotic ${requirement_exotic}"
+
+    AC_DEFINE([HAVE_EXOTIC], [1], [Define to 1 if you have Exotic.])
+fi
+AM_CONDITIONAL([ECORE_HAVE_EXOTIC], [test "x${enable_exotic}" = "xyes"])
+
 AC_SUBST(EFL_ECORE_BUILD)
 AC_SUBST(EFL_ECORE_CON_BUILD)
 AC_SUBST(EFL_ECORE_EVAS_BUILD)
diff --git a/m4/efl_gettimeofday.m4 b/m4/efl_gettimeofday.m4
new file mode 100644 (file)
index 0000000..9b767e5
--- /dev/null
@@ -0,0 +1,48 @@
+dnl Copyright (C) 2011 Cedric Bail <cedric.bail@free.fr>
+dnl This code is public domain and can be freely used or copied.
+
+dnl Macro that check for gettimeofday definition
+
+dnl Usage: EFL_CHECK_GETTIMEOFDAY(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
+dnl Define EFL_HAVE_GETTIMEOFDAY
+
+AC_DEFUN([EFL_CHECK_GETTIMEOFDAY],
+[
+
+_efl_have_gettimeofday="no"
+
+AC_LINK_IFELSE(
+   [AC_LANG_PROGRAM([[
+#include <stdlib.h>
+#include <sys/time.h>
+                   ]],
+                   [[
+int res;
+res = gettimeofday(NULL, NULL);
+                   ]])],
+   [_efl_have_gettimeofday="yes"],
+   [_efl_have_gettimeofday="no"])
+
+if test "x${_efl_have_gettimeofday}" = "xno" -a "x${enable_exotic}" = "xyes"; then
+   SAVE_LIBS="${LIBS}"
+   SAVE_CFLAGS="${CFLAGS}"
+   LIBS="${LIBS} ${EXOTIC_LIBS}"
+   CFLAGS="${CFLAGS} ${EXOTIC_CFLAGS}"
+   AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM([[
+#include <Exotic.h>
+                      ]],
+                      [[
+int res;
+res = gettimeofday(NULL, NULL);
+                      ]])],
+      [_efl_have_gettimeofday="yes"],
+      [_efl_have_gettimeofday="no"])
+fi
+
+if test "x${_efl_have_gettimeofday}" = "xyes"; then
+   AC_DEFINE([EFL_HAVE_GETTIMEOFDAY], [1], [Defined if gettimeofday is available.])
+fi
+
+AS_IF([test "x${_efl_have_gettimeofday}" = "xyes"], [$1], [$2])
+])
index 289855d..8ab3e71 100644 (file)
@@ -320,7 +320,9 @@ sudo make install
 # include <signal.h>
 #else
 # include <sys/time.h>
-# include <signal.h>
+# if !defined (EXOTIC_NO_SIGNAL)
+#  include <signal.h>
+# endif
 #endif
 
 #include <sys/types.h>
@@ -592,7 +594,7 @@ struct _Ecore_Event_Signal_User    /** User signal event */
    int       number;  /**< The signal number. Either 1 or 2 */
    void     *ext_data;  /**< Extension data - not used */
 
-#if !defined (_WIN32) && !defined (__lv2ppu__)
+#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
    siginfo_t data; /**< Signal info */
 #endif
 };
@@ -601,7 +603,7 @@ struct _Ecore_Event_Signal_Hup    /** Hup signal event */
 {
    void     *ext_data;  /**< Extension data - not used */
 
-#if !defined (_WIN32) && !defined (__lv2ppu__)
+#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
    siginfo_t data; /**< Signal info */
 #endif
 };
@@ -613,7 +615,7 @@ struct _Ecore_Event_Signal_Exit    /** Exit request event */
    Eina_Bool terminate : 1; /**< Set if the exit request was a terminate singal */
    void     *ext_data; /**< Extension data - not used */
 
-#if !defined (_WIN32) && !defined (__lv2ppu__)
+#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
    siginfo_t data; /**< Signal info */
 #endif
 };
@@ -622,7 +624,7 @@ struct _Ecore_Event_Signal_Power    /** Power event */
 {
    void     *ext_data;  /**< Extension data - not used */
 
-#if !defined (_WIN32) && !defined (__lv2ppu__)
+#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
    siginfo_t data; /**< Signal info */
 #endif
 };
@@ -631,7 +633,7 @@ struct _Ecore_Event_Signal_Realtime    /** Realtime event */
 {
    int       num; /**< The realtime signal's number */
 
-#if !defined (_WIN32) && !defined (__lv2ppu__)
+#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
    siginfo_t data; /**< Signal info */
 #endif
 };
@@ -725,7 +727,7 @@ struct _Ecore_Exe_Event_Del    /** Process exit event */
    Eina_Bool  exited    : 1; /** < set to 1 if the process exited of its own accord */
    Eina_Bool  signalled : 1; /** < set to 1 id the process exited due to uncaught signal */
    void      *ext_data; /**< Extension data - not used */
-#if !defined (_WIN32) && !defined (__lv2ppu__)
+#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
    siginfo_t  data; /**< Signal info */
 #endif
 };
index ec3d99f..6f14387 100644 (file)
@@ -47,6 +47,12 @@ libecore_la_SOURCES += ecore_exe_ps3.c
 
 else
 
+if ECORE_HAVE_EXOTIC
+
+libecore_la_SOURCES +=
+
+else
+
 libecore_la_SOURCES += ecore_signal.c ecore_exe.c
 
 endif
@@ -55,6 +61,8 @@ endif
 
 endif
 
+endif
+
 libecore_la_LIBADD = @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ @EFL_PTHREAD_LIBS@ @rt_libs@ -lm
 libecore_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ @EFL_PTHREAD_LIBS@
 
index 7e0f973..d8b8723 100644 (file)
@@ -163,8 +163,10 @@ ecore_init(void)
    if (!ecore_mempool_init()) goto shutdown_mempool;
    _ecore_main_loop_init();
    _ecore_signal_init();
-   _ecore_thread_init();
+#ifndef HAVE_EXOTIC
    _ecore_exe_init();
+#endif
+   _ecore_thread_init();
    _ecore_glib_init();
    _ecore_job_init();
    _ecore_time_init();
@@ -252,7 +254,9 @@ ecore_shutdown(void)
      _ecore_glib_shutdown();
      _ecore_job_shutdown();
      _ecore_thread_shutdown();
+#ifndef HAVE_EXOTIC
      _ecore_exe_shutdown();
+#endif
      _ecore_idle_enterer_shutdown();
      _ecore_idle_exiter_shutdown();
      _ecore_idler_shutdown();
index 76272d3..cd68189 100644 (file)
@@ -38,6 +38,10 @@ void *alloca(size_t);
 # include <Evil.h>
 #endif
 
+#ifdef HAVE_EXOTIC
+# include <Exotic.h>
+#endif
+
 #include "Ecore.h"
 #include "Ecore_Getopt.h"
 
index 79814c4..8f438bd 100644 (file)
@@ -229,10 +229,14 @@ static Eina_Bool win32_handlers_delete_me = EINA_FALSE;
 #ifdef _WIN32
 Ecore_Select_Function main_loop_select = _ecore_main_win32_select;
 #else
-# ifdef HAVE_SYS_SELECT_H
-#  include <sys/select.h>
-# endif
+# if !defined EXOTIC_NO_SELECT
+#  ifdef HAVE_SYS_SELECT_H
+#   include <sys/select.h>
+#  endif
 Ecore_Select_Function main_loop_select = select;
+# else
+Ecore_Select_Function main_loop_select = NULL;
+# endif
 #endif
 
 #ifndef USE_G_MAIN_LOOP
index 9304357..0995598 100644 (file)
@@ -74,6 +74,9 @@
 
 #endif /* ! _WIN32 */
 
+#include <Ecore.h>
+#include "ecore_private.h"
+
 struct _Ecore_Pipe
 {
                      ECORE_MAGIC;
index 50d502c..1dfc7e7 100644 (file)
@@ -174,7 +174,7 @@ void      *_ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler);
 
 void       _ecore_main_shutdown(void);
 
-#if defined (_WIN32) || defined (__lv2ppu__)
+#if defined (_WIN32) || defined (__lv2ppu__) || defined (HAVE_EXOTIC)
 static inline void _ecore_signal_shutdown(void) { }
 
 static inline void _ecore_signal_init(void) { }
index 8e7611b..23e26f9 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <time.h>
 
-#ifdef HAVE_CLOCK_GETTIME
+#if defined (HAVE_CLOCK_GETTIME) || defined (EXOTIC_PROVIDE_CLOCK_GETTIME)
 static clockid_t _ecore_time_clock_id = -1;
 #elif defined(__APPLE__) && defined(__MACH__)
 static double _ecore_time_clock_conversion = 1e-9;
@@ -52,7 +52,7 @@ double _ecore_time_loop_time = -1.0;
 EAPI double
 ecore_time_get(void)
 {
-#ifdef HAVE_CLOCK_GETTIME
+#if defined (HAVE_CLOCK_GETTIME) || defined (EXOTIC_PROVIDE_CLOCK_GETTIME) 
    struct timespec t;
 
    if (EINA_UNLIKELY(_ecore_time_clock_id < 0))
@@ -86,7 +86,7 @@ ecore_time_get(void)
 EAPI double
 ecore_time_unix_get(void)
 {
-#ifdef HAVE_GETTIMEOFDAY
+#ifdef EFL_HAVE_GETTIMEOFDAY
    struct timeval timev;
 
    gettimeofday(&timev, NULL);
@@ -136,7 +136,7 @@ ecore_loop_time_get(void)
 void
 _ecore_time_init(void)
 {
-#ifdef HAVE_CLOCK_GETTIME
+#if defined (HAVE_CLOCK_GETTIME) || defined (EXOTIC_PROVIDE_CLOCK_GETTIME)
    struct timespec t;
 
    if (_ecore_time_clock_id != -1) return;