From 7ccfc62c02ae3e7821d7ba96f9376580cefdab9a Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Wed, 30 Dec 2009 00:02:48 +0000 Subject: [PATCH] * better m4 code * use latest efl_pthread.m4 code and update configure.ac accordingly SVN revision: 44771 --- legacy/eet/configure.ac | 2 +- legacy/eet/m4/efl_coverage.m4 | 8 ++---- legacy/eet/m4/efl_doxygen.m4 | 11 +++------ legacy/eet/m4/efl_pthread.m4 | 46 ++++++++++++++++++++++++++++++----- legacy/eet/m4/efl_tests.m4 | 6 +---- 5 files changed, 48 insertions(+), 25 deletions(-) diff --git a/legacy/eet/configure.ac b/legacy/eet/configure.ac index 591954c8d4..99e93e1a14 100644 --- a/legacy/eet/configure.ac +++ b/legacy/eet/configure.ac @@ -274,7 +274,7 @@ AC_MSG_RESULT(${have_signature}) # pthread library -EFL_CHECK_PTHREAD([have_pthread="yes"], [have_pthread="no"]) +EFL_CHECK_PTHREAD(["no"], [have_pthread="yes"], [have_pthread="no"]) ### Checks for header files diff --git a/legacy/eet/m4/efl_coverage.m4 b/legacy/eet/m4/efl_coverage.m4 index baf00021ec..85d03215b3 100644 --- a/legacy/eet/m4/efl_coverage.m4 +++ b/legacy/eet/m4/efl_coverage.m4 @@ -31,7 +31,7 @@ AC_MSG_RESULT([$_efl_enable_coverage]) dnl lcov check -if test ! "x$1" = "xyes" -a "x$_efl_enable_coverage" = "xyes" ; then +if test "x$_efl_enable_coverage" = "xyes" && test ! "x$1" = "xyes" ; then AC_MSG_WARN([Coverage report requested but tests not being built, disable profiling instrumentation.]) AC_MSG_WARN([Run configure with --enable-tests]) _efl_enable_coverage="no" @@ -56,11 +56,7 @@ AC_SUBST(EFL_COVERAGE_LIBS) AM_CONDITIONAL(EFL_ENABLE_COVERAGE, test "x${_efl_enable_coverage}" = "xyes") -if test "x${_efl_enable_coverage}" = "xyes" ; then - m4_default([$2], [:]) -else - m4_default([$3], [:]) -fi +AS_IF([test "x$_efl_enable_coverage" = "xyes"], [$2], [$3]) ]) dnl End of efl_coverage.m4 diff --git a/legacy/eet/m4/efl_doxygen.m4 b/legacy/eet/m4/efl_doxygen.m4 index d83ed68b8a..7324af3e42 100644 --- a/legacy/eet/m4/efl_doxygen.m4 +++ b/legacy/eet/m4/efl_doxygen.m4 @@ -73,6 +73,8 @@ dnl Check the given doxygen program. AC_MSG_WARN([no doxygen detected. Documentation will not be built]) fi ]) +else + efl_have_doxygen="no" fi dnl @@ -84,14 +86,9 @@ if ! test "x${efl_have_doxygen}" = "xyes" ; then efl_enable_doc="no" fi -AM_CONDITIONAL(EFL_BUILD_DOC, test "x${efl_enable_doc}" = "xyes") - -if test "x${efl_enable_doc}" = "xyes" ; then - m4_default([$1], [:]) -else - m4_default([$2], [:]) -fi +AM_CONDITIONAL(EFL_BUILD_DOC, test "x${efl_have_doxygen}" = "xyes") +AS_IF([test "x$efl_have_doxygen" = "xyes"], [$1], [$2]) ]) dnl End of efl_doxygen.m4 diff --git a/legacy/eet/m4/efl_pthread.m4 b/legacy/eet/m4/efl_pthread.m4 index 7bd341c709..384b7ae230 100644 --- a/legacy/eet/m4/efl_pthread.m4 +++ b/legacy/eet/m4/efl_pthread.m4 @@ -3,7 +3,7 @@ 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 Usage: EFL_CHECK_EFL_CHECK_PTHREAD(want_pthread_spin[, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Call AC_SUBST(EFL_PTHREAD_FLAGS) dnl Define EFL_HAVE_PTHREAD @@ -31,9 +31,18 @@ dnl check if the compiler supports pthreads _efl_have_pthread="no" if test "x${_efl_enable_pthread}" = "xyes" ; then - AC_CHECK_HEADER(pthread.h, + + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#include + ]], + [[ +pthread_t id; +id = pthread_self(); + ]])], [_efl_have_pthread="yes"], [_efl_have_pthread="no"]) + fi AC_MSG_CHECKING([whether system support POSIX threads]) @@ -63,9 +72,34 @@ 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]) +dnl check if the compiler supports pthreads spinlock + +_efl_have_pthread_spinlock="no" + +if test "x${_efl_have_pthread}" = "xyes" && test "x$1" = "xyes" ; then + + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#include + ]], + [[ +pthread_spinlock_t lock; +int res; +res = pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE); + ]])], + [_efl_have_pthread_spinlock="yes"], + [_efl_have_pthread_spinlock="no"]) + fi + +AC_MSG_CHECKING([whether to build POSIX threads spinlock code]) +AC_MSG_RESULT([${_efl_have_pthread_spinlock}]) + +if test "x${_efl_have_pthread_spinlock}" = "xyes" ; then + AC_DEFINE(EFL_HAVE_PTHREAD_SPINLOCK, 1, [Define to mention that POSIX threads spinlocks are supported]) +fi + +AS_IF([test "x$_efl_have_pthread" = "xyes"], [$2], [$3]) +AS_IF([test "x$_efl_have_pthread_spinlock" = "xyes"], [$4], [$5]) + ]) diff --git a/legacy/eet/m4/efl_tests.m4 b/legacy/eet/m4/efl_tests.m4 index 98d11bb7e8..3a4dfe246f 100644 --- a/legacy/eet/m4/efl_tests.m4 +++ b/legacy/eet/m4/efl_tests.m4 @@ -37,11 +37,7 @@ fi AM_CONDITIONAL(EFL_ENABLE_TESTS, test "x${_efl_enable_tests}" = "xyes") -if test "x${_efl_enable_tests}" = "xyes" ; then - m4_default([$1], [:]) -else - m4_default([$2], [:]) -fi +AS_IF([test "x$_efl_enable_tests" = "xyes"], [$1], [$2]) ]) dnl End of efl_tests.m4