From: caro Date: Sun, 2 May 2010 05:20:02 +0000 (+0000) Subject: * link pthread and spinlock code instead of just compiling X-Git-Tag: accepted/2.0/20130306.224007~195^2~994 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=70865214e5cf2c68bca3e906ba378369c930a0ce;p=profile%2Fivi%2Fecore.git * 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 git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@48541 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/m4/efl_pthread.m4 b/m4/efl_pthread.m4 index acf1a34..1894ad7 100644 --- a/m4/efl_pthread.m4 +++ b/m4/efl_pthread.m4 @@ -30,11 +30,30 @@ AC_MSG_RESULT([${_efl_enable_pthread}]) 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" 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([[ #include ]], @@ -44,6 +63,8 @@ id = pthread_self(); ]])], [_efl_have_pthread="yes"], [_efl_have_pthread="no"]) + CFLAGS=${SAVE_CFLAGS} + LDFLAGS=${SAVE_LDFLAGS} 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.]) fi +EFL_PTHREAD_CFLAGS="" +EFL_PTHREAD_LIBS="" if test "x${_efl_have_pthread}" = "xyes" ; then - 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_PTHREAD_CFLAGS=${_efl_pthread_cflags} + EFL_PTHREAD_LIBS=${_efl_pthread_libs} fi 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 + SAVE_CFLAGS=${CFLAGS} + CFLAGS="${CFLAGS} ${EFL_PTHREAD_CFLAGS}" + SAVE_LDFLAGS=${LDFLAGS} + LDFLAGS="${LDFLAGS} ${EFL_PTHREAD_LIBS}" AC_LINK_IFELSE( [AC_LANG_PROGRAM([[ #include @@ -94,13 +109,15 @@ res = pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE); ]])], [_efl_have_pthread_spinlock="yes"], [_efl_have_pthread_spinlock="no"]) + CFLAGS=${SAVE_CFLAGS} + LDFLAGS=${SAVE_LDFLAGS} fi AC_MSG_CHECKING([whether to build POSIX threads spinlock code]) 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 - AC_MSG_ERROR([pthread support requested but spinlocks are not supported]) + AC_MSG_WARN([pthread support requested but spinlocks are not supported]) fi if test "x${_efl_have_pthread_spinlock}" = "xyes" ; then