poll_h.m4 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # poll_h.m4 serial 6
  2. dnl Copyright (C) 2010-2023 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. dnl Written by Bruno Haible.
  7. AC_DEFUN_ONCE([gl_POLL_H],
  8. [
  9. dnl Ensure to expand the default settings once only, before all statements
  10. dnl that occur in other macros.
  11. AC_REQUIRE([gl_POLL_H_DEFAULTS])
  12. AC_CHECK_HEADERS_ONCE([poll.h])
  13. if test $ac_cv_header_poll_h = yes; then
  14. HAVE_POLL_H=1
  15. else
  16. HAVE_POLL_H=0
  17. fi
  18. AC_SUBST([HAVE_POLL_H])
  19. dnl <poll.h> is always overridden, because of GNULIB_POSIXCHECK.
  20. gl_CHECK_NEXT_HEADERS([poll.h])
  21. gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H
  22. dnl Check for declarations of anything we want to poison if the
  23. dnl corresponding gnulib module is not in use.
  24. gl_WARN_ON_USE_PREPARE([[#include <poll.h>]],
  25. [poll])
  26. ])
  27. # gl_POLL_MODULE_INDICATOR([modulename])
  28. # sets the shell variable that indicates the presence of the given module
  29. # to a C preprocessor expression that will evaluate to 1.
  30. # This macro invocation must not occur in macros that are AC_REQUIREd.
  31. AC_DEFUN([gl_POLL_MODULE_INDICATOR],
  32. [
  33. dnl Ensure to expand the default settings once only.
  34. gl_POLL_H_REQUIRE_DEFAULTS
  35. gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  36. dnl Define it also as a C macro, for the benefit of the unit tests.
  37. gl_MODULE_INDICATOR_FOR_TESTS([$1])
  38. ])
  39. # Initializes the default values for AC_SUBSTed shell variables.
  40. # This macro must not be AC_REQUIREd. It must only be invoked, and only
  41. # outside of macros or in macros that are not AC_REQUIREd.
  42. AC_DEFUN([gl_POLL_H_REQUIRE_DEFAULTS],
  43. [
  44. m4_defun(GL_MODULE_INDICATOR_PREFIX[_POLL_H_MODULE_INDICATOR_DEFAULTS], [
  45. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POLL])
  46. ])
  47. m4_require(GL_MODULE_INDICATOR_PREFIX[_POLL_H_MODULE_INDICATOR_DEFAULTS])
  48. AC_REQUIRE([gl_POLL_H_DEFAULTS])
  49. ])
  50. AC_DEFUN([gl_POLL_H_DEFAULTS],
  51. [
  52. dnl Assume proper GNU behavior unless another module says otherwise.
  53. HAVE_POLL=1; AC_SUBST([HAVE_POLL])
  54. REPLACE_POLL=0; AC_SUBST([REPLACE_POLL])
  55. ])