diff options
| author | Paul Eggert | 2014-05-29 08:05:06 -0700 |
|---|---|---|
| committer | Paul Eggert | 2014-05-29 08:05:06 -0700 |
| commit | 035159ed54cf2e1abc0439fbb6e628c9223f8e5d (patch) | |
| tree | e99b3609d60f0bbda83dec913cf46cb5f32e2c6d /m4 | |
| parent | 0bbb27fc3f52f87605cfadba62d52b72523b73a5 (diff) | |
| download | emacs-035159ed54cf2e1abc0439fbb6e628c9223f8e5d.tar.gz emacs-035159ed54cf2e1abc0439fbb6e628c9223f8e5d.zip | |
Don't substitute sigprocmask for pthread_sigmask.
sigprocmask isn't portable in a multithreaded process.
* configure.ac (gl_THREADLIB): Remove dummy.
Merge from gnulib, incorporating:
2014-05-28 pthread_sigmask, timer-time: use gl_THREADLIB only if needed
* m4/pthread_sigmask.m4, m4/timer_time.m4: Update from gnulib.
* src/Makefile.in (LIB_PTHREAD_SIGMASK): Remove; all uses removed.
Fixes: debbugs:17561
Diffstat (limited to 'm4')
| -rw-r--r-- | m4/pthread_sigmask.m4 | 85 | ||||
| -rw-r--r-- | m4/timer_time.m4 | 39 |
2 files changed, 67 insertions, 57 deletions
diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4 index 4ba073231f9..2b3347f992d 100644 --- a/m4/pthread_sigmask.m4 +++ b/m4/pthread_sigmask.m4 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # pthread_sigmask.m4 serial 13 | 1 | # pthread_sigmask.m4 serial 14 |
| 2 | dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. |
| 3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
| @@ -97,39 +97,43 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK], | |||
| 97 | dnl with -lpthread, the pthread_sigmask() function always returns 0 and has | 97 | dnl with -lpthread, the pthread_sigmask() function always returns 0 and has |
| 98 | dnl no effect. | 98 | dnl no effect. |
| 99 | if test -z "$LIB_PTHREAD_SIGMASK"; then | 99 | if test -z "$LIB_PTHREAD_SIGMASK"; then |
| 100 | AC_CACHE_CHECK([whether pthread_sigmask works without -lpthread], | 100 | case " $LIBS " in |
| 101 | [gl_cv_func_pthread_sigmask_in_libc_works], | 101 | *' -lpthread '*) ;; |
| 102 | [ | 102 | *) |
| 103 | AC_RUN_IFELSE( | 103 | AC_CACHE_CHECK([whether pthread_sigmask works without -lpthread], |
| 104 | [AC_LANG_SOURCE([[ | 104 | [gl_cv_func_pthread_sigmask_in_libc_works], |
| 105 | #include <pthread.h> | 105 | [ |
| 106 | #include <signal.h> | 106 | AC_RUN_IFELSE( |
| 107 | #include <stddef.h> | 107 | [AC_LANG_SOURCE([[ |
| 108 | int main () | 108 | #include <pthread.h> |
| 109 | { | 109 | #include <signal.h> |
| 110 | sigset_t set; | 110 | #include <stddef.h> |
| 111 | sigemptyset (&set); | 111 | int main () |
| 112 | return pthread_sigmask (1729, &set, NULL) != 0; | 112 | { |
| 113 | }]])], | 113 | sigset_t set; |
| 114 | [gl_cv_func_pthread_sigmask_in_libc_works=no], | 114 | sigemptyset (&set); |
| 115 | [gl_cv_func_pthread_sigmask_in_libc_works=yes], | 115 | return pthread_sigmask (1729, &set, NULL) != 0; |
| 116 | [ | 116 | }]])], |
| 117 | changequote(,)dnl | 117 | [gl_cv_func_pthread_sigmask_in_libc_works=no], |
| 118 | case "$host_os" in | 118 | [gl_cv_func_pthread_sigmask_in_libc_works=yes], |
| 119 | freebsd* | hpux* | solaris | solaris2.[2-9]*) | 119 | [ |
| 120 | gl_cv_func_pthread_sigmask_in_libc_works="guessing no";; | 120 | changequote(,)dnl |
| 121 | *) | 121 | case "$host_os" in |
| 122 | gl_cv_func_pthread_sigmask_in_libc_works="guessing yes";; | 122 | freebsd* | hpux* | solaris | solaris2.[2-9]*) |
| 123 | esac | 123 | gl_cv_func_pthread_sigmask_in_libc_works="guessing no";; |
| 124 | changequote([,])dnl | 124 | *) |
| 125 | ]) | 125 | gl_cv_func_pthread_sigmask_in_libc_works="guessing yes";; |
| 126 | ]) | 126 | esac |
| 127 | case "$gl_cv_func_pthread_sigmask_in_libc_works" in | 127 | changequote([,])dnl |
| 128 | *no) | 128 | ]) |
| 129 | REPLACE_PTHREAD_SIGMASK=1 | 129 | ]) |
| 130 | AC_DEFINE([PTHREAD_SIGMASK_INEFFECTIVE], [1], | 130 | case "$gl_cv_func_pthread_sigmask_in_libc_works" in |
| 131 | [Define to 1 if pthread_sigmask() may returns 0 and have no effect.]) | 131 | *no) |
| 132 | ;; | 132 | REPLACE_PTHREAD_SIGMASK=1 |
| 133 | AC_DEFINE([PTHREAD_SIGMASK_INEFFECTIVE], [1], | ||
| 134 | [Define to 1 if pthread_sigmask may return 0 and have no effect.]) | ||
| 135 | ;; | ||
| 136 | esac;; | ||
| 133 | esac | 137 | esac |
| 134 | fi | 138 | fi |
| 135 | 139 | ||
| @@ -184,11 +188,12 @@ int main () | |||
| 184 | *) | 188 | *) |
| 185 | gl_cv_func_pthread_sigmask_unblock_works="guessing yes";; | 189 | gl_cv_func_pthread_sigmask_unblock_works="guessing yes";; |
| 186 | esac | 190 | esac |
| 187 | dnl Here we link against $LIBMULTITHREAD, not only $LIB_PTHREAD_SIGMASK, | 191 | m4_ifdef([gl_][THREADLIB], |
| 188 | dnl otherwise we get a false positive on those platforms where | 192 | [dnl Link against $LIBMULTITHREAD, not only $LIB_PTHREAD_SIGMASK. |
| 189 | dnl $gl_cv_func_pthread_sigmask_in_libc_works is "no". | 193 | dnl Otherwise we get a false positive on those platforms where |
| 190 | gl_save_LIBS="$LIBS" | 194 | dnl $gl_cv_func_pthread_sigmask_in_libc_works is "no". |
| 191 | LIBS="$LIBS $LIBMULTITHREAD" | 195 | gl_save_LIBS=$LIBS |
| 196 | LIBS="$LIBS $LIBMULTITHREAD"]) | ||
| 192 | AC_RUN_IFELSE( | 197 | AC_RUN_IFELSE( |
| 193 | [AC_LANG_SOURCE([[ | 198 | [AC_LANG_SOURCE([[ |
| 194 | #include <pthread.h> | 199 | #include <pthread.h> |
| @@ -227,7 +232,7 @@ int main () | |||
| 227 | [:], | 232 | [:], |
| 228 | [gl_cv_func_pthread_sigmask_unblock_works=no], | 233 | [gl_cv_func_pthread_sigmask_unblock_works=no], |
| 229 | [:]) | 234 | [:]) |
| 230 | LIBS="$gl_save_LIBS" | 235 | m4_ifdef([gl_][THREADLIB], [LIBS=$gl_save_LIBS]) |
| 231 | ]) | 236 | ]) |
| 232 | case "$gl_cv_func_pthread_sigmask_unblock_works" in | 237 | case "$gl_cv_func_pthread_sigmask_unblock_works" in |
| 233 | *no) | 238 | *no) |
diff --git a/m4/timer_time.m4 b/m4/timer_time.m4 index 8e2c921cbef..578ebe0809a 100644 --- a/m4/timer_time.m4 +++ b/m4/timer_time.m4 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # timer_time.m4 serial 2 | 1 | # timer_time.m4 serial 3 |
| 2 | dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. |
| 3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
| @@ -11,7 +11,12 @@ AC_DEFUN([gl_TIMER_TIME], | |||
| 11 | dnl Based on clock_time.m4. See details there. | 11 | dnl Based on clock_time.m4. See details there. |
| 12 | 12 | ||
| 13 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | 13 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
| 14 | AC_REQUIRE([gl_THREADLIB]) | 14 | |
| 15 | dnl Test whether the gnulib module 'threadlib' is in use. | ||
| 16 | dnl Some packages like Emacs use --avoid=threadlib. | ||
| 17 | dnl Write the symbol in such a way that it does not cause 'aclocal' to pick | ||
| 18 | dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/. | ||
| 19 | m4_ifdef([gl_][THREADLIB], [AC_REQUIRE([gl_][THREADLIB])]) | ||
| 15 | 20 | ||
| 16 | LIB_TIMER_TIME= | 21 | LIB_TIMER_TIME= |
| 17 | AC_SUBST([LIB_TIMER_TIME]) | 22 | AC_SUBST([LIB_TIMER_TIME]) |
| @@ -19,21 +24,21 @@ AC_DEFUN([gl_TIMER_TIME], | |||
| 19 | AC_SEARCH_LIBS([timer_settime], [rt posix4], | 24 | AC_SEARCH_LIBS([timer_settime], [rt posix4], |
| 20 | [test "$ac_cv_search_timer_settime" = "none required" || | 25 | [test "$ac_cv_search_timer_settime" = "none required" || |
| 21 | LIB_TIMER_TIME=$ac_cv_search_timer_settime]) | 26 | LIB_TIMER_TIME=$ac_cv_search_timer_settime]) |
| 22 | dnl GLIBC uses threads to emulate posix timers when kernel support | 27 | m4_ifdef([gl_][THREADLIB], |
| 23 | dnl is not available (like Linux < 2.6 or when used with kFreeBSD) | 28 | [dnl GLIBC uses threads to emulate posix timers when kernel support |
| 24 | dnl Now the pthread lib is linked automatically in the normal case, | 29 | dnl is not available (like Linux < 2.6 or when used with kFreeBSD) |
| 25 | dnl but when linking statically, it needs to be explicitly specified. | 30 | dnl Now the pthread lib is linked automatically in the normal case, |
| 26 | AC_EGREP_CPP([Thread], | 31 | dnl but when linking statically, it needs to be explicitly specified. |
| 27 | [ | 32 | AC_EGREP_CPP([Thread], |
| 28 | #include <features.h> | 33 | [#include <features.h> |
| 29 | #ifdef __GNU_LIBRARY__ | 34 | #ifdef __GNU_LIBRARY__ |
| 30 | #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \ | 35 | #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \ |
| 31 | && !(__UCLIBC__ && __HAS_NO_THREADS__) | 36 | && !(__UCLIBC__ && __HAS_NO_THREADS__) |
| 32 | Thread emulation available | 37 | Thread emulation available |
| 33 | #endif | 38 | #endif |
| 34 | #endif | 39 | #endif |
| 35 | ], | 40 | ], |
| 36 | [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"]) | 41 | [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"])]) |
| 37 | AC_CHECK_FUNCS([timer_settime]) | 42 | AC_CHECK_FUNCS([timer_settime]) |
| 38 | LIBS=$gl_saved_libs | 43 | LIBS=$gl_saved_libs |
| 39 | ]) | 44 | ]) |