summaryrefslogtreecommitdiff
path: root/legacy/eet/m4
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2010-05-02 05:19:35 +0000
committerVincent Torri <vincent.torri@gmail.com>2010-05-02 05:19:35 +0000
commit28736f4621eafeca3d1b4c3935eceefb354dc296 (patch)
treecc3be7ff5e215728a0c0dbf38bb62e0ea24f8a81 /legacy/eet/m4
parent9abb2c1357c35fa89d6f1c653f7f18816db431d9 (diff)
* link pthread and spinlock code instead of just compiling
* POSIX pthread spinlock may be unimplemented, so don't exit with an error if they are not available SVN revision: 48539
Diffstat (limited to 'legacy/eet/m4')
-rw-r--r--legacy/eet/m4/efl_pthread.m449
1 files changed, 33 insertions, 16 deletions
diff --git a/legacy/eet/m4/efl_pthread.m4 b/legacy/eet/m4/efl_pthread.m4
index acf1a34f6e..1894ad7c89 100644
--- a/legacy/eet/m4/efl_pthread.m4
+++ b/legacy/eet/m4/efl_pthread.m4
@@ -30,11 +30,30 @@ AC_MSG_RESULT([${_efl_enable_pthread}])
30 30
31dnl check if the compiler supports pthreads 31dnl check if the compiler supports pthreads
32 32
33case "$host_os" in
34 mingw*)
35 _efl_pthread_cflags=""
36 _efl_pthread_libs="-lpthreadGC2"
37 ;;
38 solaris*)
39 _efl_pthread_cflags="-mt"
40 _efl_pthread_libs="-mt"
41 ;;
42 *)
43 _efl_pthread_cflags="-pthread"
44 _efl_pthread_libs="-pthread"
45 ;;
46esac
47
33_efl_have_pthread="no" 48_efl_have_pthread="no"
34 49
35if test "x${_efl_enable_pthread}" = "xyes" || test "x${_efl_enable_pthread}" = "xauto" ; then 50if test "x${_efl_enable_pthread}" = "xyes" || test "x${_efl_enable_pthread}" = "xauto" ; then
36 51
37 AC_COMPILE_IFELSE( 52 SAVE_CFLAGS=${CFLAGS}
53 CFLAGS="${CFLAGS} ${_efl_pthread_cflags}"
54 SAVE_LDFLAGS=${LDFLAGS}
55 LDFLAGS="${LDFLAGS} ${_efl_pthread_libs}"
56 AC_LINK_IFELSE(
38 [AC_LANG_PROGRAM([[ 57 [AC_LANG_PROGRAM([[
39#include <pthread.h> 58#include <pthread.h>
40 ]], 59 ]],
@@ -44,6 +63,8 @@ id = pthread_self();
44 ]])], 63 ]])],
45 [_efl_have_pthread="yes"], 64 [_efl_have_pthread="yes"],
46 [_efl_have_pthread="no"]) 65 [_efl_have_pthread="no"])
66 CFLAGS=${SAVE_CFLAGS}
67 LDFLAGS=${SAVE_LDFLAGS}
47 68
48fi 69fi
49 70
@@ -53,21 +74,11 @@ if test "$x{_efl_enable_pthread}" = "xyes" && test "x${_efl_have_pthread}" = "xn
53 AC_MSG_ERROR([pthread support requested but not found.]) 74 AC_MSG_ERROR([pthread support requested but not found.])
54fi 75fi
55 76
77EFL_PTHREAD_CFLAGS=""
78EFL_PTHREAD_LIBS=""
56if test "x${_efl_have_pthread}" = "xyes" ; then 79if test "x${_efl_have_pthread}" = "xyes" ; then
57 case "$host_os" in 80 EFL_PTHREAD_CFLAGS=${_efl_pthread_cflags}
58 mingw*) 81 EFL_PTHREAD_LIBS=${_efl_pthread_libs}
59 EFL_PTHREAD_CFLAGS=""
60 EFL_PTHREAD_LIBS="-lpthreadGC2"
61 ;;
62 solaris*)
63 EFL_PTHREAD_CFLAGS="-mt"
64 EFL_PTHREAD_LIBS="-mt"
65 ;;
66 *)
67 EFL_PTHREAD_CFLAGS="-pthread"
68 EFL_PTHREAD_LIBS="-pthread"
69 ;;
70 esac
71fi 82fi
72 83
73AC_SUBST(EFL_PTHREAD_CFLAGS) 84AC_SUBST(EFL_PTHREAD_CFLAGS)
@@ -83,6 +94,10 @@ _efl_have_pthread_spinlock="no"
83 94
84if test "x${_efl_have_pthread}" = "xyes" && test "x$1" = "xyes" ; then 95if test "x${_efl_have_pthread}" = "xyes" && test "x$1" = "xyes" ; then
85 96
97 SAVE_CFLAGS=${CFLAGS}
98 CFLAGS="${CFLAGS} ${EFL_PTHREAD_CFLAGS}"
99 SAVE_LDFLAGS=${LDFLAGS}
100 LDFLAGS="${LDFLAGS} ${EFL_PTHREAD_LIBS}"
86 AC_LINK_IFELSE( 101 AC_LINK_IFELSE(
87 [AC_LANG_PROGRAM([[ 102 [AC_LANG_PROGRAM([[
88#include <pthread.h> 103#include <pthread.h>
@@ -94,13 +109,15 @@ res = pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE);
94 ]])], 109 ]])],
95 [_efl_have_pthread_spinlock="yes"], 110 [_efl_have_pthread_spinlock="yes"],
96 [_efl_have_pthread_spinlock="no"]) 111 [_efl_have_pthread_spinlock="no"])
112 CFLAGS=${SAVE_CFLAGS}
113 LDFLAGS=${SAVE_LDFLAGS}
97 114
98fi 115fi
99 116
100AC_MSG_CHECKING([whether to build POSIX threads spinlock code]) 117AC_MSG_CHECKING([whether to build POSIX threads spinlock code])
101AC_MSG_RESULT([${_efl_have_pthread_spinlock}]) 118AC_MSG_RESULT([${_efl_have_pthread_spinlock}])
102if test "x${_efl_enable_pthread}" = "xyes" && test "x${_efl_have_pthread_spinlock}" = "xno" && test "x$1" = "xyes" ; then 119if test "x${_efl_enable_pthread}" = "xyes" && test "x${_efl_have_pthread_spinlock}" = "xno" && test "x$1" = "xyes" ; then
103 AC_MSG_ERROR([pthread support requested but spinlocks are not supported]) 120 AC_MSG_WARN([pthread support requested but spinlocks are not supported])
104fi 121fi
105 122
106if test "x${_efl_have_pthread_spinlock}" = "xyes" ; then 123if test "x${_efl_have_pthread_spinlock}" = "xyes" ; then