Fix COPYING.EXCEPTION license notices
[gnulib.git] / m4 / opendir.m4
blobd7bea481c848b3eb289699ca4f5c5aa44c92e21f
1 # opendir.m4
2 # serial 7
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.
8 AC_DEFUN([gl_FUNC_OPENDIR],
10   AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
11   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13   AC_CHECK_FUNCS([opendir])
14   if test $ac_cv_func_opendir = no; then
15     HAVE_OPENDIR=0
16   else
17     dnl Replace opendir() on native Windows and OS/2 kLIBC,
18     dnl to support fdopendir().
19     AC_REQUIRE([gl_DIRENT_DIR])
20     if test $DIR_HAS_FD_MEMBER = 0; then
21       REPLACE_OPENDIR=1
22     fi
23     dnl Replace opendir() for supporting the gnulib-defined fchdir() function,
24     dnl to keep fchdir's bookkeeping up-to-date.
25     m4_ifdef([gl_FUNC_FCHDIR], [
26       gl_TEST_FCHDIR
27       if test $HAVE_FCHDIR = 0; then
28         REPLACE_OPENDIR=1
29       fi
30     ])
31   fi