Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.2KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_have_poll.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_HAVE_POLL([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
  8. # AX_HAVE_PPOLL([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
  9. #
  10. # DESCRIPTION
  11. #
  12. # This macro determines whether the system supports the poll I/O event
  13. # interface. A neat usage example would be:
  14. #
  15. # AX_HAVE_POLL(
  16. # [AX_CONFIG_FEATURE_ENABLE(poll)],
  17. # [AX_CONFIG_FEATURE_DISABLE(poll)])
  18. # AX_CONFIG_FEATURE(
  19. # [poll], [This platform supports poll(7)],
  20. # [HAVE_POLL], [This platform supports poll(7).])
  21. #
  22. # Some systems -- most notably Linux kernel 2.6.16 and later -- also have
  23. # the variant ppoll(). The availability of that function can be tested
  24. # with the second macro. Generally speaking, it is safe to assume that
  25. # AX_HAVE_POLL would succeed if AX_HAVE_PPOLL has, but not the other way
  26. # round.
  27. #
  28. # LICENSE
  29. #
  30. # Copyright (c) 2009 Peter Simons <simons@cryp.to>
  31. #
  32. # Copying and distribution of this file, with or without modification, are
  33. # permitted in any medium without royalty provided the copyright notice
  34. # and this notice are preserved. This file is offered as-is, without any
  35. # warranty.
  36. #serial 8
  37. AC_DEFUN([AX_HAVE_POLL], [dnl
  38. AC_MSG_CHECKING([for poll(2)])
  39. AC_CACHE_VAL([ax_cv_have_poll], [dnl
  40. AC_LINK_IFELSE([dnl
  41. AC_LANG_PROGRAM(
  42. [#include <poll.h>],
  43. [int rc; rc = poll((struct pollfd *)(0), 0, 0);])],
  44. [ax_cv_have_poll=yes],
  45. [ax_cv_have_poll=no])])
  46. AS_IF([test "${ax_cv_have_poll}" = "yes"],
  47. [AC_MSG_RESULT([yes])
  48. $1],[AC_MSG_RESULT([no])
  49. $2])
  50. ])dnl
  51. AC_DEFUN([AX_HAVE_PPOLL], [dnl
  52. AC_MSG_CHECKING([for ppoll(2)])
  53. AC_CACHE_VAL([ax_cv_have_ppoll], [dnl
  54. AC_LINK_IFELSE([dnl
  55. AC_LANG_PROGRAM(
  56. [dnl
  57. #include <poll.h>
  58. #include <signal.h>],
  59. [dnl
  60. int rc;
  61. rc = poll((struct pollfd *)(0), 0, 0);
  62. rc = ppoll((struct pollfd *)(0), 0, (struct timespec const *)(0), (sigset_t const *)(0));])],
  63. [ax_cv_have_ppoll=yes],
  64. [ax_cv_have_ppoll=no])])
  65. AS_IF([test "${ax_cv_have_ppoll}" = "yes"],
  66. [AC_MSG_RESULT([yes])
  67. $1],[AC_MSG_RESULT([no])
  68. $2])
  69. ])