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.

72 lines
2.4KB

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