Merge from emacs-24; up to 2012-05-01T00:16:02Z!rgm@gnu.org
[bpt/emacs.git] / m4 / pselect.m4
1 # pselect.m4
2 dnl Copyright (C) 2011-2012 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 AC_DEFUN([gl_FUNC_PSELECT],
8 [
9 AC_REQUIRE([gl_HEADER_SYS_SELECT])
10 AC_REQUIRE([AC_C_RESTRICT])
11 AC_CHECK_FUNCS_ONCE([pselect])
12
13 if test $ac_cv_func_pselect = yes; then
14 AC_CACHE_CHECK([whether signature of pselect conforms to POSIX],
15 gl_cv_sig_pselect,
16 [AC_LINK_IFELSE(
17 [AC_LANG_PROGRAM(
18 [[#include <sys/select.h>
19 ]],
20 [[int (*p) (int, fd_set *, fd_set *, fd_set *restrict,
21 struct timespec const *restrict,
22 sigset_t const *restrict) = pselect;
23 return !p;]])],
24 [gl_cv_sig_pselect=yes],
25 [gl_cv_sig_pselect=no])])
26 fi
27
28 if test $ac_cv_func_pselect = no || test $gl_cv_sig_pselect = no; then
29 REPLACE_PSELECT=1
30 fi
31 ])