1# signalblocking.m4 serial 4
2dnl Copyright (C) 2001-2002, 2006 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
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.
12AC_DEFUN([gl_SIGNALBLOCKING],
13[
14  signals_not_posix=
15  AC_EGREP_HEADER(sigset_t, signal.h, , signals_not_posix=1)
16  if test -z "$signals_not_posix"; then
17    AC_CHECK_FUNC(sigprocmask, [gl_cv_func_sigprocmask=1])
18  fi
19  if test -n "$gl_cv_func_sigprocmask"; then
20    AC_DEFINE([HAVE_POSIX_SIGNALBLOCKING], 1,
21      [Define to 1 if you have the sigset_t type and the sigprocmask function.])
22  else
23    AC_LIBOBJ([sigprocmask])
24    gl_PREREQ_SIGPROCMASK
25  fi
26])
27
28# Prerequisites of lib/sigprocmask.h and lib/sigprocmask.c.
29AC_DEFUN([gl_PREREQ_SIGPROCMASK], [
30  AC_CHECK_TYPES([sigset_t],
31    [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no],
32    [#include <signal.h>
33/* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.  */
34#include <sys/types.h>])
35  if test $gl_cv_type_sigset_t = yes; then
36    AC_DEFINE([HAVE_SIGSET_T], [1],
37      [Define to 1 if you lack the sigprocmask function but have the sigset_t type.])
38  fi
39  AC_CHECK_FUNCS_ONCE(raise)
40])
41