New unlinkdir module.
[gnulib.git] / m4 / unlinkdir.m4
1 #serial 2
2
3 # Copyright (C) 2005 Free Software Foundation, Inc.
4 #
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # Written by Paul Eggert.
10
11 AC_DEFUN([gl_UNLINKDIR],
12 [
13   AC_REQUIRE([AC_CANONICAL_HOST])
14   AC_CHECK_HEADERS_ONCE(priv.h unistd.h)
15
16   AC_LIBSOURCES([unlinkdir.c, unlinkdir.h])
17   AC_LIBOBJ([unlinkdir])
18
19   # The Hurd, the Linux kernel, the FreeBSD kernel version 2.2 and later,
20   # and Cygwin never let anyone (even root) unlink directories.
21   # If anyone knows of another system for which unlink can never
22   # remove a directory, please report it to <bug-coreutils@gnu.org>.
23   # Unfortunately this is difficult to test for, since it requires root access
24   # and might create garbage in the file system,
25   # so the code below simply relies on the kernel name and version number.
26   case $host in
27   *-*-gnu[0-9]* | \
28   *-*-linux-* | *-*-linux | \
29   *-*-freebsd2.2* | *-*-freebsd[3-9]* | *-*-freebsd[1-9][0-9]* | \
30   *-cygwin)
31     AC_DEFINE([UNLINK_CANNOT_UNLINK_DIR], 1,
32       [Define to 1 if unlink (dir) cannot possibly succeed.]);;
33   esac
34 ])