and stop using AS_IF

Vincent

On Sun, 8 Aug 2010, Enlightenment SVN wrote:

> Log:
>  split out spinlock detection to separate macro for readability, add rwlock 
> detection macro
>  ***no functional changes***
>
> Author:       discomfitor
> Date:         2010-08-08 12:20:07 -0700 (Sun, 08 Aug 2010)
> New Revision: 50910
>
> Modified:
>  trunk/eina/configure.ac trunk/eina/m4/efl_threads.m4
>
> Modified: trunk/eina/configure.ac
> ===================================================================
> --- trunk/eina/configure.ac   2010-08-08 19:03:34 UTC (rev 50909)
> +++ trunk/eina/configure.ac   2010-08-08 19:20:07 UTC (rev 50910)
> @@ -84,7 +84,7 @@
> EFL_CHECK_CPU_SSE2([have_sse2="yes"], [have_sse2="no"])
> EFL_CHECK_CPU_ALTIVEC([have_altivec="yes"], [have_altivec="no"])
>
> -EFL_CHECK_THREADS(["yes"],
> +EFL_CHECK_THREADS(
>    [
>     if test "x${_efl_have_posix_threads}" = "xyes" ; then
>        have_threads="POSIX"
> @@ -96,9 +96,9 @@
>        fi
>     fi
>    ],
> -   [have_threads="no"],
> -   [have_posix_threads_spinlock="yes"],
> -   [have_posix_threads_spinlock="no"])
> +   [have_threads="no"])
> +EFL_CHECK_SPINLOCK([have_posix_threads_spinlock="yes"], 
> [have_posix_threads_spinlock="no"])
> +EFL_CHECK_RWLOCK([have_posix_threads_rwlock="yes"], 
> [have_posix_threads_rwlock="no"])
>
> ### Additional options to configure
>
> @@ -591,11 +591,10 @@
> echo "  Maximum log level....: ${with_max_log_level}"
> echo "  Report string usage..: ${have_stringshare_usage}"
> echo "  Default mempool......: ${have_default_mempool}"
> -echo $ECHO_N "  Thread Support.......: ${have_threads}$ECHO_C"
> +echo "  Thread Support.......: ${have_threads}"
> if test "${have_threads}" = "POSIX" ; then
> -   echo " (spinlock: ${have_posix_threads_spinlock})"
> -else
> -   echo
> +echo "    spinlock...........: ${have_posix_threads_spinlock}"
> +echo "    rwlock.............: ${have_posix_threads_rwlock}"
> fi
> echo "  Amalgamation.........: ${do_amalgamation}"
> echo "  Iconv support........: ${have_iconv}"
>
> Modified: trunk/eina/m4/efl_threads.m4
> ===================================================================
> --- trunk/eina/m4/efl_threads.m4      2010-08-08 19:03:34 UTC (rev 50909)
> +++ trunk/eina/m4/efl_threads.m4      2010-08-08 19:20:07 UTC (rev 50910)
> @@ -1,13 +1,13 @@
> dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
> -dnl That code is public domain and can be freely used or copied.
> +dnl rwlock code added by Mike Blumenkrantz <mike at zentific dot com>
> +dnl This code is public domain and can be freely used or copied.
>
> dnl Macro that check if POSIX or Win32 threads library is available or not.
>
> -dnl Usage: EFL_CHECK_THREADS(want_pthread_spin[, ACTION-IF-FOUND [, 
> ACTION-IF-NOT-FOUND]])
> +dnl Usage: EFL_CHECK_THREADS(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
> dnl Call AC_SUBST(EFL_PTHREAD_CFLAGS)
> dnl Call AC_SUBST(EFL_PTHREAD_LIBS)
> -dnl Define EFL_HAVE_POSIX_THREADS or EFL_HAVE_WIN32_THREADS, and 
> EFL_HAVE_THREADS
> -dnl Define EFL_HAVE_POSIX_THREADS_SPINLOCK
> +dnl Defines EFL_HAVE_POSIX_THREADS or EFL_HAVE_WIN32_THREADS, and 
> EFL_HAVE_THREADS
>
> AC_DEFUN([EFL_CHECK_THREADS],
> [
> @@ -138,11 +138,29 @@
>    AC_DEFINE([EFL_HAVE_POSIX_THREADS], [1], [Define to mention that POSIX 
> threads are supported])
> fi
>
> +
> +if test "x${_efl_enable_win32_threads}" = "xyes" ; then
> +   _efl_have_win32_threads="yes"
> +   AC_DEFINE([EFL_HAVE_WIN32_THREADS], [1], [Define to mention that Win32 
> threads are supported])
> +fi
> +
> +if test "x${_efl_have_posix_threads}" = "xyes" || test 
> "x${_efl_have_win32_threads}" = "xyes" ; then
> +   AC_DEFINE([EFL_HAVE_THREADS], [1], [Define to mention that POSIX or Win32 
> threads are supported])
> +fi
> +
> +AS_IF([test "x$_efl_have_posix_threads" = "xyes" || test 
> "x$_efl_have_win32_threads" = "xyes"], [$1], [$2])
> +])
> +
> +dnl Usage: EFL_CHECK_SPINLOCK(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
> +dnl Defines EFL_HAVE_POSIX_THREADS_SPINLOCK
> +AC_DEFUN([EFL_CHECK_SPINLOCK],
> +[
> +
> dnl check if the compiler supports pthreads spinlock
>
> _efl_have_posix_threads_spinlock="no"
>
> -if test "x${_efl_have_posix_threads}" = "xyes" && test "x$1" = "xyes" ; then
> +if test "x${_efl_have_posix_threads}" = "xyes" ; then
>
>    SAVE_CFLAGS=${CFLAGS}
>    CFLAGS="${CFLAGS} ${EFL_PTHREAD_CFLAGS}"
> @@ -166,24 +184,55 @@
>
> AC_MSG_CHECKING([whether to build POSIX threads spinlock code])
> AC_MSG_RESULT([${_efl_have_posix_threads_spinlock}])
> -if test "x${_efl_enable_posix_threads}" = "xyes" && test 
> "x${_efl_have_posix_threads_spinlock}" = "xno" && test "x$1" = "xyes" ; then
> +if test "x${_efl_enable_posix_threads}" = "xyes" && test 
> "x${_efl_have_posix_threads_spinlock}" = "xno" ; then
>    AC_MSG_WARN([POSIX threads support requested but spinlocks are not 
> supported])
> fi
>
> if test "x${_efl_have_posix_threads_spinlock}" = "xyes" ; then
>    AC_DEFINE([EFL_HAVE_POSIX_THREADS_SPINLOCK], [1], [Define to mention that 
> POSIX threads spinlocks are supported])
> fi
> +AS_IF([test "x$_efl_have_posix_threads_spinlock" = "xyes"], [$1], [$2])
> +])
>
> -if test "x${_efl_enable_win32_threads}" = "xyes" ; then
> -   _efl_have_win32_threads="yes"
> -   AC_DEFINE([EFL_HAVE_WIN32_THREADS], [1], [Define to mention that Win32 
> threads are supported])
> +
> +dnl Usage: EFL_CHECK_RWLOCK(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
> +dnl Defines EFL_HAVE_POSIX_THREADS_RWLOCK
> +AC_DEFUN([EFL_CHECK_RWLOCK],
> +[
> +dnl check if the compiler supports pthreads rwlock
> +
> +_efl_have_posix_threads_rwlock="no"
> +
> +if test "x${_efl_have_posix_threads}" = "xyes" ; then
> +
> +   SAVE_CFLAGS=${CFLAGS}
> +   CFLAGS="${CFLAGS} ${EFL_PTHREAD_CFLAGS}"
> +   SAVE_LIBS=${LIBS}
> +   LIBS="${LIBS} ${EFL_PTHREAD_LIBS}"
> +   AC_LINK_IFELSE(
> +      [AC_LANG_PROGRAM([[
> +#include <pthread.h>
> +                       ]],
> +                       [[
> +pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER;
> +int res;
> +res = pthread_rwlock_init(&lock, PTHREAD_PROCESS_PRIVATE);
> +                       ]])],
> +      [_efl_have_posix_threads_rwlock="yes"],
> +      [_efl_have_posix_threads_rwlock="no"])
> +   CFLAGS=${SAVE_CFLAGS}
> +   LIBS=${SAVE_LIBS}
> +
> fi
>
> -if test "x${_efl_have_posix_threads}" = "xyes" || test 
> "x${_efl_have_win32_threads}" = "xyes" ; then
> -   AC_DEFINE([EFL_HAVE_THREADS], [1], [Define to mention that POSIX or Win32 
> threads are supported])
> +AC_MSG_CHECKING([whether to build POSIX threads rwlock code])
> +AC_MSG_RESULT([${_efl_have_posix_threads_rwlock}])
> +if test "x${_efl_enable_posix_threads}" = "xyes" && test 
> "x${_efl_have_posix_threads_rwlock}" = "xno" ; then
> +   AC_MSG_WARN([POSIX threads support requested but rwlocks are not 
> supported])
> fi
>
> -AS_IF([test "x$_efl_have_posix_threads" = "xyes" || test 
> "x$_efl_have_win32_threads" = "xyes"], [$2], [$3])
> -AS_IF([test "x$_efl_have_posix_threads_spinlock" = "xyes"], [$4], [$5])
> -
> +if test "x${_efl_have_posix_threads_rwlock}" = "xyes" ; then
> +   AC_DEFINE([EFL_HAVE_POSIX_THREADS_RWLOCK], [1], [Define to mention that 
> POSIX threads rwlocks are supported])
> +fi
> +AS_IF([test "x$_efl_have_posix_threads_rwlock" = "xyes"], [$1], [$2])
> ])
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by
>
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>
>

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to