1bf4db043e6e241c538e78f7d5e68da80c209316
[deliverable/binutils-gdb.git] / gnulib / import / m4 / getdtablesize.m4
1 # getdtablesize.m4 serial 6
2 dnl Copyright (C) 2008-2016 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_GETDTABLESIZE],
8 [
9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
10 AC_REQUIRE([AC_CANONICAL_HOST])
11 AC_CHECK_FUNCS_ONCE([getdtablesize])
12 AC_CHECK_DECLS_ONCE([getdtablesize])
13 if test $ac_cv_func_getdtablesize = yes &&
14 test $ac_cv_have_decl_getdtablesize = yes; then
15 # Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft limit
16 # up to an unchangeable hard limit; all other platforms correctly
17 # require setrlimit before getdtablesize() can report a larger value.
18 AC_CACHE_CHECK([whether getdtablesize works],
19 [gl_cv_func_getdtablesize_works],
20 [AC_RUN_IFELSE([
21 AC_LANG_PROGRAM([[#include <unistd.h>]],
22 [int size = getdtablesize();
23 if (dup2 (0, getdtablesize()) != -1)
24 return 1;
25 if (size != getdtablesize())
26 return 2;
27 ])],
28 [gl_cv_func_getdtablesize_works=yes],
29 [gl_cv_func_getdtablesize_works=no],
30 [case "$host_os" in
31 cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows
32 gl_cv_func_getdtablesize_works="guessing no" ;;
33 *) gl_cv_func_getdtablesize_works="guessing yes" ;;
34 esac])
35 ])
36 case "$gl_cv_func_getdtablesize_works" in
37 *yes) ;;
38 *) REPLACE_GETDTABLESIZE=1 ;;
39 esac
40 else
41 HAVE_GETDTABLESIZE=0
42 fi
43 ])
44
45 # Prerequisites of lib/getdtablesize.c.
46 AC_DEFUN([gl_PREREQ_GETDTABLESIZE], [:])
This page took 0.029931 seconds and 3 git commands to generate.