New module 'poll-h'.
[gnulib.git] / m4 / poll_h.m4
1 # poll_h.m4 serial 1
2 dnl Copyright (C) 2010 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
7 dnl Written by Bruno Haible.
8
9 AC_DEFUN([gl_POLL_H],
10 [
11   dnl Use AC_REQUIRE here, so that the default behavior below is expanded
12   dnl once only, before all statements that occur in other macros.
13   AC_REQUIRE([gl_POLL_H_DEFAULTS])
14
15   AC_CHECK_HEADERS_ONCE([poll.h])
16   if test $ac_cv_header_poll_h != yes; then
17     gl_REPLACE_POLL_H
18   fi
19
20   dnl Check for declarations of anything we want to poison if the
21   dnl corresponding gnulib module is not in use.
22   gl_WARN_ON_USE_PREPARE([[#include <poll.h>]],
23     [poll])
24 ])
25
26 dnl Unconditionally enables the replacement of <poll.h>.
27 AC_DEFUN([gl_REPLACE_POLL_H],
28 [
29   AC_REQUIRE([gl_POLL_H_DEFAULTS])
30   POLL_H='poll.h'
31 ])
32
33 AC_DEFUN([gl_POLL_MODULE_INDICATOR],
34 [
35   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
36   AC_REQUIRE([gl_POLL_H_DEFAULTS])
37   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
38   dnl Define it also as a C macro, for the benefit of the unit tests.
39   gl_MODULE_INDICATOR_FOR_TESTS([$1])
40 ])
41
42 AC_DEFUN([gl_POLL_H_DEFAULTS],
43 [
44   GNULIB_POLL=0;        AC_SUBST([GNULIB_POLL])
45   dnl Assume proper GNU behavior unless another module says otherwise.
46   POLL_H='';            AC_SUBST([POLL_H])
47   HAVE_POLL=1;          AC_SUBST([HAVE_POLL])
48   REPLACE_POLL=0;       AC_SUBST([REPLACE_POLL])
49 ])