1 # dirent_h.m4 serial 13
2 dnl Copyright (C) 2008-2011 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])
18 dnl Check for declarations of anything we want to poison if the
19 dnl corresponding gnulib module is not in use.
20 gl_WARN_ON_USE_PREPARE([[#include <dirent.h>
21 ]], [alphasort dirfd fdopendir scandir])
24 dnl Unconditionally enables the replacement of <dirent.h>.
25 AC_DEFUN([gl_REPLACE_DIRENT_H],
27 dnl This is a no-op, because <dirent.h> is always overridden.
31 AC_DEFUN([gl_DIRENT_MODULE_INDICATOR],
33 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
34 AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
35 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
36 dnl Define it also as a C macro, for the benefit of the unit tests.
37 gl_MODULE_INDICATOR_FOR_TESTS([$1])
40 AC_DEFUN([gl_DIRENT_H_DEFAULTS],
42 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
43 GNULIB_DIRFD=0; AC_SUBST([GNULIB_DIRFD])
44 GNULIB_FDOPENDIR=0; AC_SUBST([GNULIB_FDOPENDIR])
45 GNULIB_SCANDIR=0; AC_SUBST([GNULIB_SCANDIR])
46 GNULIB_ALPHASORT=0; AC_SUBST([GNULIB_ALPHASORT])
47 dnl Assume proper GNU behavior unless another module says otherwise.
48 HAVE_DECL_DIRFD=1; AC_SUBST([HAVE_DECL_DIRFD])
49 HAVE_DECL_FDOPENDIR=1;AC_SUBST([HAVE_DECL_FDOPENDIR])
50 HAVE_FDOPENDIR=1; AC_SUBST([HAVE_FDOPENDIR])
51 HAVE_SCANDIR=1; AC_SUBST([HAVE_SCANDIR])
52 HAVE_ALPHASORT=1; AC_SUBST([HAVE_ALPHASORT])
53 REPLACE_CLOSEDIR=0; AC_SUBST([REPLACE_CLOSEDIR])
54 REPLACE_DIRFD=0; AC_SUBST([REPLACE_DIRFD])
55 REPLACE_FDOPENDIR=0; AC_SUBST([REPLACE_FDOPENDIR])
56 REPLACE_OPENDIR=0; AC_SUBST([REPLACE_OPENDIR])