3 dnl Copyright (C) 2010-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl Written by Bruno Haible.
10 AC_DEFUN_ONCE([gl_POLL_H],
12 dnl Ensure to expand the default settings once only, before all statements
13 dnl that occur in other macros.
14 AC_REQUIRE([gl_POLL_H_DEFAULTS])
16 AC_CHECK_HEADERS_ONCE([poll.h])
17 if test $ac_cv_header_poll_h = yes; then
22 AC_SUBST([HAVE_POLL_H])
24 dnl <poll.h> is always overridden, because of GNULIB_POSIXCHECK.
25 gl_CHECK_NEXT_HEADERS([poll.h])
27 gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H
29 dnl Check for declarations of anything we want to poison if the
30 dnl corresponding gnulib module is not in use.
31 gl_WARN_ON_USE_PREPARE([[#include <poll.h>]],
35 # gl_POLL_MODULE_INDICATOR([modulename])
36 # sets the shell variable that indicates the presence of the given module
37 # to a C preprocessor expression that will evaluate to 1.
38 # This macro invocation must not occur in macros that are AC_REQUIREd.
39 AC_DEFUN([gl_POLL_MODULE_INDICATOR],
41 dnl Ensure to expand the default settings once only.
42 gl_POLL_H_REQUIRE_DEFAULTS
43 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
44 dnl Define it also as a C macro, for the benefit of the unit tests.
45 gl_MODULE_INDICATOR_FOR_TESTS([$1])
48 # Initializes the default values for AC_SUBSTed shell variables.
49 # This macro must not be AC_REQUIREd. It must only be invoked, and only
50 # outside of macros or in macros that are not AC_REQUIREd.
51 AC_DEFUN([gl_POLL_H_REQUIRE_DEFAULTS],
53 m4_defun(GL_MODULE_INDICATOR_PREFIX[_POLL_H_MODULE_INDICATOR_DEFAULTS], [
54 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POLL])
56 m4_require(GL_MODULE_INDICATOR_PREFIX[_POLL_H_MODULE_INDICATOR_DEFAULTS])
57 AC_REQUIRE([gl_POLL_H_DEFAULTS])
60 AC_DEFUN([gl_POLL_H_DEFAULTS],
62 dnl Assume proper GNU behavior unless another module says otherwise.
63 HAVE_POLL=1; AC_SUBST([HAVE_POLL])
64 REPLACE_POLL=0; AC_SUBST([REPLACE_POLL])