summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-07-06 10:58:37 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-07-06 10:58:37 -0700
commit6db30f83447f4667d2ca84c33979f2745ca96bd5 (patch)
tree9304b3fb361c6aa6f0b3274efbe0fdc379785b68 /m4
parent84e04a29b9fddf5c5ede9873aa0356cd13af6f41 (diff)
downloademacs-6db30f83447f4667d2ca84c33979f2745ca96bd5.tar.gz
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.
Diffstat (limited to 'm4')
-rw-r--r--m4/gl-comp.m411
-rw-r--r--m4/pthread_sigmask.m426
-rw-r--r--m4/signal_h.m476
3 files changed, 113 insertions, 0 deletions
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],
# Code from module lstat:
# Code from module mktime:
# Code from module multiarch:
+ # Code from module pthread_sigmask:
# Code from module readlink:
+ # Code from module signal:
# Code from module socklen:
# Code from module ssize_t:
# Code from module stat:
@@ -140,12 +142,15 @@ if test $REPLACE_MKTIME = 1; then
fi
gl_TIME_MODULE_INDICATOR([mktime])
gl_MULTIARCH
+gl_PTHREAD_SIGMASK
+gl_SIGNAL_MODULE_INDICATOR([pthread_sigmask])
gl_FUNC_READLINK
if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
AC_LIBOBJ([readlink])
gl_PREREQ_READLINK
fi
gl_UNISTD_MODULE_INDICATOR([readlink])
+gl_SIGNAL_H
gl_TYPE_SOCKLEN_T
gt_TYPE_SSIZE_T
gl_STDARG_H
@@ -241,6 +246,9 @@ gl_STDLIB_MODULE_INDICATOR([strtoull])
if test $REPLACE_LSTAT = 1; then
func_gl_gnulib_m4code_stat
fi
+ if test $REPLACE_PTHREAD_SIGMASK = 1; then
+ func_gl_gnulib_m4code_sigprocmask
+ fi
if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
func_gl_gnulib_m4code_stat
fi
@@ -433,6 +441,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/sha256.h
lib/sha512.c
lib/sha512.h
+ lib/signal.in.h
lib/stat.c
lib/stdarg.in.h
lib/stdbool.in.h
@@ -470,10 +479,12 @@ AC_DEFUN([gl_FILE_LIST], [
m4/md5.m4
m4/mktime.m4
m4/multiarch.m4
+ m4/pthread_sigmask.m4
m4/readlink.m4
m4/sha1.m4
m4/sha256.m4
m4/sha512.m4
+ m4/signal_h.m4
m4/socklen.m4
m4/ssize_t.m4
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 @@
+# pthread_sigmask.m4 serial 2
+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,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_PTHREAD_SIGMASK],
+[
+ m4_ifdef([gl_THREADLIB], [
+ AC_REQUIRE([gl_THREADLIB])
+ if test "$gl_threads_api" = posix; then
+ gl_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBMULTITHREAD"
+ AC_CHECK_FUNCS([pthread_sigmask])
+ LIBS="$gl_save_LIBS"
+ else
+ ac_cv_func_pthread_sigmask=no
+ fi
+ ], [
+ AC_CHECK_FUNCS_ONCE([pthread_sigmask])
+ ])
+
+ if test $ac_cv_func_pthread_sigmask = no; then
+ REPLACE_PTHREAD_SIGMASK=1
+ fi
+])
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 @@
+# signal_h.m4 serial 14
+dnl Copyright (C) 2007-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,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_SIGNAL_H],
+[
+ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
+ AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T])
+ gl_NEXT_HEADERS([signal.h])
+
+# AIX declares sig_atomic_t to already include volatile, and C89 compilers
+# then choke on 'volatile sig_atomic_t'. C99 requires that it compile.
+ AC_CHECK_TYPE([volatile sig_atomic_t], [],
+ [HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0], [[
+#include <signal.h>
+ ]])
+
+ AC_REQUIRE([AC_TYPE_UID_T])
+
+ dnl Persuade glibc <signal.h> to define sighandler_t.
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+ AC_CHECK_TYPE([sighandler_t], [], [HAVE_SIGHANDLER_T=0], [[
+#include <signal.h>
+ ]])
+
+ dnl Check for declarations of anything we want to poison if the
+ dnl corresponding gnulib module is not in use.
+ gl_WARN_ON_USE_PREPARE([[#include <signal.h>
+ ]], [pthread_sigmask sigaction
+ sigaddset sigdelset sigemptyset sigfillset sigismember
+ sigpending sigprocmask])
+])
+
+AC_DEFUN([gl_CHECK_TYPE_SIGSET_T],
+[
+ AC_CHECK_TYPES([sigset_t],
+ [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no],
+ [[
+ #include <signal.h>
+ /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */
+ #include <sys/types.h>
+ ]])
+ if test $gl_cv_type_sigset_t != yes; then
+ HAVE_SIGSET_T=0
+ fi
+])
+
+AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
+ gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+ dnl Define it also as a C macro, for the benefit of the unit tests.
+ gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+AC_DEFUN([gl_SIGNAL_H_DEFAULTS],
+[
+ GNULIB_PTHREAD_SIGMASK=0; AC_SUBST([GNULIB_PTHREAD_SIGMASK])
+ GNULIB_SIGNAL_H_SIGPIPE=0; AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE])
+ GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK])
+ GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION])
+ dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING])
+ HAVE_SIGSET_T=1; AC_SUBST([HAVE_SIGSET_T])
+ HAVE_SIGINFO_T=1; AC_SUBST([HAVE_SIGINFO_T])
+ HAVE_SIGACTION=1; AC_SUBST([HAVE_SIGACTION])
+ HAVE_STRUCT_SIGACTION_SA_SIGACTION=1;
+ AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACTION])
+ HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1;
+ AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T])
+ HAVE_SIGHANDLER_T=1; AC_SUBST([HAVE_SIGHANDLER_T])
+ REPLACE_PTHREAD_SIGMASK=0; AC_SUBST([REPLACE_PTHREAD_SIGMASK])
+])