changeset 16022:08b63c40d129

New module 'unlinkat', split off from module 'openat'. * m4/unlinkat.m4: New file, extracted from m4/openat.m4. * m4/openat.m4 (gl_FUNC_OPENAT): Don't set GNULIB_UNLINKAT, REPLACE_UNLINKAT, HAVE_UNLINKAT. Don't test for unlinkat. * modules/unlinkat: New file, extracted from modules/openat. Correct the dependency conditions. * modules/openat (Files): Remove lib/unlinkat.c. (Depends-on): Remove rmdir, unlink. (configure.ac): Remove AC_LIBOBJ of unlinkat. * modules/unlinkat-tests: New file, extracted from modules/openat-tests. * modules/openat-tests (Files): Remove tests/test-unlinkat.c, tests/test-rmdir.h, tests/test-unlink.h. (Depends-on): Remove unlinkdir. (Makefile.am): Remove rules for test-unlinkat. * doc/posix-functions/unlinkat.texi: Mention module 'unlinkat' instead of module 'openat'. * NEWS: Mention the change. * modules/linkat-tests (Depends-on): Add unlinkat. * modules/mkfifoat-tests (Depends-on): Likewise. * modules/readlinkat-tests (Depends-on): Likewise.
author Bruno Haible <bruno@clisp.org>
date Wed, 02 Nov 2011 22:34:51 +0100
parents ab92e00caa02
children dc33aa820898
files ChangeLog NEWS doc/posix-functions/unlinkat.texi m4/openat.m4 m4/unlinkat.m4 modules/linkat-tests modules/mkfifoat-tests modules/openat modules/openat-tests modules/readlinkat-tests modules/unlinkat modules/unlinkat-tests
diffstat 12 files changed, 129 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2011-11-03  Bruno Haible  <bruno@clisp.org>
+
+	New module 'unlinkat', split off from module 'openat'.
+	* m4/unlinkat.m4: New file, extracted from m4/openat.m4.
+	* m4/openat.m4 (gl_FUNC_OPENAT): Don't set GNULIB_UNLINKAT,
+	REPLACE_UNLINKAT, HAVE_UNLINKAT. Don't test for unlinkat.
+	* modules/unlinkat: New file, extracted from modules/openat. Correct
+	the dependency conditions.
+	* modules/openat (Files): Remove lib/unlinkat.c.
+	(Depends-on): Remove rmdir, unlink.
+	(configure.ac): Remove AC_LIBOBJ of unlinkat.
+	* modules/unlinkat-tests: New file, extracted from modules/openat-tests.
+	* modules/openat-tests (Files): Remove tests/test-unlinkat.c,
+	tests/test-rmdir.h, tests/test-unlink.h.
+	(Depends-on): Remove unlinkdir.
+	(Makefile.am): Remove rules for test-unlinkat.
+	* doc/posix-functions/unlinkat.texi: Mention module 'unlinkat' instead
+	of module 'openat'.
+	* NEWS: Mention the change.
+	* modules/linkat-tests (Depends-on): Add unlinkat.
+	* modules/mkfifoat-tests (Depends-on): Likewise.
+	* modules/readlinkat-tests (Depends-on): Likewise.
+
 2011-11-02  Bruno Haible  <bruno@clisp.org>
 
 	New module 'fchmodat', split off from module 'openat'.
--- a/NEWS
+++ b/NEWS
@@ -12,7 +12,11 @@
 
 Date        Modules         Changes
 
-2011-11-01  openat          This module no longer provides the fchmodat()
+2011-11-03  openat          This module no longer provides the unlinkat()
+                            function. If you need this function, you now need
+                            to request the 'unlinkat' module.
+
+2011-11-02  openat          This module no longer provides the fchmodat()
                             function. If you need this function, you now need
                             to request the 'fchmodat' module.
 
--- a/doc/posix-functions/unlinkat.texi
+++ b/doc/posix-functions/unlinkat.texi
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/unlinkat.html}
 
-Gnulib module: openat
+Gnulib module: unlinkat
 
 Portability problems fixed by Gnulib:
 @itemize
--- a/m4/openat.m4
+++ b/m4/openat.m4
@@ -1,4 +1,4 @@
-# serial 39
+# serial 40
 # See if we need to use our replacement for Solaris' openat et al functions.
 
 dnl Copyright (C) 2004-2011 Free Software Foundation, Inc.
@@ -17,28 +17,19 @@
   GNULIB_FSTATAT=1
   GNULIB_MKDIRAT=1
 
-  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-  GNULIB_UNLINKAT=1
-
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-  AC_CHECK_FUNCS_ONCE([mkdirat openat unlinkat])
+  AC_CHECK_FUNCS_ONCE([mkdirat openat])
   AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
-  AC_REQUIRE([gl_FUNC_UNLINK])
   case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink in
   yes+yes)
-    # GNU/Hurd has unlinkat, but it has the same bug as unlink.
-    if test $REPLACE_UNLINK = 1; then
-      REPLACE_UNLINKAT=1
-    fi ;;
+    ;;
   yes+*)
     # Solaris 9 has *at functions, but uniformly mishandles trailing
     # slash in all of them.
     REPLACE_OPENAT=1
-    REPLACE_UNLINKAT=1
     ;;
   *)
     HAVE_OPENAT=0
-    HAVE_UNLINKAT=0 # No known system with unlinkat but not openat
     gl_PREREQ_OPENAT;;
   esac
   if test $ac_cv_func_mkdirat != yes; then
