1 # getdtablesize.m4 serial 5
2 dnl Copyright (C) 2008-2015 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.
7 AC_DEFUN([gl_FUNC_GETDTABLESIZE],
9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
10 AC_REQUIRE([AC_CANONICAL_HOST])
11 AC_CHECK_FUNCS_ONCE([getdtablesize])
12 if test $ac_cv_func_getdtablesize = yes; then
13 # Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft limit
14 # up to an unchangeable hard limit; all other platforms correctly
15 # require setrlimit before getdtablesize() can report a larger value.
16 AC_CACHE_CHECK([whether getdtablesize works],
17 [gl_cv_func_getdtablesize_works],
19 AC_LANG_PROGRAM([[#include <unistd.h>]],
20 [int size = getdtablesize();
21 if (dup2 (0, getdtablesize()) != -1)
23 if (size != getdtablesize())
26 [gl_cv_func_getdtablesize_works=yes],
27 [gl_cv_func_getdtablesize_works=no],
29 cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows
30 gl_cv_func_getdtablesize_works="guessing no" ;;
31 *) gl_cv_func_getdtablesize_works="guessing yes" ;;
34 case "$gl_cv_func_getdtablesize_works" in
36 *) REPLACE_GETDTABLESIZE=1 ;;
43 # Prerequisites of lib/getdtablesize.c.
44 AC_DEFUN([gl_PREREQ_GETDTABLESIZE], [:])