On 07/18/11 18:05, Bruno Haible wrote: > it is more appropriate to merge patches together and remove reverted > patches from the history and the ChangeLog.
Here's a combined patch that should do that. It reflects my most recent proposal of leaving the dependencies alone. I took the liberty of using "diff -w" to generate it, as that makes the diff easier to read. If you prefer it in glorious whitespace-expanded form I can generate that too. diff --git a/ChangeLog b/ChangeLog index a521e9b..8c9851f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-07-19 Paul Eggert <[email protected]> + + pthread_sigmask: assume POSIX threads if not using threadlib + * m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): + Assume POSIX threads only if gl_THREADLIB is not defined. + Simplify the calculation of HAVE_PTHREAD_SIGMASK, by initially + setting it to 0 if the initial check fails, and setting it to 1 + if a later, fancier check works; this makes it easier to understand + the non-threadlib code. + 2011-07-16 Paul Eggert <[email protected]> pthread_sigmask: ensure usleep is declared diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4 index 3803988..4a4901f 100644 --- a/m4/pthread_sigmask.m4 +++ b/m4/pthread_sigmask.m4 @@ -1,4 +1,4 @@ -# pthread_sigmask.m4 serial 10 +# pthread_sigmask.m4 serial 12 dnl Copyright (C) 2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,16 +6,21 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK], [ - AC_REQUIRE([gl_THREADLIB]) - AC_CHECK_FUNCS_ONCE([pthread_sigmask]) + if test $ac_cv_func_pthread_sigmask != yes; then + HAVE_PTHREAD_SIGMASK=0 + fi LIB_PTHREAD_SIGMASK= + + m4_ifdef([gl_[]THREADLIB], [ + dnl Assume threadlib is in use if its main symbol is defined. + dnl Spell the symbol in a funny way, so that aclocal doesn't see it + dnl and define it for us even if we don't want it. + AC_REQUIRE([gl_[]THREADLIB]) if test "$gl_threads_api" = posix; then - if test $ac_cv_func_pthread_sigmask = yes; then - dnl pthread_sigmask is available without -lpthread. - : - else - if test -n "$LIBMULTITHREAD"; then + if test $ac_cv_func_pthread_sigmask != yes && + test -n "$LIBMULTITHREAD" + then AC_CACHE_CHECK([for pthread_sigmask in $LIBMULTITHREAD], [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD], [gl_save_LIBS="$LIBS" @@ -34,13 +39,8 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK], if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then dnl pthread_sigmask is available with -lpthread. LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD" - else - dnl pthread_sigmask is not available at all. - HAVE_PTHREAD_SIGMASK=0 + HAVE_PTHREAD_SIGMASK=1 fi - else - dnl pthread_sigmask is not available at all. - HAVE_PTHREAD_SIGMASK=0 fi fi else @@ -52,10 +52,31 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK], dnl link dependencies. if test $ac_cv_func_pthread_sigmask = yes; then REPLACE_PTHREAD_SIGMASK=1 - else - HAVE_PTHREAD_SIGMASK=0 fi fi + ],[ + dnl Assume threadlib is not in use. + dnl Assume POSIX.1-2008 (or later) semantics. Do not fiddle with + dnl compiler or linker options, since any application not + dnl already properly configured for threads is most likely single + dnl threaded and can use gnulib's sigprocmask-based substitute. + if test $ac_cv_func_pthread_sigmask = yes; then + AC_CACHE_CHECK([for pthread_sigmask with POSIX signature], + [gl_cv_func_pthread_sigmask_posix_signature], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <signal.h> + ]], + [[return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *) 0);]]) + ], + [gl_cv_func_pthread_sigmask_posix_signature=yes], + [gl_cv_func_pthread_sigmask_posix_signature=no])]) + if test "$gl_cv_func_pthread_sigmask_posix_signature" != yes; then + REPLACE_PTHREAD_SIGMASK=1 + fi + fi + ]) + AC_SUBST([LIB_PTHREAD_SIGMASK]) dnl We don't need a variable LTLIB_PTHREAD_SIGMASK, because when dnl "$gl_threads_api" = posix, $LTLIBMULTITHREAD and $LIBMULTITHREAD are the
