New module 'dirent'.
authorBruno Haible <bruno@clisp.org>
Sat, 18 Oct 2008 23:44:46 +0000 (01:44 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 18 Oct 2008 23:44:46 +0000 (01:44 +0200)
ChangeLog
doc/posix-headers/dirent.texi
lib/dirent.in.h
m4/dirent_h.m4 [new file with mode: 0644]
m4/fchdir.m4
modules/dirent [new file with mode: 0644]
modules/fchdir

index 71054d4..de9ee13 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2008-10-18  Bruno Haible  <bruno@clisp.org>
 
+       * 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  <bruno@clisp.org>
+
        Avoid -Wunused-parameter warnings in public gnulib header files.
        * m4/gnulib-common.m4 (gl_COMMON_BODY): Define _UNUSED_PARAMETER_ as a
        macro.
index c62abf1..3a00a53 100644 (file)
@@ -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
index 36dedf5..170a2fd 100644 (file)
@@ -1,4 +1,4 @@
-/* Wrapper around <dirent.h>.
+/* A GNU-like <dirent.h>.
    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 (file)
index 0000000..93cfbdc
--- /dev/null
@@ -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 <dirent.h>.
+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])
+])
index eff886b..1d3e5fe 100644 (file)
@@ -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 (file)
index 0000000..baeba57
--- /dev/null
@@ -0,0 +1,39 @@
+Description:
+A GNU-like <dirent.h>.
+
+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 <dirent.h> 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 <dirent.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
index e7d8eec..4b25e52 100644 (file)
@@ -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 <dirent.h> 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 <unistd.h>