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.
9 AC_DEFUN([gl_FUNC_CLOSEDIR],
11 AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
12 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
14 AC_CHECK_FUNCS([closedir])
15 if test $ac_cv_func_closedir = no; then
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
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], [
28 if test $HAVE_FCHDIR = 0; then