1 # dirent_h.m4 serial 16
2 dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 dnl Written by Bruno Haible.
9 AC_DEFUN([gl_DIRENT_H],
11 dnl Use AC_REQUIRE here, so that the default behavior below is expanded
12 dnl once only, before all statements that occur in other macros.
13 AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
15 dnl <dirent.h> is always overridden, because of GNULIB_POSIXCHECK.
16 gl_CHECK_NEXT_HEADERS([dirent.h])
17 if test $ac_cv_header_dirent_h = yes; then
22 AC_SUBST([HAVE_DIRENT_H])
24 dnl Check for declarations of anything we want to poison if the
25 dnl corresponding gnulib module is not in use.
26 gl_WARN_ON_USE_PREPARE([[#include <dirent.h>
27 ]], [alphasort closedir dirfd fdopendir opendir readdir rewinddir scandir])
30 AC_DEFUN([gl_DIRENT_MODULE_INDICATOR],
32 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
33 AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
34 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
35 dnl Define it also as a C macro, for the benefit of the unit tests.
36 gl_MODULE_INDICATOR_FOR_TESTS([$1])
39 AC_DEFUN([gl_DIRENT_H_DEFAULTS],
41 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
42 GNULIB_OPENDIR=0; AC_SUBST([GNULIB_OPENDIR])
43 GNULIB_READDIR=0; AC_SUBST([GNULIB_READDIR])
44 GNULIB_REWINDDIR=0; AC_SUBST([GNULIB_REWINDDIR])
45 GNULIB_CLOSEDIR=0; AC_SUBST([GNULIB_CLOSEDIR])
46 GNULIB_DIRFD=0; AC_SUBST([GNULIB_DIRFD])
47 GNULIB_FDOPENDIR=0; AC_SUBST([GNULIB_FDOPENDIR])
48 GNULIB_SCANDIR=0; AC_SUBST([GNULIB_SCANDIR])
49 GNULIB_ALPHASORT=0; AC_SUBST([GNULIB_ALPHASORT])
50 dnl Assume proper GNU behavior unless another module says otherwise.
51 HAVE_OPENDIR=1; AC_SUBST([HAVE_OPENDIR])
52 HAVE_READDIR=1; AC_SUBST([HAVE_READDIR])
53 HAVE_REWINDDIR=1; AC_SUBST([HAVE_REWINDDIR])
54 HAVE_CLOSEDIR=1; AC_SUBST([HAVE_CLOSEDIR])
55 HAVE_DECL_DIRFD=1; AC_SUBST([HAVE_DECL_DIRFD])
56 HAVE_DECL_FDOPENDIR=1;AC_SUBST([HAVE_DECL_FDOPENDIR])
57 HAVE_FDOPENDIR=1; AC_SUBST([HAVE_FDOPENDIR])
58 HAVE_SCANDIR=1; AC_SUBST([HAVE_SCANDIR])
59 HAVE_ALPHASORT=1; AC_SUBST([HAVE_ALPHASORT])
60 REPLACE_OPENDIR=0; AC_SUBST([REPLACE_OPENDIR])
61 REPLACE_CLOSEDIR=0; AC_SUBST([REPLACE_CLOSEDIR])
62 REPLACE_DIRFD=0; AC_SUBST([REPLACE_DIRFD])
63 REPLACE_FDOPENDIR=0; AC_SUBST([REPLACE_FDOPENDIR])