* link correctly ecore against pthread

* use the efl_pthread.m4 macro
 * add configure output for pthread support in ecore


SVN revision: 43627
This commit is contained in:
Vincent Torri 2009-11-11 23:43:58 +00:00
parent 1b98d1216c
commit 1b7b929a09
4 changed files with 84 additions and 15 deletions

View File

@ -709,11 +709,8 @@ fi
AC_SUBST(quartz_ldflags)
# basic pthread support
AC_CHECK_HEADER(pthread.h,
[
AC_DEFINE(BUILD_PTHREAD, 1, [Build thread worker])
]
)
EFL_CHECK_PTHREAD([have_pthread="yes"], [have_pthread="no"])
### Checks for types
AC_CHECK_SIZEOF(int, 4)
@ -1181,6 +1178,7 @@ echo
echo " Core:"
echo
echo " Ecore........................: always"
echo " Thread support.............: $have_pthread"
echo " GLib support...............: $have_glib"
echo " Ecore_Job....................: $have_ecore_job"
echo " Ecore_Txt....................: $have_ecore_txt"

View File

@ -0,0 +1,71 @@
dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr>
dnl That code is public domain and can be freely used or copied.
dnl Macro that check if several ASM instruction sets are available or not.
dnl Usage: EFL_CHECK_EFL_CHECK_PTHREAD([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Call AC_SUBST(EFL_PTHREAD_FLAGS)
dnl Define EFL_HAVE_PTHREAD
AC_DEFUN([EFL_CHECK_PTHREAD],
[
dnl configure option
AC_ARG_ENABLE([pthread],
[AC_HELP_STRING([--disable-pthread], [enable POSIX threads code @<:@default=yes@:>@])],
[
if test "x${enableval}" = "xyes" ; then
_efl_enable_pthread="yes"
else
_efl_enable_pthread="no"
fi
],
[_efl_enable_pthread="yes"])
AC_MSG_CHECKING([whether to build POSIX threads code])
AC_MSG_RESULT([${_efl_enable_pthread}])
dnl check if the compiler supports pthreads
_efl_have_pthread="no"
if test "x${_efl_enable_pthread}" = "xyes" ; then
AC_CHECK_HEADER(pthread.h,
[_efl_have_pthread="yes"],
[_efl_have_pthread="no"])
fi
AC_MSG_CHECKING([whether system support POSIX threads])
AC_MSG_RESULT([${_efl_enable_pthread}])
if test "x${_efl_have_pthread}" = "xyes" ; then
case "$host_os" in
mingw*)
EFL_PTHREAD_CFLAGS="-mthreads"
EFL_PTHREAD_LIBS="-mthreads -lpthreadGC2"
;;
solaris*)
EFL_PTHREAD_CFLAGS="-mt"
EFL_PTHREAD_LIBS="-mt"
;;
*)
EFL_PTHREAD_CFLAGS="-pthread"
EFL_PTHREAD_LIBS="-pthread"
;;
esac
fi
AC_SUBST(EFL_PTHREAD_CFLAGS)
AC_SUBST(EFL_PTHREAD_LIBS)
if test "x${_efl_have_pthread}" = "xyes" ; then
AC_DEFINE(EFL_HAVE_PTHREAD, 1, [Define to mention that POSIX threads are supported])
fi
if test "x${_efl_have_pthread}" = "xyes" ; then
ifelse([$1], , :, [$1])
else
ifelse([$2], , :, [$2])
fi
])

View File

@ -1,7 +1,7 @@
MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = @EVIL_CFLAGS@ @WIN32_CPPFLAGS@ @EFL_ECORE_BUILD@
AM_CFLAGS = @WIN32_CFLAGS@ @EINA_CFLAGS@ @WIN32_CPPFLAGS@ @GLIB_CFLAGS@
AM_CPPFLAGS = @GLIB_CFLAGS@ @EVIL_CFLAGS@ @EINA_CFLAGS@ @WIN32_CPPFLAGS@ @EFL_ECORE_BUILD@
AM_CFLAGS = @WIN32_CFLAGS@ @EFL_PTHREAD_CFLAGS@
lib_LTLIBRARIES = libecore.la
include_HEADERS = \
@ -39,7 +39,7 @@ ecore_value.c \
ecore_thread.c \
ecore_glib.c
libecore_la_LIBADD = @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ -lm
libecore_la_LIBADD = @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ @EFL_PTHREAD_LIBS@ -lm
libecore_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @ecore_release_info@
EXTRA_DIST = ecore_private.h

View File

@ -6,14 +6,14 @@
# include <Evil.h>
#endif
#ifdef BUILD_PTHREAD
#ifdef EFL_HAVE_PTHREAD
# include <pthread.h>
#endif
#include "ecore_private.h"
#include "Ecore.h"
#ifdef BUILD_PTHREAD
#ifdef EFL_HAVE_PTHREAD
typedef struct _Ecore_Pthread_Worker Ecore_Pthread_Worker;
typedef struct _Ecore_Pthread_Data Ecore_Pthread_Data;
typedef struct _Ecore_Pthread Ecore_Pthread;
@ -39,7 +39,7 @@ struct _Ecore_Pthread_Data
static int _ecore_thread_count_max = 0;
static int ECORE_THREAD_PIPE_DEL = 0;
#ifdef BUILD_PTHREAD
#ifdef EFL_HAVE_PTHREAD
static int _ecore_thread_count = 0;
static Eina_List *_ecore_thread_data = NULL;
static Eina_List *_ecore_thread = NULL;
@ -164,7 +164,7 @@ _ecore_thread_init(void)
_ecore_thread_count_max = 1;
ECORE_THREAD_PIPE_DEL = ecore_event_type_new();
#ifdef BUILD_PTHREAD
#ifdef EFL_HAVE_PTHREAD
del_handler = ecore_event_handler_add(ECORE_THREAD_PIPE_DEL, _ecore_thread_pipe_del, NULL);
#endif
}
@ -173,7 +173,7 @@ void
_ecore_thread_shutdown(void)
{
/* FIXME: If function are still running in the background, should we kill them ? */
#ifdef BUILD_PTHREAD
#ifdef EFL_HAVE_PTHREAD
Ecore_Pthread_Worker *work;
Ecore_Pthread_Data *pth;
@ -221,7 +221,7 @@ ecore_thread_run(void (*func_heavy)(void *data),
void (*func_cancel)(void *data),
const void *data)
{
#ifdef BUILD_PTHREAD
#ifdef EFL_HAVE_PTHREAD
Ecore_Pthread_Worker *work;
Ecore_Pthread_Data *pth;
@ -288,7 +288,7 @@ ecore_thread_run(void (*func_heavy)(void *data),
EAPI Eina_Bool
ecore_thread_cancel(Ecore_Thread *thread)
{
#ifdef BUILD_PTHREAD
#ifdef EFL_HAVE_PTHREAD
Ecore_Pthread_Worker *work;
Eina_List *l;