|
Packit |
1ef1a9 |
# getdtablesize.m4 serial 6
|
|
Packit |
1ef1a9 |
dnl Copyright (C) 2008-2015 Free Software Foundation, Inc.
|
|
Packit |
1ef1a9 |
dnl This file is free software; the Free Software Foundation
|
|
Packit |
1ef1a9 |
dnl gives unlimited permission to copy and/or distribute it,
|
|
Packit |
1ef1a9 |
dnl with or without modifications, as long as this notice is preserved.
|
|
Packit |
1ef1a9 |
|
|
Packit |
1ef1a9 |
AC_DEFUN([gl_FUNC_GETDTABLESIZE],
|
|
Packit |
1ef1a9 |
[
|
|
Packit |
1ef1a9 |
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
|
|
Packit |
1ef1a9 |
AC_REQUIRE([AC_CANONICAL_HOST])
|
|
Packit |
1ef1a9 |
AC_CHECK_FUNCS_ONCE([getdtablesize])
|
|
Packit |
1ef1a9 |
AC_CHECK_DECLS_ONCE([getdtablesize])
|
|
Packit |
1ef1a9 |
if test $ac_cv_func_getdtablesize = yes &&
|
|
Packit |
1ef1a9 |
test $ac_cv_have_decl_getdtablesize = yes; then
|
|
Packit |
1ef1a9 |
# Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft limit
|
|
Packit |
1ef1a9 |
# up to an unchangeable hard limit; all other platforms correctly
|
|
Packit |
1ef1a9 |
# require setrlimit before getdtablesize() can report a larger value.
|
|
Packit |
1ef1a9 |
AC_CACHE_CHECK([whether getdtablesize works],
|
|
Packit |
1ef1a9 |
[gl_cv_func_getdtablesize_works],
|
|
Packit |
1ef1a9 |
[AC_RUN_IFELSE([
|
|
Packit |
1ef1a9 |
AC_LANG_PROGRAM([[#include <unistd.h>]],
|
|
Packit |
1ef1a9 |
[int size = getdtablesize();
|
|
Packit |
1ef1a9 |
if (dup2 (0, getdtablesize()) != -1)
|
|
Packit |
1ef1a9 |
return 1;
|
|
Packit |
1ef1a9 |
if (size != getdtablesize())
|
|
Packit |
1ef1a9 |
return 2;
|
|
Packit |
1ef1a9 |
])],
|
|
Packit |
1ef1a9 |
[gl_cv_func_getdtablesize_works=yes],
|
|
Packit |
1ef1a9 |
[gl_cv_func_getdtablesize_works=no],
|
|
Packit |
1ef1a9 |
[case "$host_os" in
|
|
Packit |
1ef1a9 |
cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows
|
|
Packit |
1ef1a9 |
gl_cv_func_getdtablesize_works="guessing no" ;;
|
|
Packit |
1ef1a9 |
*) gl_cv_func_getdtablesize_works="guessing yes" ;;
|
|
Packit |
1ef1a9 |
esac])
|
|
Packit |
1ef1a9 |
])
|
|
Packit |
1ef1a9 |
case "$gl_cv_func_getdtablesize_works" in
|
|
Packit |
1ef1a9 |
*yes) ;;
|
|
Packit |
1ef1a9 |
*) REPLACE_GETDTABLESIZE=1 ;;
|
|
Packit |
1ef1a9 |
esac
|
|
Packit |
1ef1a9 |
else
|
|
Packit |
1ef1a9 |
HAVE_GETDTABLESIZE=0
|
|
Packit |
1ef1a9 |
fi
|
|
Packit |
1ef1a9 |
])
|
|
Packit |
1ef1a9 |
|
|
Packit |
1ef1a9 |
# Prerequisites of lib/getdtablesize.c.
|
|
Packit |
1ef1a9 |
AC_DEFUN([gl_PREREQ_GETDTABLESIZE], [:])
|