* better m4 coding

* improve pthread detection and add spinlock detection


SVN revision: 44717
This commit is contained in:
Vincent Torri 2009-12-25 11:29:08 +00:00
parent 7c00860cc1
commit ebed5f4dab
6 changed files with 51 additions and 55 deletions

View File

@ -27,11 +27,7 @@ AC_MSG_RESULT([${_efl_enable_benchmark}])
AM_CONDITIONAL(EFL_ENABLE_BENCHMARK, test "x${_efl_enable_benchmark}" = "xyes") AM_CONDITIONAL(EFL_ENABLE_BENCHMARK, test "x${_efl_enable_benchmark}" = "xyes")
if test "x${_efl_enable_benchmark}" = "xyes" ; then AS_IF([test "x$_efl_enable_benchmark" = "xyes"], [$1], [$2])
m4_default([$1], [:])
else
m4_default([$2], [:])
fi
]) ])
dnl End of efl_benchmark.m4 dnl End of efl_benchmark.m4

View File

@ -31,7 +31,7 @@ AC_MSG_RESULT([$_efl_enable_coverage])
dnl lcov check 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([Coverage report requested but tests not being built, disable profiling instrumentation.])
AC_MSG_WARN([Run configure with --enable-tests]) AC_MSG_WARN([Run configure with --enable-tests])
_efl_enable_coverage="no" _efl_enable_coverage="no"
@ -56,11 +56,7 @@ AC_SUBST(EFL_COVERAGE_LIBS)
AM_CONDITIONAL(EFL_ENABLE_COVERAGE, test "x${_efl_enable_coverage}" = "xyes") AM_CONDITIONAL(EFL_ENABLE_COVERAGE, test "x${_efl_enable_coverage}" = "xyes")
if test "x${_efl_enable_coverage}" = "xyes" ; then AS_IF([test "x$_efl_enable_coverage" = "xyes"], [$2], [$3])
m4_default([$2], [:])
else
m4_default([$3], [:])
fi
]) ])
dnl End of efl_coverage.m4 dnl End of efl_coverage.m4

View File

@ -48,8 +48,7 @@ if test "x${_efl_build_cpu_mmx}" = "xyes" ; then
AC_COMPILE_IFELSE( AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]], [AC_LANG_PROGRAM([[]],
[[]]) [[]])],
],
[ [
have_linker_option="yes" have_linker_option="yes"
EFL_SIMD_FLAGS="${EFL_SIMD_FLAGS} -mmmx"], EFL_SIMD_FLAGS="${EFL_SIMD_FLAGS} -mmmx"],
@ -68,11 +67,7 @@ if test "x${_efl_build_cpu_mmx}" = "xyes" ; then
AC_DEFINE([EFL_HAVE_MMX], [1], [Define to mention that MMX is supported]) AC_DEFINE([EFL_HAVE_MMX], [1], [Define to mention that MMX is supported])
fi fi
if test "x${_efl_build_cpu_mmx}" = "xyes" ; then AS_IF([test "x$_efl_build_cpu_mmx" = "xyes"], [$1], [$2])
m4_default([$1], [:])
else
m4_default([$2], [:])
fi
]) ])
dnl Usage: EFL_CHECK_CPU_SSE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Usage: EFL_CHECK_CPU_SSE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
@ -141,11 +136,7 @@ if test "x${_efl_build_cpu_sse}" = "xyes" ; then
AC_DEFINE([EFL_HAVE_SSE], [1], [Define to mention that SSE is supported]) AC_DEFINE([EFL_HAVE_SSE], [1], [Define to mention that SSE is supported])
fi fi
if test "x${_efl_build_cpu_sse}" = "xyes" ; then AS_IF([test "x$_efl_build_cpu_sse" = "xyes"], [$1], [$2])
m4_default([$1], [:])
else
m4_default([$2], [:])
fi
]) ])
dnl Usage: EFL_CHECK_CPU_SSE2([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Usage: EFL_CHECK_CPU_SSE2([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
@ -215,11 +206,7 @@ if test "x${_efl_build_cpu_sse2}" = "xyes" ; then
AC_DEFINE([EFL_HAVE_SSE2], [1], [Define to mention that SSE2 is supported]) AC_DEFINE([EFL_HAVE_SSE2], [1], [Define to mention that SSE2 is supported])
fi fi
if test "x${_efl_build_cpu_sse2}" = "xyes" ; then AS_IF([test "x$_efl_build_cpu_sse2" = "xyes"], [$1], [$2])
m4_default([$1], [:])
else
m4_default([$2], [:])
fi
]) ])
dnl Usage: EFL_CHECK_CPU_ALTIVEC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Usage: EFL_CHECK_CPU_ALTIVEC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
@ -305,11 +292,7 @@ if test "x${_efl_have_faltivec}" = "xyes" ; then
AC_DEFINE([EFL_HAVE_ALTIVEC], [1], [Define to mention that ALTIVEC is supported]) AC_DEFINE([EFL_HAVE_ALTIVEC], [1], [Define to mention that ALTIVEC is supported])
fi fi
if test "x${_efl_have_faltivec}" = "xyes" ; then AS_IF([test "x$_efl_have_faltivec" = "xyes"], [$1], [$2])
m4_default([$1], [:])
else
m4_default([$2], [:])
fi
]) ])
dnl Usage: EFL_CHECK_CPU_NEON([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Usage: EFL_CHECK_CPU_NEON([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
@ -352,11 +335,7 @@ if test "x${_efl_build_cpu_neon}" = "xyes" ; then
AC_DEFINE([EFL_HAVE_NEON], [1], [Define to mention that NEON is supported]) AC_DEFINE([EFL_HAVE_NEON], [1], [Define to mention that NEON is supported])
fi fi
if test "x${_efl_build_cpu_neon}" = "xyes" ; then AS_IF([test "x$_efl_build_cpu_neon" = "xyes"], [$1], [$2])
m4_default([$1], [:])
else
m4_default([$2], [:])
fi
]) ])
dnl End of efl_cpu.m4 dnl End of efl_cpu.m4

