From 5213fca4893dadbc4e34ed426e865c187e9ceaa5 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Thu, 20 Aug 2009 08:31:26 +0000 Subject: [PATCH] rewrite a bit that m4 macro SVN revision: 41881 --- legacy/eina/m4/efl_pthread.m4 | 56 ++++++++++++----------------------- 1 file changed, 19 insertions(+), 37 deletions(-) diff --git a/legacy/eina/m4/efl_pthread.m4 b/legacy/eina/m4/efl_pthread.m4 index b11ae84f62..30f364b6bc 100644 --- a/legacy/eina/m4/efl_pthread.m4 +++ b/legacy/eina/m4/efl_pthread.m4 @@ -13,7 +13,7 @@ AC_DEFUN([EFL_CHECK_PTHREAD], dnl configure option AC_ARG_ENABLE([pthread], - [AC_HELP_STRING([--disable-pthread], [enable POSIX threads code @<:@default=no@:>@])], + [AC_HELP_STRING([--disable-pthread], [enable POSIX threads code @<:@default=yes@:>@])], [ if test "x${enableval}" = "xyes" ; then _efl_enable_pthread="yes" @@ -21,8 +21,8 @@ AC_ARG_ENABLE([pthread], _efl_enable_pthread="no" fi ], - [_efl_enable_pthread="yes"] -) + [_efl_enable_pthread="yes"]) + AC_MSG_CHECKING([whether to build POSIX threads code]) AC_MSG_RESULT([${_efl_enable_pthread}]) @@ -31,43 +31,25 @@ dnl check if the compiler supports pthreads _efl_have_pthread="no" if test "x${_efl_enable_pthread}" = "xyes" ; then - - SAVE_CFLAGS=${CFLAGS} - CFLAGS="-pthread" - AC_LANG_PUSH([C]) - - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ -#include - ]], - [[]]) - ], - [ - _efl_have_pthread="yes" - EFL_PTHREAD_CFLAGS="-pthread" - EFL_PTHREAD_LIBS="-pthread" - ] - ) - - AC_LANG_POP([C]) - CFLAGS=${SAVE_CFLAGS} + AC_CHECK_HEADER(pthread.h, + [_efl_have_pthread="yes"], + [_efl_have_pthread="no"]) fi -AC_MSG_CHECKING([whether compiler need -pthread POSIX for threads support]) -AC_MSG_RESULT([${_efl_have_pthread}]) +AC_MSG_CHECKING([whether system support POSIX threads]) +AC_MSG_RESULT([${_efl_enable_pthread}]) -if test "x${_efl_have_pthread}" = "xno" -a "x${_efl_enable_pthread}" = "xyes" ; then - AC_CHECK_HEADER(pthread.h, - [ - _efl_have_pthread="yes" - EFL_PTHREAD_LIBS="-lpthread" - ], - [ - _efl_have_pthread="no" - ]) - - AC_MSG_CHECKING([whether system support POSIX threads]) - AC_MSG_RESULT([${_efl_enable_pthread}]) +if test "x${_efl_have_pthread}" = "xyes" ; then + case "$host_os" in + solaris*) + EFL_PTHREAD_CFLAGS="-mt" + EFL_PTHREAD_LIBS="-mt" + ;; + *) + EFL_PTHREAD_CFLAGS="-pthread" + EFL_PTHREAD_LIBS="-pthead" + ;; + esac fi AC_SUBST(EFL_PTHREAD_CFLAGS)