declare smobs in alloc.c
[bpt/emacs.git] / m4 / getdtablesize.m4
CommitLineData
0a858ebf 1# getdtablesize.m4 serial 5
ba318903 2dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
067428c1
PE
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_GETDTABLESIZE],
8[
9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
0a858ebf 10 AC_REQUIRE([AC_CANONICAL_HOST])
067428c1 11 AC_CHECK_FUNCS_ONCE([getdtablesize])
0a858ebf
PE
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],
18 [AC_RUN_IFELSE([
19 AC_LANG_PROGRAM([[#include <unistd.h>]],
20 [int size = getdtablesize();
21 if (dup2 (0, getdtablesize()) != -1)
22 return 1;
23 if (size != getdtablesize())
24 return 2;
25 ])],
26 [gl_cv_func_getdtablesize_works=yes],
27 [gl_cv_func_getdtablesize_works=no],
28 [case "$host_os" in
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" ;;
32 esac])
33 ])
34 case "$gl_cv_func_getdtablesize_works" in
35 *yes) ;;
36 *) REPLACE_GETDTABLESIZE=1 ;;
37 esac
38 else
067428c1
PE
39 HAVE_GETDTABLESIZE=0
40 fi
41])
42
43# Prerequisites of lib/getdtablesize.c.
44AC_DEFUN([gl_PREREQ_GETDTABLESIZE], [:])