summaryrefslogtreecommitdiff
path: root/m4/getdtablesize.m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-10-03 00:06:52 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2013-10-03 00:06:52 -0700
commit0a858ebfc57a072ae8ab65f509d8a4901a2ec073 (patch)
treedd81bcdf11f3d3efa32ffe00f7cdc90d3c1144d9 /m4/getdtablesize.m4
parentb52f569dcfc5c2e1b764c89d27ea8699a44228e6 (diff)
downloademacs-0a858ebfc57a072ae8ab65f509d8a4901a2ec073.tar.gz
Merge from gnulib.
* src/conf_post.h (__has_builtin, assume): Remove; gnulib now does these. * src/lisp.h: Include <verify.h>, for 'assume'. This also incorpoprates: 2013-10-02 verify: new macro 'assume' 2013-09-26 dup2, dup3: work around another cygwin crasher 2013-09-26 getdtablesize: work around cygwin issue
Diffstat (limited to 'm4/getdtablesize.m4')
-rw-r--r--m4/getdtablesize.m431
1 files changed, 29 insertions, 2 deletions
diff --git a/m4/getdtablesize.m4 b/m4/getdtablesize.m4
index 8f04b3b8c2a..b3fa1af6a5a 100644
--- a/m4/getdtablesize.m4
+++ b/m4/getdtablesize.m4
@@ -1,4 +1,4 @@
-# getdtablesize.m4 serial 4
+# getdtablesize.m4 serial 5
dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -7,8 +7,35 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_GETDTABLESIZE],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([AC_CANONICAL_HOST])
AC_CHECK_FUNCS_ONCE([getdtablesize])
- if test $ac_cv_func_getdtablesize != yes; then
+ if test $ac_cv_func_getdtablesize = yes; then
+ # Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft limit
+ # up to an unchangeable hard limit; all other platforms correctly
+ # require setrlimit before getdtablesize() can report a larger value.
+ AC_CACHE_CHECK([whether getdtablesize works],
+ [gl_cv_func_getdtablesize_works],
+ [AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([[#include <unistd.h>]],
+ [int size = getdtablesize();
+ if (dup2 (0, getdtablesize()) != -1)
+ return 1;
+ if (size != getdtablesize())
+ return 2;
+ ])],
+ [gl_cv_func_getdtablesize_works=yes],
+ [gl_cv_func_getdtablesize_works=no],
+ [case "$host_os" in
+ cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows
+ gl_cv_func_getdtablesize_works="guessing no" ;;
+ *) gl_cv_func_getdtablesize_works="guessing yes" ;;
+ esac])
+ ])
+ case "$gl_cv_func_getdtablesize_works" in
+ *yes) ;;
+ *) REPLACE_GETDTABLESIZE=1 ;;
+ esac
+ else
HAVE_GETDTABLESIZE=0
fi
])