From bdf62cd1c3f22fd492e7e66eac2db355bc2d41bd Mon Sep 17 00:00:00 2001 From: caro Date: Thu, 20 Aug 2009 08:31:26 +0000 Subject: [PATCH] rewrite a bit that m4 macro git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@41881 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- m4/efl_pthread.m4 | 56 +++++++++++++++++++------------------------------------ 1 file changed, 19 insertions(+), 37 deletions(-) diff --git a/m4/efl_pthread.m4 b/m4/efl_pthread.m4 index b11ae84..30f364b 100644 --- a/m4/efl_pthread.m4 +++ b/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}]) - -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}]) - 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) -- 2.7.4