[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH RESEND] Check whether pthread_sigmask is a simple macro
From: |
Pádraig Brady |
Subject: |
Re: [PATCH RESEND] Check whether pthread_sigmask is a simple macro |
Date: |
Mon, 01 Jun 2015 12:30:01 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 01/06/15 07:43, Pavel Fedin wrote:
> GNULib's pthread_sigmask() is configured and builds incorrectly on MinGW64.
> Configure
> script detects it as
> present, and this is technically correct, but:
> --- cut ---
> /* Windows has rudimentary signals support. */
> #define pthread_sigmask(H, S1, S2) 0
> --- cut ---
> (see
> http://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-libraries/winpthread
> s/include/pthread_signal.h)
>
> And this causes failure building gnulib's pthread_sigmask.c, because it
> tries to refer to
> original pthread_sigmask() after #undef'ing it.
> This patch recognizes that pthread_sigmask is a simple macro and there's no
> real function
> behind it, and in this case it produces the following settings:
> HAVE_PTHREAD_SIGMASK=0
> LIB_PTHREAD_SIGMASK=''
> REPLACE_PTHREAD_SIGMASK=1
> so that pthread_sigmask() is entirely emulated by GNULib.
>
> Related topic:
> http://lists.gnu.org/archive/html/bug-gnulib/2015-04/msg00065.html
>
> Signed-off-by: Pavel Fedin <address@hidden>
>
> m4/pthread_sigmask.m4 | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4
> index 5c17dfc..a974848 100644
> --- a/m4/pthread_sigmask.m4
> +++ b/m4/pthread_sigmask.m4
> @@ -40,6 +40,30 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK],
> LIBS="$gl_save_LIBS"
> ])
> if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
> + AC_CACHE_CHECK([whether pthread_sigmask is only a macro],
> + [gl_cv_func_pthread_sigmask_is_macro],
> + [gl_save_LIBS="$LIBS"
> + LIBS="$LIBS $LIBMULTITHREAD"
> + AC_LINK_IFELSE(
> + [AC_LANG_PROGRAM(
> + [[#include <pthread.h>
> + #include <signal.h>
> + #undef pthread_sigmask
> + ]],
> + [[return pthread_sigmask (0, (sigset_t *) 0, (sigset_t
> *) 0);]])
> + ],
> + [gl_cv_func_pthread_sigmask_is_macro=no],
> + [gl_cv_func_pthread_sigmask_is_macro=yes])
> + LIBS="$gl_save_LIBS"
> + ])
> + if test $gl_cv_func_pthread_sigmask_is_macro = yes; then
> + dnl On MinGW pthread_sigmask is just a macro which always
> return 0.
> + dnl It does not exist as a real function, which is required by
> POSIX.
> + REPLACE_PTHREAD_SIGMASK=1
> + gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no
> + fi
> + fi
> + if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
> dnl pthread_sigmask is available with -pthread or -lpthread.
> LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD"
> else
> --
> Kind regards,
> Pavel Fedin
> Expert Engineer
> Samsung Electronics Research center Russia
>
>
>
>
>
Pushed.
thanks,
Pádraig