1# dirent_h.m4 serial 16 2dnl Copyright (C) 2008-2015 Free Software Foundation, Inc. 3dnl This file is free software; the Free Software Foundation 4dnl gives unlimited permission to copy and/or distribute it, 5dnl with or without modifications, as long as this notice is preserved. 6 7dnl Written by Bruno Haible. 8 9AC_DEFUN([gl_DIRENT_H], 10[ 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]) 14 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 18 HAVE_DIRENT_H=1 19 else 20 HAVE_DIRENT_H=0 21 fi 22 AC_SUBST([HAVE_DIRENT_H]) 23 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]) 28]) 29 30AC_DEFUN([gl_DIRENT_MODULE_INDICATOR], 31[ 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]) 37]) 38 39AC_DEFUN([gl_DIRENT_H_DEFAULTS], 40[ 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]) 64]) 65