signal_h.m4 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. # signal_h.m4 serial 18
  2. dnl Copyright (C) 2007-2014 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. AC_DEFUN([gl_SIGNAL_H],
  7. [
  8. AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
  9. AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T])
  10. gl_NEXT_HEADERS([signal.h])
  11. # AIX declares sig_atomic_t to already include volatile, and C89 compilers
  12. # then choke on 'volatile sig_atomic_t'. C99 requires that it compile.
  13. AC_CHECK_TYPE([volatile sig_atomic_t], [],
  14. [HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0], [[
  15. #include <signal.h>
  16. ]])
  17. dnl Ensure the type pid_t gets defined.
  18. AC_REQUIRE([AC_TYPE_PID_T])
  19. AC_REQUIRE([AC_TYPE_UID_T])
  20. dnl Persuade glibc <signal.h> to define sighandler_t.
  21. AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
  22. AC_CHECK_TYPE([sighandler_t], [], [HAVE_SIGHANDLER_T=0], [[
  23. #include <signal.h>
  24. ]])
  25. dnl Check for declarations of anything we want to poison if the
  26. dnl corresponding gnulib module is not in use.
  27. gl_WARN_ON_USE_PREPARE([[#include <signal.h>
  28. ]], [pthread_sigmask sigaction
  29. sigaddset sigdelset sigemptyset sigfillset sigismember
  30. sigpending sigprocmask])
  31. ])
  32. AC_DEFUN([gl_CHECK_TYPE_SIGSET_T],
  33. [
  34. AC_CHECK_TYPES([sigset_t],
  35. [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no],
  36. [[
  37. #include <signal.h>
  38. /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */
  39. #include <sys/types.h>
  40. ]])
  41. if test $gl_cv_type_sigset_t != yes; then
  42. HAVE_SIGSET_T=0
  43. fi
  44. ])
  45. AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR],
  46. [
  47. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
  48. AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
  49. gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  50. dnl Define it also as a C macro, for the benefit of the unit tests.
  51. gl_MODULE_INDICATOR_FOR_TESTS([$1])
  52. ])
  53. AC_DEFUN([gl_SIGNAL_H_DEFAULTS],
  54. [
  55. GNULIB_PTHREAD_SIGMASK=0; AC_SUBST([GNULIB_PTHREAD_SIGMASK])
  56. GNULIB_RAISE=0; AC_SUBST([GNULIB_RAISE])
  57. GNULIB_SIGNAL_H_SIGPIPE=0; AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE])
  58. GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK])
  59. GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION])
  60. dnl Assume proper GNU behavior unless another module says otherwise.
  61. HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING])
  62. HAVE_PTHREAD_SIGMASK=1; AC_SUBST([HAVE_PTHREAD_SIGMASK])
  63. HAVE_RAISE=1; AC_SUBST([HAVE_RAISE])
  64. HAVE_SIGSET_T=1; AC_SUBST([HAVE_SIGSET_T])
  65. HAVE_SIGINFO_T=1; AC_SUBST([HAVE_SIGINFO_T])
  66. HAVE_SIGACTION=1; AC_SUBST([HAVE_SIGACTION])
  67. HAVE_STRUCT_SIGACTION_SA_SIGACTION=1;
  68. AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACTION])
  69. HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1;
  70. AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T])
  71. HAVE_SIGHANDLER_T=1; AC_SUBST([HAVE_SIGHANDLER_T])
  72. REPLACE_PTHREAD_SIGMASK=0; AC_SUBST([REPLACE_PTHREAD_SIGMASK])
  73. REPLACE_RAISE=0; AC_SUBST([REPLACE_RAISE])
  74. ])