1 # dirent_h.m4 serial 14
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 AC_DEFUN([gl_DIRENT_MODULE_INDICATOR],
26 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
27 AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
28 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
29 dnl Define it also as a C macro, for the benefit of the unit tests.
30 gl_MODULE_INDICATOR_FOR_TESTS([$1])
33 AC_DEFUN([gl_DIRENT_H_DEFAULTS],
35 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
36 GNULIB_DIRFD=0; AC_SUBST([GNULIB_DIRFD])
37 GNULIB_FDOPENDIR=0; AC_SUBST([GNULIB_FDOPENDIR])
38 GNULIB_SCANDIR=0; AC_SUBST([GNULIB_SCANDIR])
39 GNULIB_ALPHASORT=0; AC_SUBST([GNULIB_ALPHASORT])
40 dnl Assume proper GNU behavior unless another module says otherwise.
41 HAVE_DECL_DIRFD=1; AC_SUBST([HAVE_DECL_DIRFD])
42 HAVE_DECL_FDOPENDIR=1;AC_SUBST([HAVE_DECL_FDOPENDIR])
43 HAVE_FDOPENDIR=1; AC_SUBST([HAVE_FDOPENDIR])
44 HAVE_SCANDIR=1; AC_SUBST([HAVE_SCANDIR])
45 HAVE_ALPHASORT=1; AC_SUBST([HAVE_ALPHASORT])
46 REPLACE_CLOSEDIR=0; AC_SUBST([REPLACE_CLOSEDIR])
47 REPLACE_DIRFD=0; AC_SUBST([REPLACE_DIRFD])
48 REPLACE_FDOPENDIR=0; AC_SUBST([REPLACE_FDOPENDIR])
49 REPLACE_OPENDIR=0; AC_SUBST([REPLACE_OPENDIR])