1 # ===========================================================================
2 # http://www.gnu.org/software/autoconf-archive/ax_have_poll.html
3 # ===========================================================================
7 # AX_HAVE_POLL([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
8 # AX_HAVE_PPOLL([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12 # This macro determines whether the system supports the poll I/O event
13 # interface. A neat usage example would be:
16 # [AX_CONFIG_FEATURE_ENABLE(poll)],
17 # [AX_CONFIG_FEATURE_DISABLE(poll)])
19 # [poll], [This platform supports poll(7)],
20 # [HAVE_POLL], [This platform supports poll(7).])
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
30 # Copyright (c) 2009 Peter Simons <simons@cryp.to>
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
39 AC_DEFUN([AX_HAVE_POLL], [dnl
40 AC_MSG_CHECKING([for poll(2)])
41 AC_CACHE_VAL([ax_cv_have_poll], [dnl
45 [int rc; rc = poll((struct pollfd *)(0), 0, 0);])],
46 [ax_cv_have_poll=yes],
47 [ax_cv_have_poll=no])])
48 AS_IF([test "${ax_cv_have_poll}" = "yes"],
50 $1],[AC_MSG_RESULT([no])
54 AC_DEFUN([AX_HAVE_PPOLL], [dnl
55 AC_MSG_CHECKING([for ppoll(2)])
56 AC_CACHE_VAL([ax_cv_have_ppoll], [dnl
64 rc = poll((struct pollfd *)(0), 0, 0);
65 rc = ppoll((struct pollfd *)(0), 0, (struct timespec const *)(0), (sigset_t const *)(0));])],
66 [ax_cv_have_ppoll=yes],
67 [ax_cv_have_ppoll=no])])
68 AS_IF([test "${ax_cv_have_ppoll}" = "yes"],
70 $1],[AC_MSG_RESULT([no])