summaryrefslogtreecommitdiff
path: root/legacy/eet/m4/efl_pthread.m4
blob: 7bd341c7098391df80db0647e73705c224e0a21c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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
])