forked from enlightenment/efl
* 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: 48540
This commit is contained in:
parent
28736f4621
commit
d0a0206be6
|
@ -30,11 +30,30 @@ AC_MSG_RESULT([${_efl_enable_pthread}])
|
||||||
|
|
||||||
dnl check if the compiler supports pthreads
|
dnl check if the compiler supports pthreads
|
||||||
|
|
||||||
|
case "$host_os" in
|
||||||
|
mingw*)
|
||||||
|
_efl_pthread_cflags=""
|
||||||
|
_efl_pthread_libs="-lpthreadGC2"
|
||||||
|
;;
|
||||||
|
solaris*)
|
||||||
|
_efl_pthread_cflags="-mt"
|
||||||
|
_efl_pthread_libs="-mt"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
_efl_pthread_cflags="-pthread"
|
||||||
|
_efl_pthread_libs="-pthread"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
_efl_have_pthread="no"
|
_efl_have_pthread="no"
|
||||||
|
|
||||||
if test "x${_efl_enable_pthread}" = "xyes" || test "x${_efl_enable_pthread}" = "xauto" ; then
|
if test "x${_efl_enable_pthread}" = "xyes" || test "x${_efl_enable_pthread}" = "xauto" ; then
|
||||||
|
|
||||||
AC_COMPILE_IFELSE(
|
SAVE_CFLAGS=${CFLAGS}
|
||||||
|
CFLAGS="${CFLAGS} ${_efl_pthread_cflags}"
|
||||||
|
SAVE_LDFLAGS=${LDFLAGS}
|
||||||
|
LDFLAGS="${LDFLAGS} ${_efl_pthread_libs}"
|
||||||
|
AC_LINK_IFELSE(
|
||||||
[AC_LANG_PROGRAM([[
|
[AC_LANG_PROGRAM([[
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
]],
|
]],
|
||||||
|
@ -44,6 +63,8 @@ id = pthread_self();
|
||||||
]])],
|
]])],
|
||||||
[_efl_have_pthread="yes"],
|
[_efl_have_pthread="yes"],
|
||||||
[_efl_have_pthread="no"])
|
[_efl_have_pthread="no"])
|
||||||
|
CFLAGS=${SAVE_CFLAGS}
|
||||||
|
LDFLAGS=${SAVE_LDFLAGS}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -53,21 +74,11 @@ if test "$x{_efl_enable_pthread}" = "xyes" && test "x${_efl_have_pthread}" = "xn
|
||||||
AC_MSG_ERROR([pthread support requested but not found.])
|
AC_MSG_ERROR([pthread support requested but not found.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
EFL_PTHREAD_CFLAGS=""
|
||||||
|
EFL_PTHREAD_LIBS=""
|
||||||
if test "x${_efl_have_pthread}" = "xyes" ; then
|
if test "x${_efl_have_pthread}" = "xyes" ; then
|
||||||
case "$host_os" in
|
EFL_PTHREAD_CFLAGS=${_efl_pthread_cflags}
|
||||||
mingw*)
|
EFL_PTHREAD_LIBS=${_efl_pthread_libs}
|
||||||
EFL_PTHREAD_CFLAGS=""
|
|
||||||
EFL_PTHREAD_LIBS="-lpthreadGC2"
|
|
||||||
;;
|
|
||||||
solaris*)
|
|
||||||
EFL_PTHREAD_CFLAGS="-mt"
|
|
||||||
EFL_PTHREAD_LIBS="-mt"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
EFL_PTHREAD_CFLAGS="-pthread"
|
|
||||||
EFL_PTHREAD_LIBS="-pthread"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_SUBST(EFL_PTHREAD_CFLAGS)
|
AC_SUBST(EFL_PTHREAD_CFLAGS)
|
||||||
|
@ -83,6 +94,10 @@ _efl_have_pthread_spinlock="no"
|
||||||
|
|
||||||
if test "x${_efl_have_pthread}" = "xyes" && test "x$1" = "xyes" ; then
|
if test "x${_efl_have_pthread}" = "xyes" && test "x$1" = "xyes" ; then
|
||||||
|
|
||||||
|
SAVE_CFLAGS=${CFLAGS}
|
||||||
|
CFLAGS="${CFLAGS} ${EFL_PTHREAD_CFLAGS}"
|
||||||
|
SAVE_LDFLAGS=${LDFLAGS}
|
||||||
|
LDFLAGS="${LDFLAGS} ${EFL_PTHREAD_LIBS}"
|
||||||
AC_LINK_IFELSE(
|
AC_LINK_IFELSE(
|
||||||
[AC_LANG_PROGRAM([[
|
[AC_LANG_PROGRAM([[
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
@ -94,13 +109,15 @@ res = pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE);
|
||||||
]])],
|
]])],
|
||||||
[_efl_have_pthread_spinlock="yes"],
|
[_efl_have_pthread_spinlock="yes"],
|
||||||
[_efl_have_pthread_spinlock="no"])
|
[_efl_have_pthread_spinlock="no"])
|
||||||
|
CFLAGS=${SAVE_CFLAGS}
|
||||||
|
LDFLAGS=${SAVE_LDFLAGS}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to build POSIX threads spinlock code])
|
AC_MSG_CHECKING([whether to build POSIX threads spinlock code])
|
||||||
AC_MSG_RESULT([${_efl_have_pthread_spinlock}])
|
AC_MSG_RESULT([${_efl_have_pthread_spinlock}])
|
||||||
if test "x${_efl_enable_pthread}" = "xyes" && test "x${_efl_have_pthread_spinlock}" = "xno" && test "x$1" = "xyes" ; then
|
if test "x${_efl_enable_pthread}" = "xyes" && test "x${_efl_have_pthread_spinlock}" = "xno" && test "x$1" = "xyes" ; then
|
||||||
AC_MSG_ERROR([pthread support requested but spinlocks are not supported])
|
AC_MSG_WARN([pthread support requested but spinlocks are not supported])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x${_efl_have_pthread_spinlock}" = "xyes" ; then
|
if test "x${_efl_have_pthread_spinlock}" = "xyes" ; then
|
||||||
|
|
Loading…
Reference in New Issue