summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-05-14 08:01:17 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-05-14 08:01:17 +0000
commit2e71ba4dd2433a94acf5e5a294c4a35ce227f282 (patch)
tree8d89500c38ceb6ddd2315d9ec1eba2e37b5ad1c6 /m4
parent44d59bb168eaf820bdfd13ee9df442cde795f9c7 (diff)
downloadcoreutils-2e71ba4dd2433a94acf5e5a294c4a35ce227f282.tar.xz
New unlinkdir module.
Diffstat (limited to 'm4')
-rw-r--r--m4/unlinkdir.m431
1 files changed, 31 insertions, 0 deletions
diff --git a/m4/unlinkdir.m4 b/m4/unlinkdir.m4
new file mode 100644
index 000000000..c3f9c018b
--- /dev/null
+++ b/m4/unlinkdir.m4
@@ -0,0 +1,31 @@
+#serial 1
+
+# Copyright (C) 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Written by Paul Eggert.
+
+AC_DEFUN([gl_UNLINKDIR],
+[
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_CHECK_HEADERS_ONCE(priv.h unistd.h)
+
+ # The Hurd, the Linux kernel, the FreeBSD kernel version 2.2 and later,
+ # and Cygwin never let anyone (even root) unlink directories.
+ # If anyone knows of another system for which unlink can never
+ # remove a directory, please report it to <bug-coreutils@gnu.org>.
+ # Unfortunately this is difficult to test for, since it requires root access
+ # and might create garbage in the file system,
+ # so the code below simply relies on the kernel name and version number.
+ case $host in
+ *-*-gnu[0-9]* | \
+ *-*-linux-* | *-*-linux | \
+ *-*-freebsd2.2* | *-*-freebsd[3-9]* | *-*-freebsd[1-9][0-9]* | \
+ *-cygwin)
+ AC_DEFINE([UNLINK_CANNOT_UNLINK_DIR], 1,
+ [Define to 1 if unlink (dir) cannot possibly succeed.]);;
+ esac
+])