new file mode 100644
--- /dev/null
+++ b/m4/unlinkat.m4
@@ -0,0 +1,30 @@
+# unlinkat.m4 serial 1
+dnl Copyright (C) 2004-2011 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.
+
+# Written by Jim Meyering.
+
+AC_DEFUN([gl_FUNC_UNLINKAT],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([unlinkat])
+  AC_REQUIRE([gl_FUNC_UNLINK])
+  AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+  if test $ac_cv_func_unlinkat = no; then
+    HAVE_UNLINKAT=0
+  else
+    if test $gl_cv_func_lstat_dereferences_slashed_symlink != yes; then
+      # Solaris 9 has *at functions, but uniformly mishandles trailing
+      # slash in all of them.
+      REPLACE_UNLINKAT=1
+    else
+      # GNU/Hurd has unlinkat, but it has the same bug as unlink.
+      if test $REPLACE_UNLINK = 1; then
+        REPLACE_UNLINKAT=1
+      fi
+    fi
+  fi
+])
--- a/modules/linkat-tests
+++ b/modules/linkat-tests
@@ -10,6 +10,7 @@
 filenamecat-lgpl
 getcwd-lgpl
 same-inode
+unlinkat
 
 configure.ac:
 
--- a/modules/mkfifoat-tests
+++ b/modules/mkfifoat-tests
@@ -7,6 +7,7 @@
 Depends-on:
 ignore-value
 symlink
+unlinkat
 
 configure.ac:
 
--- a/modules/openat
+++ b/modules/openat
@@ -9,7 +9,6 @@
 lib/openat.h
 lib/openat-priv.h
 lib/openat-proc.c
-lib/unlinkat.c
 m4/openat.m4
 m4/mode_t.m4
 
@@ -28,12 +27,10 @@
 mkdir           [test $HAVE_MKDIRAT = 0]
 open
 openat-die
-rmdir           [test $REPLACE_UNLINKAT = 1]
 save-cwd
 stdbool
 sys_stat
 unistd
-unlink          [test $REPLACE_UNLINKAT = 1]
 
 configure.ac:
 gl_FUNC_OPENAT
@@ -47,9 +44,6 @@
 if test $HAVE_OPENAT = 0 || test $REPLACE_OPENAT = 1; then
   AC_LIBOBJ([openat])
 fi
-if test $ac_cv_func_unlinkat = no || test $REPLACE_UNLINKAT = 1; then
-  AC_LIBOBJ([unlinkat])
-fi
 
 Makefile.am:
 
--- a/modules/openat-tests
+++ b/modules/openat-tests
@@ -1,13 +1,10 @@
 Files:
 tests/test-lstat.h
 tests/test-mkdir.h
-tests/test-rmdir.h
 tests/test-stat.h
-tests/test-unlink.h
 tests/test-fstatat.c
 tests/test-mkdirat.c
 tests/test-openat.c
-tests/test-unlinkat.c
 tests/signature.h
 tests/macros.h
 
@@ -16,16 +13,14 @@
 ignore-value
 progname
 symlink
-unlinkdir
 
 configure.ac:
 
 Makefile.am:
 TESTS += \
-  test-fstatat test-mkdirat test-openat test-unlinkat
+  test-fstatat test-mkdirat test-openat
 check_PROGRAMS += \
-  test-fstatat test-mkdirat test-openat test-unlinkat
+  test-fstatat test-mkdirat test-openat
 test_fstatat_LDADD = $(LDADD) @LIBINTL@
 test_mkdirat_LDADD = $(LDADD) @LIBINTL@
 test_openat_LDADD = $(LDADD) @LIBINTL@
-test_unlinkat_LDADD = $(LDADD) @LIBINTL@
--- a/modules/readlinkat-tests
+++ b/modules/readlinkat-tests
@@ -7,6 +7,7 @@
 Depends-on:
 ignore-value
 symlinkat
+unlinkat
 
 configure.ac:
 
new file mode 100644
--- /dev/null
+++ b/modules/unlinkat
@@ -0,0 +1,43 @@
+Description:
+unlinkat() function: Remove a file at a directory.
+
+Files:
+lib/unlinkat.c
+lib/at-func.c
+lib/openat.h
+lib/openat-priv.h
+m4/unlinkat.m4
+
+Depends-on:
+dirent
+dosname
+errno
+extensions
+fchdir
+fcntl-h
+openat
+openat-die
+rmdir           [test $HAVE_UNLINKAT = 0]
+save-cwd
+stdbool
+sys_stat
+unistd
+unlink          [test $HAVE_UNLINKAT = 0]
+
+configure.ac:
+gl_FUNC_UNLINKAT
+if test $HAVE_UNLINKAT = 0 || test $REPLACE_UNLINKAT = 1; then
+  AC_LIBOBJ([unlinkat])
+fi
+gl_UNISTD_MODULE_INDICATOR([unlinkat])
+
+Makefile.am:
+
+Include:
+<unistd.h>
+
+License:
+GPL
+
+Maintainer:
+Jim Meyering, Eric Blake
new file mode 100644
--- /dev/null
+++ b/modules/unlinkat-tests
@@ -0,0 +1,19 @@
+Files:
+tests/test-unlinkat.c
+tests/test-rmdir.h
+tests/test-unlink.h
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+ignore-value
+progname
+symlink
+unlinkdir
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-unlinkat
+check_PROGRAMS += test-unlinkat
+test_unlinkat_LDADD = $(LDADD) @LIBINTL@