diff options
| author | Paul Eggert | 2011-07-08 13:20:19 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-07-08 13:20:19 -0700 |
| commit | 2a84b02da8b20138fad7fafdea92d7c8f0564ee0 (patch) | |
| tree | da64c1fd303aa85b53ad485779b05fbdd2685a28 /m4 | |
| parent | 1692ae2dd5ff8f6f1fc6f6f62b9a44ab7e615615 (diff) | |
| download | emacs-2a84b02da8b20138fad7fafdea92d7c8f0564ee0.tar.gz emacs-2a84b02da8b20138fad7fafdea92d7c8f0564ee0.zip | |
Simplify Emacs part of pthread_sigmask support.
* Makefile.in (GNULIB_TOOL_FLAGS): Do not avoid sigprocmask.
* configure.in (AC_TYPE_UID_T): New dummy macro.
Configure gnulib after adjusting LIBS,
so that gnulib can assume the libraries in LIBS.
* lib/pthread_sigmask.c, lib/sigprocmask.c, m4/signalblocking.m4:
New files, automatically imported from gnulib.
* lib/gnulib.mk, m4/gl-comp.m4: Regenerate.
* src/Makefile.in (LIB_PTHREAD_SIGMASK): New macro.
(LIBES): Use it.
Diffstat (limited to 'm4')
| -rw-r--r-- | m4/getopt.m4 | 83 | ||||
| -rw-r--r-- | m4/gl-comp.m4 | 25 | ||||
| -rw-r--r-- | m4/pthread_sigmask.m4 | 77 | ||||
| -rw-r--r-- | m4/signal_h.m4 | 3 | ||||
| -rw-r--r-- | m4/signalblocking.m4 | 25 |
5 files changed, 164 insertions, 49 deletions
diff --git a/m4/getopt.m4 b/m4/getopt.m4 index 4d8450ff907..7e49ddde9f6 100644 --- a/m4/getopt.m4 +++ b/m4/getopt.m4 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # getopt.m4 serial 35 | 1 | # getopt.m4 serial 38 |
| 2 | dnl Copyright (C) 2002-2006, 2008-2011 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2006, 2008-2011 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, |
| @@ -89,15 +89,15 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS], | |||
| 89 | AC_CACHE_CHECK([whether getopt is POSIX compatible], | 89 | AC_CACHE_CHECK([whether getopt is POSIX compatible], |
| 90 | [gl_cv_func_getopt_posix], | 90 | [gl_cv_func_getopt_posix], |
| 91 | [ | 91 | [ |
| 92 | dnl BSD getopt_long uses an incompatible method to reset | 92 | dnl BSD getopt_long uses an incompatible method to reset option |
| 93 | dnl option processing. Existence of the variable, in and of | 93 | dnl processing. Existence of the optreset variable, in and of |
| 94 | dnl itself, is not a reason to replace getopt, but knowledge | 94 | dnl itself, is not a reason to replace getopt, but knowledge |
| 95 | dnl of the variable is needed to determine how to reset and | 95 | dnl of the variable is needed to determine how to reset and |
| 96 | dnl whether a reset reparses the environment. Solaris | 96 | dnl whether a reset reparses the environment. Solaris |
| 97 | dnl supports neither optreset nor optind=0, but keeps no state | 97 | dnl supports neither optreset nor optind=0, but keeps no state |
| 98 | dnl that needs a reset beyond setting optind=1; detect Solaris | 98 | dnl that needs a reset beyond setting optind=1; detect Solaris |
| 99 | dnl by getopt_clip. | 99 | dnl by getopt_clip. |
| 100 | AC_COMPILE_IFELSE( | 100 | AC_LINK_IFELSE( |
| 101 | [AC_LANG_PROGRAM( | 101 | [AC_LANG_PROGRAM( |
| 102 | [[#include <unistd.h>]], | 102 | [[#include <unistd.h>]], |
| 103 | [[int *p = &optreset; return optreset;]])], | 103 | [[int *p = &optreset; return optreset;]])], |
| @@ -121,22 +121,20 @@ int | |||
| 121 | main () | 121 | main () |
| 122 | { | 122 | { |
| 123 | { | 123 | { |
| 124 | int argc = 0; | 124 | static char program[] = "program"; |
| 125 | char *argv[10]; | 125 | static char a[] = "-a"; |
| 126 | static char foo[] = "foo"; | ||
| 127 | static char bar[] = "bar"; | ||
| 128 | char *argv[] = { program, a, foo, bar, NULL }; | ||
| 126 | int c; | 129 | int c; |
| 127 | 130 | ||
| 128 | argv[argc++] = "program"; | ||
| 129 | argv[argc++] = "-a"; | ||
| 130 | argv[argc++] = "foo"; | ||
| 131 | argv[argc++] = "bar"; | ||
| 132 | argv[argc] = NULL; | ||
| 133 | optind = OPTIND_MIN; | 131 | optind = OPTIND_MIN; |
| 134 | opterr = 0; | 132 | opterr = 0; |
| 135 | 133 | ||
| 136 | c = getopt (argc, argv, "ab"); | 134 | c = getopt (4, argv, "ab"); |
| 137 | if (!(c == 'a')) | 135 | if (!(c == 'a')) |
| 138 | return 1; | 136 | return 1; |
| 139 | c = getopt (argc, argv, "ab"); | 137 | c = getopt (4, argv, "ab"); |
| 140 | if (!(c == -1)) | 138 | if (!(c == -1)) |
| 141 | return 2; | 139 | return 2; |
| 142 | if (!(optind == 2)) | 140 | if (!(optind == 2)) |
| @@ -144,22 +142,20 @@ main () | |||
| 144 | } | 142 | } |
| 145 | /* Some internal state exists at this point. */ | 143 | /* Some internal state exists at this point. */ |
| 146 | { | 144 | { |
| 147 | int argc = 0; | 145 | static char program[] = "program"; |
| 148 | char *argv[10]; | 146 | static char donald[] = "donald"; |
| 147 | static char p[] = "-p"; | ||
| 148 | static char billy[] = "billy"; | ||
| 149 | static char duck[] = "duck"; | ||
| 150 | static char a[] = "-a"; | ||
| 151 | static char bar[] = "bar"; | ||
| 152 | char *argv[] = { program, donald, p, billy, duck, a, bar, NULL }; | ||
| 149 | int c; | 153 | int c; |
| 150 | 154 | ||
| 151 | argv[argc++] = "program"; | ||
| 152 | argv[argc++] = "donald"; | ||
| 153 | argv[argc++] = "-p"; | ||
| 154 | argv[argc++] = "billy"; | ||
| 155 | argv[argc++] = "duck"; | ||
| 156 | argv[argc++] = "-a"; | ||
| 157 | argv[argc++] = "bar"; | ||
| 158 | argv[argc] = NULL; | ||
| 159 | optind = OPTIND_MIN; | 155 | optind = OPTIND_MIN; |
| 160 | opterr = 0; | 156 | opterr = 0; |
| 161 | 157 | ||
| 162 | c = getopt (argc, argv, "+abp:q:"); | 158 | c = getopt (7, argv, "+abp:q:"); |
| 163 | if (!(c == -1)) | 159 | if (!(c == -1)) |
| 164 | return 4; | 160 | return 4; |
| 165 | if (!(strcmp (argv[0], "program") == 0)) | 161 | if (!(strcmp (argv[0], "program") == 0)) |
| @@ -181,7 +177,9 @@ main () | |||
| 181 | } | 177 | } |
| 182 | /* Detect MacOS 10.5, AIX 7.1 bug. */ | 178 | /* Detect MacOS 10.5, AIX 7.1 bug. */ |
| 183 | { | 179 | { |
| 184 | char *argv[3] = { "program", "-ab", NULL }; | 180 | static char program[] = "program"; |
| 181 | static char ab[] = "-ab"; | ||
| 182 | char *argv[3] = { program, ab, NULL }; | ||
| 185 | optind = OPTIND_MIN; | 183 | optind = OPTIND_MIN; |
| 186 | opterr = 0; | 184 | opterr = 0; |
| 187 | if (getopt (2, argv, "ab:") != 'a') | 185 | if (getopt (2, argv, "ab:") != 'a') |
| @@ -239,19 +237,22 @@ dnl is ambiguous with environment values that contain newlines. | |||
| 239 | and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, | 237 | and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, |
| 240 | OSF/1 5.1, Solaris 10. */ | 238 | OSF/1 5.1, Solaris 10. */ |
| 241 | { | 239 | { |
| 242 | char *myargv[3]; | 240 | static char conftest[] = "conftest"; |
| 243 | myargv[0] = "conftest"; | 241 | static char plus[] = "-+"; |
| 244 | myargv[1] = "-+"; | 242 | char *argv[3] = { conftest, plus, NULL }; |
| 245 | myargv[2] = 0; | ||
| 246 | opterr = 0; | 243 | opterr = 0; |
| 247 | if (getopt (2, myargv, "+a") != '?') | 244 | if (getopt (2, argv, "+a") != '?') |
| 248 | result |= 1; | 245 | result |= 1; |
| 249 | } | 246 | } |
| 250 | /* This code succeeds on glibc 2.8, mingw, | 247 | /* This code succeeds on glibc 2.8, mingw, |
| 251 | and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, | 248 | and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, |
| 252 | IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ | 249 | IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ |
| 253 | { | 250 | { |
| 254 | char *argv[] = { "program", "-p", "foo", "bar", NULL }; | 251 | static char program[] = "program"; |
| 252 | static char p[] = "-p"; | ||
| 253 | static char foo[] = "foo"; | ||
| 254 | static char bar[] = "bar"; | ||
| 255 | char *argv[] = { program, p, foo, bar, NULL }; | ||
| 255 | 256 | ||
| 256 | optind = 1; | 257 | optind = 1; |
| 257 | if (getopt (4, argv, "p::") != 'p') | 258 | if (getopt (4, argv, "p::") != 'p') |
| @@ -265,7 +266,10 @@ dnl is ambiguous with environment values that contain newlines. | |||
| 265 | } | 266 | } |
| 266 | /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */ | 267 | /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */ |
| 267 | { | 268 | { |
| 268 | char *argv[] = { "program", "foo", "-p", NULL }; | 269 | static char program[] = "program"; |
| 270 | static char foo[] = "foo"; | ||
| 271 | static char p[] = "-p"; | ||
| 272 | char *argv[] = { program, foo, p, NULL }; | ||
| 269 | optind = 0; | 273 | optind = 0; |
| 270 | if (getopt (3, argv, "-p") != 1) | 274 | if (getopt (3, argv, "-p") != 1) |
| 271 | result |= 16; | 275 | result |= 16; |
| @@ -274,13 +278,26 @@ dnl is ambiguous with environment values that contain newlines. | |||
| 274 | } | 278 | } |
| 275 | /* This code fails on glibc 2.11. */ | 279 | /* This code fails on glibc 2.11. */ |
| 276 | { | 280 | { |
| 277 | char *argv[] = { "program", "-b", "-a", NULL }; | 281 | static char program[] = "program"; |
| 282 | static char b[] = "-b"; | ||
| 283 | static char a[] = "-a"; | ||
| 284 | char *argv[] = { program, b, a, NULL }; | ||
| 278 | optind = opterr = 0; | 285 | optind = opterr = 0; |
| 279 | if (getopt (3, argv, "+:a:b") != 'b') | 286 | if (getopt (3, argv, "+:a:b") != 'b') |
| 280 | result |= 64; | 287 | result |= 64; |
| 281 | else if (getopt (3, argv, "+:a:b") != ':') | 288 | else if (getopt (3, argv, "+:a:b") != ':') |
| 282 | result |= 64; | 289 | result |= 64; |
| 283 | } | 290 | } |
| 291 | /* This code dumps core on glibc 2.14. */ | ||
| 292 | { | ||
| 293 | static char program[] = "program"; | ||
| 294 | static char w[] = "-W"; | ||
| 295 | static char dummy[] = "dummy"; | ||
| 296 | char *argv[] = { program, w, dummy, NULL }; | ||
| 297 | optind = opterr = 1; | ||
| 298 | if (getopt (3, argv, "W;") != 'W') | ||
| 299 | result |= 128; | ||
| 300 | } | ||
| 284 | return result; | 301 | return result; |
| 285 | ]])], | 302 | ]])], |
| 286 | [gl_cv_func_getopt_gnu=yes], | 303 | [gl_cv_func_getopt_gnu=yes], |
diff --git a/m4/gl-comp.m4 b/m4/gl-comp.m4 index 004c01a10a0..6c94e373871 100644 --- a/m4/gl-comp.m4 +++ b/m4/gl-comp.m4 | |||
| @@ -55,6 +55,7 @@ AC_DEFUN([gl_EARLY], | |||
| 55 | # Code from module pthread_sigmask: | 55 | # Code from module pthread_sigmask: |
| 56 | # Code from module readlink: | 56 | # Code from module readlink: |
| 57 | # Code from module signal: | 57 | # Code from module signal: |
| 58 | # Code from module sigprocmask: | ||
| 58 | # Code from module socklen: | 59 | # Code from module socklen: |
| 59 | # Code from module ssize_t: | 60 | # Code from module ssize_t: |
| 60 | # Code from module stat: | 61 | # Code from module stat: |
| @@ -142,7 +143,10 @@ if test $REPLACE_MKTIME = 1; then | |||
| 142 | fi | 143 | fi |
| 143 | gl_TIME_MODULE_INDICATOR([mktime]) | 144 | gl_TIME_MODULE_INDICATOR([mktime]) |
| 144 | gl_MULTIARCH | 145 | gl_MULTIARCH |
| 145 | gl_PTHREAD_SIGMASK | 146 | gl_FUNC_PTHREAD_SIGMASK |
| 147 | if test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1; then | ||
| 148 | AC_LIBOBJ([pthread_sigmask]) | ||
| 149 | fi | ||
| 146 | gl_SIGNAL_MODULE_INDICATOR([pthread_sigmask]) | 150 | gl_SIGNAL_MODULE_INDICATOR([pthread_sigmask]) |
| 147 | gl_FUNC_READLINK | 151 | gl_FUNC_READLINK |
| 148 | if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then | 152 | if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then |
| @@ -184,6 +188,7 @@ AC_REQUIRE([AC_C_INLINE]) | |||
| 184 | gl_UNISTD_H | 188 | gl_UNISTD_H |
| 185 | gl_gnulib_enabled_dosname=false | 189 | gl_gnulib_enabled_dosname=false |
| 186 | gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false | 190 | gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false |
| 191 | gl_gnulib_enabled_sigprocmask=false | ||
| 187 | gl_gnulib_enabled_stat=false | 192 | gl_gnulib_enabled_stat=false |
| 188 | gl_gnulib_enabled_strtoull=false | 193 | gl_gnulib_enabled_strtoull=false |
| 189 | gl_gnulib_enabled_verify=false | 194 | gl_gnulib_enabled_verify=false |
| @@ -201,6 +206,18 @@ AC_SUBST([LTLIBINTL]) | |||
| 201 | gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=true | 206 | gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=true |
| 202 | fi | 207 | fi |
| 203 | } | 208 | } |
| 209 | func_gl_gnulib_m4code_sigprocmask () | ||
| 210 | { | ||
| 211 | if ! $gl_gnulib_enabled_sigprocmask; then | ||
| 212 | gl_SIGNALBLOCKING | ||
| 213 | if test $HAVE_POSIX_SIGNALBLOCKING = 0; then | ||
| 214 | AC_LIBOBJ([sigprocmask]) | ||
| 215 | gl_PREREQ_SIGPROCMASK | ||
| 216 | fi | ||
| 217 | gl_SIGNAL_MODULE_INDICATOR([sigprocmask]) | ||
| 218 | gl_gnulib_enabled_sigprocmask=true | ||
| 219 | fi | ||
| 220 | } | ||
| 204 | func_gl_gnulib_m4code_stat () | 221 | func_gl_gnulib_m4code_stat () |
| 205 | { | 222 | { |
| 206 | if ! $gl_gnulib_enabled_stat; then | 223 | if ! $gl_gnulib_enabled_stat; then |
| @@ -246,7 +263,7 @@ gl_STDLIB_MODULE_INDICATOR([strtoull]) | |||
| 246 | if test $REPLACE_LSTAT = 1; then | 263 | if test $REPLACE_LSTAT = 1; then |
| 247 | func_gl_gnulib_m4code_stat | 264 | func_gl_gnulib_m4code_stat |
| 248 | fi | 265 | fi |
| 249 | if test $REPLACE_PTHREAD_SIGMASK = 1; then | 266 | if test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1; then |
| 250 | func_gl_gnulib_m4code_sigprocmask | 267 | func_gl_gnulib_m4code_sigprocmask |
| 251 | fi | 268 | fi |
| 252 | if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then | 269 | if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then |
| @@ -261,6 +278,7 @@ gl_STDLIB_MODULE_INDICATOR([strtoull]) | |||
| 261 | m4_pattern_allow([^gl_GNULIB_ENABLED_]) | 278 | m4_pattern_allow([^gl_GNULIB_ENABLED_]) |
| 262 | AM_CONDITIONAL([gl_GNULIB_ENABLED_dosname], [$gl_gnulib_enabled_dosname]) | 279 | AM_CONDITIONAL([gl_GNULIB_ENABLED_dosname], [$gl_gnulib_enabled_dosname]) |
| 263 | AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], [$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36]) | 280 | AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], [$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36]) |
| 281 | AM_CONDITIONAL([gl_GNULIB_ENABLED_sigprocmask], [$gl_gnulib_enabled_sigprocmask]) | ||
| 264 | AM_CONDITIONAL([gl_GNULIB_ENABLED_stat], [$gl_gnulib_enabled_stat]) | 282 | AM_CONDITIONAL([gl_GNULIB_ENABLED_stat], [$gl_gnulib_enabled_stat]) |
| 265 | AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoull], [$gl_gnulib_enabled_strtoull]) | 283 | AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoull], [$gl_gnulib_enabled_strtoull]) |
| 266 | AM_CONDITIONAL([gl_GNULIB_ENABLED_verify], [$gl_gnulib_enabled_verify]) | 284 | AM_CONDITIONAL([gl_GNULIB_ENABLED_verify], [$gl_gnulib_enabled_verify]) |
| @@ -434,6 +452,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 434 | lib/md5.h | 452 | lib/md5.h |
| 435 | lib/mktime-internal.h | 453 | lib/mktime-internal.h |
| 436 | lib/mktime.c | 454 | lib/mktime.c |
| 455 | lib/pthread_sigmask.c | ||
| 437 | lib/readlink.c | 456 | lib/readlink.c |
| 438 | lib/sha1.c | 457 | lib/sha1.c |
| 439 | lib/sha1.h | 458 | lib/sha1.h |
| @@ -442,6 +461,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 442 | lib/sha512.c | 461 | lib/sha512.c |
| 443 | lib/sha512.h | 462 | lib/sha512.h |
| 444 | lib/signal.in.h | 463 | lib/signal.in.h |
| 464 | lib/sigprocmask.c | ||
| 445 | lib/stat.c | 465 | lib/stat.c |
| 446 | lib/stdarg.in.h | 466 | lib/stdarg.in.h |
| 447 | lib/stdbool.in.h | 467 | lib/stdbool.in.h |
| @@ -485,6 +505,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 485 | m4/sha256.m4 | 505 | m4/sha256.m4 |
| 486 | m4/sha512.m4 | 506 | m4/sha512.m4 |
| 487 | m4/signal_h.m4 | 507 | m4/signal_h.m4 |
| 508 | m4/signalblocking.m4 | ||
| 488 | m4/socklen.m4 | 509 | m4/socklen.m4 |
| 489 | m4/ssize_t.m4 | 510 | m4/ssize_t.m4 |
| 490 | m4/st_dm_mode.m4 | 511 | m4/st_dm_mode.m4 |
diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4 index d25e2cc3e70..dfa0f660a75 100644 --- a/m4/pthread_sigmask.m4 +++ b/m4/pthread_sigmask.m4 | |||
| @@ -1,26 +1,77 @@ | |||
| 1 | # pthread_sigmask.m4 serial 2 | 1 | # pthread_sigmask.m4 serial 7 |
| 2 | dnl Copyright (C) 2011 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2011 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, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
| 6 | 6 | ||
| 7 | AC_DEFUN([gl_PTHREAD_SIGMASK], | 7 | AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK], |
| 8 | [ | 8 | [ |
| 9 | AC_CHECK_FUNCS_ONCE([pthread_sigmask]) | ||
| 10 | LIB_PTHREAD_SIGMASK= | ||
| 9 | m4_ifdef([gl_THREADLIB], [ | 11 | m4_ifdef([gl_THREADLIB], [ |
| 10 | AC_REQUIRE([gl_THREADLIB]) | 12 | AC_REQUIRE([gl_THREADLIB]) |
| 11 | if test "$gl_threads_api" = posix; then | 13 | if test "$gl_threads_api" = posix; then |
| 12 | gl_save_LIBS="$LIBS" | 14 | if test $ac_cv_func_pthread_sigmask = yes; then |
| 13 | LIBS="$LIBS $LIBMULTITHREAD" | 15 | dnl pthread_sigmask is available without -lpthread. |
| 14 | AC_CHECK_FUNCS([pthread_sigmask]) | 16 | : |
| 15 | LIBS="$gl_save_LIBS" | 17 | else |
| 18 | if test -n "$LIBMULTITHREAD"; then | ||
| 19 | AC_CACHE_CHECK([for pthread_sigmask in $LIBMULTITHREAD], | ||
| 20 | [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD], | ||
| 21 | [gl_save_LIBS="$LIBS" | ||
| 22 | LIBS="$LIBS $LIBMULTITHREAD" | ||
| 23 | AC_LINK_IFELSE( | ||
| 24 | [AC_LANG_PROGRAM( | ||
| 25 | [[#include <pthread.h> | ||
| 26 | #include <signal.h> | ||
| 27 | ]], | ||
| 28 | [[return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *) 0);]]) | ||
| 29 | ], | ||
| 30 | [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=yes], | ||
| 31 | [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no]) | ||
| 32 | LIBS="$gl_save_LIBS" | ||
| 33 | ]) | ||
| 34 | if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then | ||
| 35 | dnl pthread_sigmask is available with -lpthread. | ||
| 36 | LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD" | ||
| 37 | else | ||
| 38 | dnl pthread_sigmask is not available at all. | ||
| 39 | HAVE_PTHREAD_SIGMASK=0 | ||
| 40 | fi | ||
| 41 | else | ||
| 42 | dnl pthread_sigmask is not available at all. | ||
| 43 | HAVE_PTHREAD_SIGMASK=0 | ||
| 44 | fi | ||
| 45 | fi | ||
| 16 | else | 46 | else |
| 17 | ac_cv_func_pthread_sigmask=no | 47 | dnl pthread_sigmask may exist but does not interoperate with the chosen |
| 48 | dnl multithreading facility. | ||
| 49 | dnl If "$gl_threads_api" = pth, we could use the function pth_sigmask, | ||
| 50 | dnl but it is equivalent to sigprocmask, so we choose to emulate | ||
| 51 | dnl pthread_sigmask with sigprocmask also in this case. This yields fewer | ||
| 52 | dnl link dependencies. | ||
| 53 | if test $ac_cv_func_pthread_sigmask = yes; then | ||
| 54 | REPLACE_PTHREAD_SIGMASK=1 | ||
| 55 | else | ||
| 56 | HAVE_PTHREAD_SIGMASK=0 | ||
| 57 | fi | ||
| 58 | fi | ||
| 59 | ] ,[ | ||
| 60 | dnl gl_THREADLIB is not in use. Assume the application wants | ||
| 61 | dnl POSIX semantics. | ||
| 62 | if test $ac_cv_func_pthread_sigmask != yes; then | ||
| 63 | gl_save_LIBS=$LIBS | ||
| 64 | AC_SEARCH_LIBS([pthread_sigmask], [pthread c_r]) | ||
| 65 | LIBS=$gl_save_LIBS | ||
| 66 | if test "$ac_cv_search_pthread_sigmask" = no; then | ||
| 67 | HAVE_PTHREAD_SIGMASK=0 | ||
| 68 | elif test "$ac_cv_search_pthread_sigmask" != 'none required'; then | ||
| 69 | LIB_PTHREAD_SIGMASK=$ac_cv_search_pthread_sigmask | ||
| 70 | fi | ||
| 18 | fi | 71 | fi |
| 19 | ], [ | ||
| 20 | AC_CHECK_FUNCS_ONCE([pthread_sigmask]) | ||
| 21 | ]) | 72 | ]) |
| 22 | 73 | AC_SUBST([LIB_PTHREAD_SIGMASK]) | |
| 23 | if test $ac_cv_func_pthread_sigmask = no; then | 74 | dnl We don't need a variable LTLIB_PTHREAD_SIGMASK, because when |
| 24 | REPLACE_PTHREAD_SIGMASK=1 | 75 | dnl "$gl_threads_api" = posix, $LTLIBMULTITHREAD and $LIBMULTITHREAD are the |
| 25 | fi | 76 | dnl same: either both empty or both "-lpthread". |
| 26 | ]) | 77 | ]) |
diff --git a/m4/signal_h.m4 b/m4/signal_h.m4 index 53972fba54f..b9536fb0e3c 100644 --- a/m4/signal_h.m4 +++ b/m4/signal_h.m4 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # signal_h.m4 serial 14 | 1 | # signal_h.m4 serial 16 |
| 2 | dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007-2011 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, |
| @@ -64,6 +64,7 @@ AC_DEFUN([gl_SIGNAL_H_DEFAULTS], | |||
| 64 | GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION]) | 64 | GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION]) |
| 65 | dnl Assume proper GNU behavior unless another module says otherwise. | 65 | dnl Assume proper GNU behavior unless another module says otherwise. |
| 66 | HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING]) | 66 | HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING]) |
| 67 | HAVE_PTHREAD_SIGMASK=1; AC_SUBST([HAVE_PTHREAD_SIGMASK]) | ||
| 67 | HAVE_SIGSET_T=1; AC_SUBST([HAVE_SIGSET_T]) | 68 | HAVE_SIGSET_T=1; AC_SUBST([HAVE_SIGSET_T]) |
| 68 | HAVE_SIGINFO_T=1; AC_SUBST([HAVE_SIGINFO_T]) | 69 | HAVE_SIGINFO_T=1; AC_SUBST([HAVE_SIGINFO_T]) |
| 69 | HAVE_SIGACTION=1; AC_SUBST([HAVE_SIGACTION]) | 70 | HAVE_SIGACTION=1; AC_SUBST([HAVE_SIGACTION]) |
diff --git a/m4/signalblocking.m4 b/m4/signalblocking.m4 new file mode 100644 index 00000000000..15b74253ba6 --- /dev/null +++ b/m4/signalblocking.m4 | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | # signalblocking.m4 serial 12 | ||
| 2 | dnl Copyright (C) 2001-2002, 2006-2011 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | # Determine available signal blocking primitives. Three different APIs exist: | ||
| 8 | # 1) POSIX: sigemptyset, sigaddset, sigprocmask | ||
| 9 | # 2) SYSV: sighold, sigrelse | ||
| 10 | # 3) BSD: sigblock, sigsetmask | ||
| 11 | # For simplicity, here we check only for the POSIX signal blocking. | ||
| 12 | AC_DEFUN([gl_SIGNALBLOCKING], | ||
| 13 | [ | ||
| 14 | AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) | ||
| 15 | AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T]) | ||
| 16 | if test $gl_cv_type_sigset_t = yes; then | ||
| 17 | AC_CHECK_FUNC([sigprocmask], [gl_cv_func_sigprocmask=1]) | ||
| 18 | fi | ||
| 19 | if test -z "$gl_cv_func_sigprocmask"; then | ||
| 20 | HAVE_POSIX_SIGNALBLOCKING=0 | ||
| 21 | fi | ||
| 22 | ]) | ||
| 23 | |||
| 24 | # Prerequisites of lib/sigprocmask.c. | ||
| 25 | AC_DEFUN([gl_PREREQ_SIGPROCMASK], [:]) | ||