| 1 |
# closedir.m4 |
| 2 |
# serial 8 |
| 3 |
dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. |
| 4 |
dnl This file is free software; the Free Software Foundation |
| 5 |
dnl gives unlimited permission to copy and/or distribute it, |
| 6 |
dnl with or without modifications, as long as this notice is preserved. |
| 7 |
dnl This file is offered as-is, without any warranty. |
| 8 |
|
| 9 |
AC_DEFUN([gl_FUNC_CLOSEDIR], |
| 10 |
[ |
| 11 |
AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) |
| 12 |
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
| 13 |
|
| 14 |
AC_CHECK_FUNCS([closedir]) |
| 15 |
if test $ac_cv_func_closedir = no; then |
| 16 |
HAVE_CLOSEDIR=0 |
| 17 |
else |
| 18 |
dnl Replace closedir() on native Windows and OS/2 kLIBC, |
| 19 |
dnl to support fdopendir(). |
| 20 |
AC_REQUIRE([gl_DIRENT_DIR]) |
| 21 |
if test $DIR_HAS_FD_MEMBER = 0; then |
| 22 |
REPLACE_CLOSEDIR=1 |
| 23 |
fi |
| 24 |
dnl Replace closedir() for supporting the gnulib-defined fchdir() function, |
| 25 |
dnl to keep fchdir's bookkeeping up-to-date. |
| 26 |
m4_ifdef([gl_FUNC_FCHDIR], [ |
| 27 |
gl_TEST_FCHDIR |
| 28 |
if test $HAVE_FCHDIR = 0; then |
| 29 |
REPLACE_CLOSEDIR=1 |
| 30 |
fi |
| 31 |
]) |
| 32 |
fi |
| 33 |
]) |