aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2011-07-06 10:58:37 -0700
committerPaul Eggert2011-07-06 10:58:37 -0700
commit6db30f83447f4667d2ca84c33979f2745ca96bd5 (patch)
tree9304b3fb361c6aa6f0b3274efbe0fdc379785b68
parent84e04a29b9fddf5c5ede9873aa0356cd13af6f41 (diff)
downloademacs-6db30f83447f4667d2ca84c33979f2745ca96bd5.tar.gz
emacs-6db30f83447f4667d2ca84c33979f2745ca96bd5.zip
Add gnulib support for pthread_sigmask.
* Makefile.in (GNULIB_MODULES): Add pthread_sigmask. (GNULIB_TOOL_FLAGS): Avoid sigprocmask. Emacs does its own implementation of 'sigprocmask' on Windows, and it assumes 'sigprocmask' on non-Windows hosts, so it doesn't need the sigprocmask module. * lib/signal.in.h, m4/pthread_sigmask.m4, m4/signal_h.m4: New files, automatically imported from gnulib. * lib/gnulib.mk, m4/gl-comp.m4: Automatically-imported update due to the above changes. * .bzrignore: Add lib/signal.h.
-rw-r--r--ChangeLog14
-rw-r--r--Makefile.in4
-rw-r--r--lib/gnulib.mk40
-rw-r--r--lib/signal.in.h392
-rw-r--r--m4/gl-comp.m411
-rw-r--r--m4/pthread_sigmask.m426
-rw-r--r--m4/signal_h.m476
7 files changed, 561 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 19dcf6818e3..0d69b94943e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
12011-07-06 Paul Eggert <eggert@cs.ucla.edu>
2
3 Add gnulib support for pthread_sigmask.
4 * Makefile.in (GNULIB_MODULES): Add pthread_sigmask.
5 (GNULIB_TOOL_FLAGS): Avoid sigprocmask. Emacs does its own
6 implementation of 'sigprocmask' on Windows, and it assumes
7 'sigprocmask' on non-Windows hosts, so it doesn't need the
8 sigprocmask module.
9 * lib/signal.in.h, m4/pthread_sigmask.m4, m4/signal_h.m4:
10 New files, automatically imported from gnulib.
11 * lib/gnulib.mk, m4/gl-comp.m4: Automatically-imported update
12 due to the above changes.
13 * .bzrignore: Add lib/signal.h.
14
12011-07-05 Jan Djärv <jan.h.d@swipnet.se> 152011-07-05 Jan Djärv <jan.h.d@swipnet.se>
2 16
3 * configure.in (HAVE_GCONF): Allow both HAVE_GCONF and HAVE_GSETTINGS. 17 * configure.in (HAVE_GCONF): Allow both HAVE_GCONF and HAVE_GSETTINGS.
diff --git a/Makefile.in b/Makefile.in
index 457b5d6472e..07a2c6a017d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -335,9 +335,11 @@ GNULIB_MODULES = \
335 alloca-opt \ 335 alloca-opt \
336 careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr \ 336 careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr \
337 dup2 \ 337 dup2 \
338 filemode getloadavg getopt-gnu ignore-value intprops lstat mktime readlink \ 338 filemode getloadavg getopt-gnu ignore-value intprops lstat \
339 mktime pthread_sigmask readlink \
339 socklen stdarg stdio strftime strtoumax symlink sys_stat 340 socklen stdarg stdio strftime strtoumax symlink sys_stat
340GNULIB_TOOL_FLAGS = \ 341GNULIB_TOOL_FLAGS = \
342 --avoid=sigprocmask \
341 --conditional-dependencies --import --no-changelog --no-vc-files \ 343 --conditional-dependencies --import --no-changelog --no-vc-files \
342 --makefile-name=gnulib.mk 344 --makefile-name=gnulib.mk
343sync-from-gnulib: $(gnulib_srcdir) 345sync-from-gnulib: $(gnulib_srcdir)
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index 18abe4536fa..88a7919b7af 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -9,7 +9,7 @@
9# the same distribution terms as the rest of that program. 9# the same distribution terms as the rest of that program.
10# 10#
11# Generated by gnulib-tool. 11# Generated by gnulib-tool.
12# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dup2 filemode getloadavg getopt-gnu ignore-value intprops lstat mktime readlink socklen stdarg stdio strftime strtoumax symlink sys_stat 12# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --avoid=sigprocmask --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dup2 filemode getloadavg getopt-gnu ignore-value intprops lstat mktime pthread_sigmask readlink socklen stdarg stdio strftime strtoumax symlink sys_stat
13 13
14 14
15MOSTLYCLEANFILES += core *.stackdump 15MOSTLYCLEANFILES += core *.stackdump
@@ -303,6 +303,44 @@ EXTRA_libgnu_a_SOURCES += readlink.c
303 303
304## end gnulib module readlink 304## end gnulib module readlink
305 305
306## begin gnulib module signal
307
308BUILT_SOURCES += signal.h
309
310# We need the following in order to create <signal.h> when the system
311# doesn't have a complete one.
312signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
313 $(AM_V_GEN)rm -f $@-t $@ && \
314 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
315 sed -e 's|@''GUARD_PREFIX''@|GL|g' \
316 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
317 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
318 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
319 -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \
320 -e 's|@''GNULIB_PTHREAD_SIGMASK''@|$(GNULIB_PTHREAD_SIGMASK)|g' \
321 -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GNULIB_SIGNAL_H_SIGPIPE)/g' \
322 -e 's/@''GNULIB_SIGPROCMASK''@/$(GNULIB_SIGPROCMASK)/g' \
323 -e 's/@''GNULIB_SIGACTION''@/$(GNULIB_SIGACTION)/g' \
324 -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \
325 -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \
326 -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \
327 -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \
328 -e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \
329 -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \
330 -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \
331 -e 's|@''REPLACE_PTHREAD_SIGMASK''@|$(REPLACE_PTHREAD_SIGMASK)|g' \
332 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
333 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
334 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
335 < $(srcdir)/signal.in.h; \
336 } > $@-t && \
337 mv $@-t $@
338MOSTLYCLEANFILES += signal.h signal.h-t
339
340EXTRA_DIST += signal.in.h
341
342## end gnulib module signal
343
306## begin gnulib module stat 344## begin gnulib module stat
307 345
308if gl_GNULIB_ENABLED_stat 346if gl_GNULIB_ENABLED_stat
diff --git a/lib/signal.in.h b/lib/signal.in.h
new file mode 100644
index 00000000000..01987a7aff1
--- /dev/null
+++ b/lib/signal.in.h
@@ -0,0 +1,392 @@
1/* A GNU-like <signal.h>.
2
3 Copyright (C) 2006-2011 Free Software Foundation, Inc.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
18#if __GNUC__ >= 3
19@PRAGMA_SYSTEM_HEADER@
20#endif
21@PRAGMA_COLUMNS@
22
23#if defined __need_sig_atomic_t || defined __need_sigset_t
24/* Special invocation convention inside glibc header files. */
25
26# @INCLUDE_NEXT@ @NEXT_SIGNAL_H@
27
28#else
29/* Normal invocation convention. */
30
31#ifndef _@GUARD_PREFIX@_SIGNAL_H
32
33/* Define pid_t, uid_t.
34 Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.
35 On Solaris 10, <signal.h> includes <sys/types.h>, which eventually includes
36 us; so include <sys/types.h> now, before the second inclusion guard. */
37#include <sys/types.h>
38
39/* The include_next requires a split double-inclusion guard. */
40#@INCLUDE_NEXT@ @NEXT_SIGNAL_H@
41
42#ifndef _@GUARD_PREFIX@_SIGNAL_H
43#define _@GUARD_PREFIX@_SIGNAL_H
44
45/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
46
47/* The definition of _GL_ARG_NONNULL is copied here. */
48
49/* The definition of _GL_WARN_ON_USE is copied here. */
50
51/* On AIX, sig_atomic_t already includes volatile. C99 requires that
52 'volatile sig_atomic_t' ignore the extra modifier, but C89 did not.
53 Hence, redefine this to a non-volatile type as needed. */
54#if ! @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
55# if !GNULIB_defined_sig_atomic_t
56typedef int rpl_sig_atomic_t;
57# undef sig_atomic_t
58# define sig_atomic_t rpl_sig_atomic_t
59# define GNULIB_defined_sig_atomic_t 1
60# endif
61#endif
62
63/* A set or mask of signals. */
64#if !@HAVE_SIGSET_T@
65# if !GNULIB_defined_sigset_t
66typedef unsigned int sigset_t;
67# define GNULIB_defined_sigset_t 1
68# endif
69#endif
70
71/* Define sighandler_t, the type of signal handlers. A GNU extension. */
72#if !@HAVE_SIGHANDLER_T@
73# ifdef __cplusplus
74extern "C" {
75# endif
76# if !GNULIB_defined_sighandler_t
77typedef void (*sighandler_t) (int);
78# define GNULIB_defined_sighandler_t 1
79# endif
80# ifdef __cplusplus
81}
82# endif
83#endif
84
85
86#if @GNULIB_SIGNAL_H_SIGPIPE@
87# ifndef SIGPIPE
88/* Define SIGPIPE to a value that does not overlap with other signals. */
89# define SIGPIPE 13
90# define GNULIB_defined_SIGPIPE 1
91/* To actually use SIGPIPE, you also need the gnulib modules 'sigprocmask',
92 'write', 'stdio'. */
93# endif
94#endif
95
96
97/* Maximum signal number + 1. */
98#ifndef NSIG
99# if defined __TANDEM
100# define NSIG 32
101# endif
102#endif
103
104
105#if @GNULIB_PTHREAD_SIGMASK@
106# if @REPLACE_PTHREAD_SIGMASK@
107# undef pthread_sigmask
108# define pthread_sigmask sigprocmask
109# endif
110#elif defined GNULIB_POSIXCHECK
111# undef pthread_sigmask
112# if HAVE_RAW_DECL_PTHREAD_SIGMASK
113_GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - "
114 "use gnulib module pthread_sigmask for portability");
115# endif
116#endif
117
118
119#if @GNULIB_SIGPROCMASK@
120# if !@HAVE_POSIX_SIGNALBLOCKING@
121
122/* Maximum signal number + 1. */
123# ifndef NSIG
124# define NSIG 32
125# endif
126
127/* This code supports only 32 signals. */
128# if !GNULIB_defined_verify_NSIG_constraint
129typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
130# define GNULIB_defined_verify_NSIG_constraint 1
131# endif
132
133# endif
134
135/* Test whether a given signal is contained in a signal set. */
136# if @HAVE_POSIX_SIGNALBLOCKING@
137/* This function is defined as a macro on MacOS X. */
138# if defined __cplusplus && defined GNULIB_NAMESPACE
139# undef sigismember
140# endif
141# else
142_GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig)
143 _GL_ARG_NONNULL ((1)));
144# endif
145_GL_CXXALIAS_SYS (sigismember, int, (const sigset_t *set, int sig));
146_GL_CXXALIASWARN (sigismember);
147
148/* Initialize a signal set to the empty set. */
149# if @HAVE_POSIX_SIGNALBLOCKING@
150/* This function is defined as a macro on MacOS X. */
151# if defined __cplusplus && defined GNULIB_NAMESPACE
152# undef sigemptyset
153# endif
154# else
155_GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
156# endif
157_GL_CXXALIAS_SYS (sigemptyset, int, (sigset_t *set));
158_GL_CXXALIASWARN (sigemptyset);
159
160/* Add a signal to a signal set. */
161# if @HAVE_POSIX_SIGNALBLOCKING@
162/* This function is defined as a macro on MacOS X. */
163# if defined __cplusplus && defined GNULIB_NAMESPACE
164# undef sigaddset
165# endif
166# else
167_GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig)
168 _GL_ARG_NONNULL ((1)));
169# endif
170_GL_CXXALIAS_SYS (sigaddset, int, (sigset_t *set, int sig));
171_GL_CXXALIASWARN (sigaddset);
172
173/* Remove a signal from a signal set. */
174# if @HAVE_POSIX_SIGNALBLOCKING@
175/* This function is defined as a macro on MacOS X. */
176# if defined __cplusplus && defined GNULIB_NAMESPACE
177# undef sigdelset
178# endif
179# else
180_GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig)
181 _GL_ARG_NONNULL ((1)));
182# endif
183_GL_CXXALIAS_SYS (sigdelset, int, (sigset_t *set, int sig));
184_GL_CXXALIASWARN (sigdelset);
185
186/* Fill a signal set with all possible signals. */
187# if @HAVE_POSIX_SIGNALBLOCKING@
188/* This function is defined as a macro on MacOS X. */
189# if defined __cplusplus && defined GNULIB_NAMESPACE
190# undef sigfillset
191# endif
192# else
193_GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
194# endif
195_GL_CXXALIAS_SYS (sigfillset, int, (sigset_t *set));
196_GL_CXXALIASWARN (sigfillset);
197
198/* Return the set of those blocked signals that are pending. */
199# if !@HAVE_POSIX_SIGNALBLOCKING@
200_GL_FUNCDECL_SYS (sigpending, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
201# endif
202_GL_CXXALIAS_SYS (sigpending, int, (sigset_t *set));
203_GL_CXXALIASWARN (sigpending);
204
205/* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET.
206 Then, if SET is not NULL, affect the current set of blocked signals by
207 combining it with *SET as indicated in OPERATION.
208 In this implementation, you are not allowed to change a signal handler
209 while the signal is blocked. */
210# if !@HAVE_POSIX_SIGNALBLOCKING@
211# define SIG_BLOCK 0 /* blocked_set = blocked_set | *set; */
212# define SIG_SETMASK 1 /* blocked_set = *set; */
213# define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */
214_GL_FUNCDECL_SYS (sigprocmask, int,
215 (int operation, const sigset_t *set, sigset_t *old_set));
216# endif
217_GL_CXXALIAS_SYS (sigprocmask, int,
218 (int operation, const sigset_t *set, sigset_t *old_set));
219_GL_CXXALIASWARN (sigprocmask);
220
221/* Install the handler FUNC for signal SIG, and return the previous
222 handler. */
223# ifdef __cplusplus
224extern "C" {
225# endif
226# if !GNULIB_defined_function_taking_int_returning_void_t
227typedef void (*_gl_function_taking_int_returning_void_t) (int);
228# define GNULIB_defined_function_taking_int_returning_void_t 1
229# endif
230# ifdef __cplusplus
231}
232# endif
233# if !@HAVE_POSIX_SIGNALBLOCKING@
234# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
235# define signal rpl_signal
236# endif
237_GL_FUNCDECL_RPL (signal, _gl_function_taking_int_returning_void_t,
238 (int sig, _gl_function_taking_int_returning_void_t func));
239_GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t,
240 (int sig, _gl_function_taking_int_returning_void_t func));
241# else
242_GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t,
243 (int sig, _gl_function_taking_int_returning_void_t func));
244# endif
245_GL_CXXALIASWARN (signal);
246
247/* Raise signal SIG. */
248# if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE
249# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
250# undef raise
251# define raise rpl_raise
252# endif
253_GL_FUNCDECL_RPL (raise, int, (int sig));
254_GL_CXXALIAS_RPL (raise, int, (int sig));
255# else
256_GL_CXXALIAS_SYS (raise, int, (int sig));
257# endif
258_GL_CXXALIASWARN (raise);
259
260#elif defined GNULIB_POSIXCHECK
261# undef sigaddset
262# if HAVE_RAW_DECL_SIGADDSET
263_GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - "
264 "use the gnulib module sigprocmask for portability");
265# endif
266# undef sigdelset
267# if HAVE_RAW_DECL_SIGDELSET
268_GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - "
269 "use the gnulib module sigprocmask for portability");
270# endif
271# undef sigemptyset
272# if HAVE_RAW_DECL_SIGEMPTYSET
273_GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - "
274 "use the gnulib module sigprocmask for portability");
275# endif
276# undef sigfillset
277# if HAVE_RAW_DECL_SIGFILLSET
278_GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - "
279 "use the gnulib module sigprocmask for portability");
280# endif
281# undef sigismember
282# if HAVE_RAW_DECL_SIGISMEMBER
283_GL_WARN_ON_USE (sigismember, "sigismember is unportable - "
284 "use the gnulib module sigprocmask for portability");
285# endif
286# undef sigpending
287# if HAVE_RAW_DECL_SIGPENDING
288_GL_WARN_ON_USE (sigpending, "sigpending is unportable - "
289 "use the gnulib module sigprocmask for portability");
290# endif
291# undef sigprocmask
292# if HAVE_RAW_DECL_SIGPROCMASK
293_GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - "
294 "use the gnulib module sigprocmask for portability");
295# endif
296#endif /* @GNULIB_SIGPROCMASK@ */
297
298
299#if @GNULIB_SIGACTION@
300# if !@HAVE_SIGACTION@
301
302# if !@HAVE_SIGINFO_T@
303
304# if !GNULIB_defined_siginfo_types
305
306/* Present to allow compilation, but unsupported by gnulib. */
307union sigval
308{
309 int sival_int;
310 void *sival_ptr;
311};
312
313/* Present to allow compilation, but unsupported by gnulib. */
314struct siginfo_t
315{
316 int si_signo;
317 int si_code;
318 int si_errno;
319 pid_t si_pid;
320 uid_t si_uid;
321 void *si_addr;
322 int si_status;
323 long si_band;
324 union sigval si_value;
325};
326typedef struct siginfo_t siginfo_t;
327
328# define GNULIB_defined_siginfo_types 1
329# endif
330
331# endif /* !@HAVE_SIGINFO_T@ */
332
333/* We assume that platforms which lack the sigaction() function also lack
334 the 'struct sigaction' type, and vice versa. */
335
336# if !GNULIB_defined_struct_sigaction
337
338struct sigaction
339{
340 union
341 {
342 void (*_sa_handler) (int);
343 /* Present to allow compilation, but unsupported by gnulib. POSIX
344 says that implementations may, but not must, make sa_sigaction
345 overlap with sa_handler, but we know of no implementation where
346 they do not overlap. */
347 void (*_sa_sigaction) (int, siginfo_t *, void *);
348 } _sa_func;
349 sigset_t sa_mask;
350 /* Not all POSIX flags are supported. */
351 int sa_flags;
352};
353# define sa_handler _sa_func._sa_handler
354# define sa_sigaction _sa_func._sa_sigaction
355/* Unsupported flags are not present. */
356# define SA_RESETHAND 1
357# define SA_NODEFER 2
358# define SA_RESTART 4
359
360# define GNULIB_defined_struct_sigaction 1
361# endif
362
363_GL_FUNCDECL_SYS (sigaction, int, (int, const struct sigaction *restrict,
364 struct sigaction *restrict));
365
366# elif !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@
367
368# define sa_sigaction sa_handler
369
370# endif /* !@HAVE_SIGACTION@, !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ */
371
372_GL_CXXALIAS_SYS (sigaction, int, (int, const struct sigaction *restrict,
373 struct sigaction *restrict));
374_GL_CXXALIASWARN (sigaction);
375
376#elif defined GNULIB_POSIXCHECK
377# undef sigaction
378# if HAVE_RAW_DECL_SIGACTION
379_GL_WARN_ON_USE (sigaction, "sigaction is unportable - "
380 "use the gnulib module sigaction for portability");
381# endif
382#endif
383
384/* Some systems don't have SA_NODEFER. */
385#ifndef SA_NODEFER
386# define SA_NODEFER 0
387#endif
388
389
390#endif /* _@GUARD_PREFIX@_SIGNAL_H */
391#endif /* _@GUARD_PREFIX@_SIGNAL_H */
392#endif
diff --git a/m4/gl-comp.m4 b/m4/gl-comp.m4
index 16bb02e686f..004c01a10a0 100644
--- a/m4/gl-comp.m4
+++ b/m4/gl-comp.m4
@@ -52,7 +52,9 @@ AC_DEFUN([gl_EARLY],
52 # Code from module lstat: 52 # Code from module lstat:
53 # Code from module mktime: 53 # Code from module mktime:
54 # Code from module multiarch: 54 # Code from module multiarch:
55 # Code from module pthread_sigmask:
55 # Code from module readlink: 56 # Code from module readlink:
57 # Code from module signal:
56 # Code from module socklen: 58 # Code from module socklen:
57 # Code from module ssize_t: 59 # Code from module ssize_t:
58 # Code from module stat: 60 # Code from module stat:
@@ -140,12 +142,15 @@ if test $REPLACE_MKTIME = 1; then
140fi 142fi
141gl_TIME_MODULE_INDICATOR([mktime]) 143gl_TIME_MODULE_INDICATOR([mktime])
142gl_MULTIARCH 144gl_MULTIARCH
145gl_PTHREAD_SIGMASK
146gl_SIGNAL_MODULE_INDICATOR([pthread_sigmask])
143gl_FUNC_READLINK 147gl_FUNC_READLINK
144if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then 148if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
145 AC_LIBOBJ([readlink]) 149 AC_LIBOBJ([readlink])
146 gl_PREREQ_READLINK 150 gl_PREREQ_READLINK
147fi 151fi
148gl_UNISTD_MODULE_INDICATOR([readlink]) 152gl_UNISTD_MODULE_INDICATOR([readlink])
153gl_SIGNAL_H
149gl_TYPE_SOCKLEN_T 154gl_TYPE_SOCKLEN_T
150gt_TYPE_SSIZE_T 155gt_TYPE_SSIZE_T
151gl_STDARG_H 156gl_STDARG_H
@@ -241,6 +246,9 @@ gl_STDLIB_MODULE_INDICATOR([strtoull])
241 if test $REPLACE_LSTAT = 1; then 246 if test $REPLACE_LSTAT = 1; then
242 func_gl_gnulib_m4code_stat 247 func_gl_gnulib_m4code_stat
243 fi 248 fi
249 if test $REPLACE_PTHREAD_SIGMASK = 1; then
250 func_gl_gnulib_m4code_sigprocmask
251 fi
244 if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then 252 if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
245 func_gl_gnulib_m4code_stat 253 func_gl_gnulib_m4code_stat
246 fi 254 fi
@@ -433,6 +441,7 @@ AC_DEFUN([gl_FILE_LIST], [
433 lib/sha256.h 441 lib/sha256.h
434 lib/sha512.c 442 lib/sha512.c
435 lib/sha512.h 443 lib/sha512.h
444 lib/signal.in.h
436 lib/stat.c 445 lib/stat.c
437 lib/stdarg.in.h 446 lib/stdarg.in.h
438 lib/stdbool.in.h 447 lib/stdbool.in.h
@@ -470,10 +479,12 @@ AC_DEFUN([gl_FILE_LIST], [
470 m4/md5.m4 479 m4/md5.m4
471 m4/mktime.m4 480 m4/mktime.m4
472 m4/multiarch.m4 481 m4/multiarch.m4
482 m4/pthread_sigmask.m4
473 m4/readlink.m4 483 m4/readlink.m4
474 m4/sha1.m4 484 m4/sha1.m4
475 m4/sha256.m4 485 m4/sha256.m4
476 m4/sha512.m4 486 m4/sha512.m4
487 m4/signal_h.m4
477 m4/socklen.m4 488 m4/socklen.m4
478 m4/ssize_t.m4 489 m4/ssize_t.m4
479 m4/st_dm_mode.m4 490 m4/st_dm_mode.m4
diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4
new file mode 100644
index 00000000000..d25e2cc3e70
--- /dev/null
+++ b/m4/pthread_sigmask.m4
@@ -0,0 +1,26 @@
1# pthread_sigmask.m4 serial 2
2dnl Copyright (C) 2011 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_PTHREAD_SIGMASK],
8[
9 m4_ifdef([gl_THREADLIB], [
10 AC_REQUIRE([gl_THREADLIB])
11 if test "$gl_threads_api" = posix; then
12 gl_save_LIBS="$LIBS"
13 LIBS="$LIBS $LIBMULTITHREAD"
14 AC_CHECK_FUNCS([pthread_sigmask])
15 LIBS="$gl_save_LIBS"
16 else
17 ac_cv_func_pthread_sigmask=no
18 fi
19 ], [
20 AC_CHECK_FUNCS_ONCE([pthread_sigmask])
21 ])
22
23 if test $ac_cv_func_pthread_sigmask = no; then
24 REPLACE_PTHREAD_SIGMASK=1
25 fi
26])
diff --git a/m4/signal_h.m4 b/m4/signal_h.m4
new file mode 100644
index 00000000000..53972fba54f
--- /dev/null
+++ b/m4/signal_h.m4
@@ -0,0 +1,76 @@
1# signal_h.m4 serial 14
2dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_SIGNAL_H],
8[
9 AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
10 AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T])
11 gl_NEXT_HEADERS([signal.h])
12
13# AIX declares sig_atomic_t to already include volatile, and C89 compilers
14# then choke on 'volatile sig_atomic_t'. C99 requires that it compile.
15 AC_CHECK_TYPE([volatile sig_atomic_t], [],
16 [HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0], [[
17#include <signal.h>
18 ]])
19
20 AC_REQUIRE([AC_TYPE_UID_T])
21
22 dnl Persuade glibc <signal.h> to define sighandler_t.
23 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
24 AC_CHECK_TYPE([sighandler_t], [], [HAVE_SIGHANDLER_T=0], [[
25#include <signal.h>
26 ]])
27
28 dnl Check for declarations of anything we want to poison if the
29 dnl corresponding gnulib module is not in use.
30 gl_WARN_ON_USE_PREPARE([[#include <signal.h>
31 ]], [pthread_sigmask sigaction
32 sigaddset sigdelset sigemptyset sigfillset sigismember
33 sigpending sigprocmask])
34])
35
36AC_DEFUN([gl_CHECK_TYPE_SIGSET_T],
37[
38 AC_CHECK_TYPES([sigset_t],
39 [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no],
40 [[
41 #include <signal.h>
42 /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */
43 #include <sys/types.h>
44 ]])
45 if test $gl_cv_type_sigset_t != yes; then
46 HAVE_SIGSET_T=0
47 fi
48])
49
50AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR],
51[
52 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
53 AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
54 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
55 dnl Define it also as a C macro, for the benefit of the unit tests.
56 gl_MODULE_INDICATOR_FOR_TESTS([$1])
57])
58
59AC_DEFUN([gl_SIGNAL_H_DEFAULTS],
60[
61 GNULIB_PTHREAD_SIGMASK=0; AC_SUBST([GNULIB_PTHREAD_SIGMASK])
62 GNULIB_SIGNAL_H_SIGPIPE=0; AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE])
63 GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK])
64 GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION])
65 dnl Assume proper GNU behavior unless another module says otherwise.
66 HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING])
67 HAVE_SIGSET_T=1; AC_SUBST([HAVE_SIGSET_T])
68 HAVE_SIGINFO_T=1; AC_SUBST([HAVE_SIGINFO_T])
69 HAVE_SIGACTION=1; AC_SUBST([HAVE_SIGACTION])
70 HAVE_STRUCT_SIGACTION_SA_SIGACTION=1;
71 AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACTION])
72 HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1;
73 AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T])
74 HAVE_SIGHANDLER_T=1; AC_SUBST([HAVE_SIGHANDLER_T])
75 REPLACE_PTHREAD_SIGMASK=0; AC_SUBST([REPLACE_PTHREAD_SIGMASK])
76])