View File

@ -88,12 +88,7 @@ fi
AM_CONDITIONAL(EFL_BUILD_DOC, test "x${efl_have_doxygen}" = "xyes") AM_CONDITIONAL(EFL_BUILD_DOC, test "x${efl_have_doxygen}" = "xyes")
if test "x${efl_have_doxygen}" = "xyes" ; then AS_IF([test "x$efl_have_doxygen" = "xyes"], [$1], [$2])
m4_default([$1], [:])
else
m4_default([$2], [:])
fi
]) ])
dnl End of efl_doxygen.m4 dnl End of efl_doxygen.m4

View File

@ -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 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 Call AC_SUBST(EFL_PTHREAD_FLAGS)
dnl Define EFL_HAVE_PTHREAD dnl Define EFL_HAVE_PTHREAD
@ -31,9 +31,18 @@ dnl check if the compiler supports pthreads
_efl_have_pthread="no" _efl_have_pthread="no"
if test "x${_efl_enable_pthread}" = "xyes" ; then if test "x${_efl_enable_pthread}" = "xyes" ; then
AC_CHECK_HEADER(pthread.h,
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <pthread.h>
]],
[[
pthread_t id;
id = pthread_self();
]])],
[_efl_have_pthread="yes"], [_efl_have_pthread="yes"],
[_efl_have_pthread="no"]) [_efl_have_pthread="no"])
fi fi
AC_MSG_CHECKING([whether system support POSIX threads]) 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]) AC_DEFINE(EFL_HAVE_PTHREAD, 1, [Define to mention that POSIX threads are supported])
fi fi
if test "x${_efl_have_pthread}" = "xyes" ; then dnl check if the compiler supports pthreads spinlock
ifelse([$1], , :, [$1])
else _efl_have_pthread_spinlock="no"
ifelse([$2], , :, [$2])
if test "x${_efl_have_pthread}" = "xyes" && test "x$1" = "xyes" ; then
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <pthread.h>
]],
[[
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 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])
]) ])

View File

@ -37,11 +37,7 @@ fi
AM_CONDITIONAL(EFL_ENABLE_TESTS, test "x${_efl_enable_tests}" = "xyes") AM_CONDITIONAL(EFL_ENABLE_TESTS, test "x${_efl_enable_tests}" = "xyes")
if test "x${_efl_enable_tests}" = "xyes" ; then AS_IF([test "x$_efl_enable_tests" = "xyes"], [$1], [$2])
m4_default([$1], [:])
else
m4_default([$2], [:])
fi
]) ])
dnl End of efl_tests.m4 dnl End of efl_tests.m4