X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=m4%2Fgetdtablesize.m4;h=aa523b63d7bf0e97f530d4d3952ac85ce59e7ae5;hb=4aa85f09e755fc827cd5ab6225f20c83cd42245d;hp=8f04b3b8c2ade753a5bfbb2103f7951a2d4a0fa1;hpb=eb3ba7cb06fdd0f8627b8f117d8453e297e18b64;p=debian%2Ftar diff --git a/m4/getdtablesize.m4 b/m4/getdtablesize.m4 index 8f04b3b8..aa523b63 100644 --- a/m4/getdtablesize.m4 +++ b/m4/getdtablesize.m4 @@ -1,5 +1,5 @@ -# getdtablesize.m4 serial 4 -dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. +# getdtablesize.m4 serial 5 +dnl Copyright (C) 2008-2014 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -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 ]], + [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 ])