From c5fb01516f0e7df4341cbfcaaa06f5473770a560 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 19 Oct 2008 01:44:46 +0200 Subject: [PATCH] New module 'dirent'. --- ChangeLog | 11 +++++++++++ doc/posix-headers/dirent.texi | 2 +- lib/dirent.in.h | 2 +- m4/dirent_h.m4 | 37 +++++++++++++++++++++++++++++++++++++ m4/fchdir.m4 | 9 +++------ modules/dirent | 39 +++++++++++++++++++++++++++++++++++++++ modules/fchdir | 17 +---------------- 7 files changed, 93 insertions(+), 24 deletions(-) create mode 100644 m4/dirent_h.m4 create mode 100644 modules/dirent diff --git a/ChangeLog b/ChangeLog index 71054d42a..de9ee137d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2008-10-18 Bruno Haible + * modules/dirent: New file. + * m4/dirent_h.m4: New file. + * m4/fchdir.m4 (gl_FUNC_FCHDIR): Require gl_DIRENT_H_DEFAULTS. + Invoke gl_REPLACE_DIRENT_H. Don't assign DIRENT_H directly. + * modules/fchdir (Files): Remove lib/dirent.in.h. + (Depends-on): Add dirent. + (Makefile.am): Move rules to modules/dirent. + * doc/posix-headers/dirent.texi: Mention the new module. + +2008-10-18 Bruno Haible + Avoid -Wunused-parameter warnings in public gnulib header files. * m4/gnulib-common.m4 (gl_COMMON_BODY): Define _UNUSED_PARAMETER_ as a macro. diff --git a/doc/posix-headers/dirent.texi b/doc/posix-headers/dirent.texi index c62abf145..3a00a536b 100644 --- a/doc/posix-headers/dirent.texi +++ b/doc/posix-headers/dirent.texi @@ -3,7 +3,7 @@ POSIX specification: @url{http://www.opengroup.org/susv3xbd/dirent.h.html} -Gnulib module: --- +Gnulib module: dirent Portability problems fixed by Gnulib: @itemize diff --git a/lib/dirent.in.h b/lib/dirent.in.h index 36dedf5dd..170a2fda2 100644 --- a/lib/dirent.in.h +++ b/lib/dirent.in.h @@ -1,4 +1,4 @@ -/* Wrapper around . +/* A GNU-like . Copyright (C) 2006-2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/m4/dirent_h.m4 b/m4/dirent_h.m4 new file mode 100644 index 000000000..93cfbdc1f --- /dev/null +++ b/m4/dirent_h.m4 @@ -0,0 +1,37 @@ +# dirent_h.m4 serial 1 +dnl Copyright (C) 2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Bruno Haible. + +AC_DEFUN([gl_DIRENT_H], +[ + dnl Use AC_REQUIRE here, so that the default behavior below is expanded + dnl once only, before all statements that occur in other macros. + AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) + + gl_CHECK_NEXT_HEADERS([dirent.h]) +]) + +dnl Unconditionally enables the replacement of . +AC_DEFUN([gl_REPLACE_DIRENT_H], +[ + AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) + DIRENT_H='dirent.h' +]) + +AC_DEFUN([gl_DIRENT_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_DIRENT_H_DEFAULTS], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR + dnl Assume proper GNU behavior unless another module says otherwise. + DIRENT_H=''; AC_SUBST([DIRENT_H]) +]) diff --git a/m4/fchdir.m4 b/m4/fchdir.m4 index eff886bf1..1d3e5fe51 100644 --- a/m4/fchdir.m4 +++ b/m4/fchdir.m4 @@ -1,4 +1,4 @@ -# fchdir.m4 serial 5 +# fchdir.m4 serial 6 dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FCHDIR], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([fchdir]) if test $ac_cv_func_fchdir = no; then REPLACE_FCHDIR=1 @@ -16,12 +17,8 @@ AC_DEFUN([gl_FUNC_FCHDIR], [Define if gnulib's fchdir() replacement is used.]) gl_REPLACE_OPEN gl_REPLACE_CLOSE - gl_CHECK_NEXT_HEADERS([dirent.h]) - DIRENT_H='dirent.h' - else - DIRENT_H= + gl_REPLACE_DIRENT_H fi - AC_SUBST([DIRENT_H]) ]) # Prerequisites of lib/fchdir.c. diff --git a/modules/dirent b/modules/dirent new file mode 100644 index 000000000..baeba5706 --- /dev/null +++ b/modules/dirent @@ -0,0 +1,39 @@ +Description: +A GNU-like . + +Files: +lib/dirent.in.h +m4/dirent_h.m4 +m4/unistd_h.m4 + +Depends-on: +include_next + +configure.ac: +gl_DIRENT_H + +Makefile.am: +BUILT_SOURCES += $(DIRENT_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +dirent.h: dirent.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_DIRENT_H''@|$(NEXT_DIRENT_H)|g' \ + -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ + < $(srcdir)/dirent.in.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += dirent.h dirent.h-t + +Include: +#include + +License: +LGPLv2+ + +Maintainer: +all diff --git a/modules/fchdir b/modules/fchdir index e7d8eec57..4b25e5225 100644 --- a/modules/fchdir +++ b/modules/fchdir @@ -3,12 +3,12 @@ fchdir() function: change current directory, given an open file descriptor. Files: lib/fchdir.c -lib/dirent.in.h m4/fchdir.m4 Depends-on: canonicalize-lgpl close +dirent dirfd dup2 fcntl @@ -22,21 +22,6 @@ gl_FUNC_FCHDIR gl_UNISTD_MODULE_INDICATOR([fchdir]) Makefile.am: -BUILT_SOURCES += $(DIRENT_H) - -# We need the following in order to create when the system -# doesn't have one that works with the given compiler. -dirent.h: dirent.in.h - rm -f $@-t $@ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''NEXT_DIRENT_H''@|$(NEXT_DIRENT_H)|g' \ - -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ - < $(srcdir)/dirent.in.h; \ - } > $@-t - mv $@-t $@ -MOSTLYCLEANFILES += dirent.h dirent.h-t Include: #include -- 2.11.0