]> git.cworth.org Git - tar/blob - m4/rmdir.m4
8d6bee8bb5a5d4c5fc340ccaecea9be13120356c
[tar] / m4 / rmdir.m4
1 # rmdir.m4 serial 7
2 dnl Copyright (C) 2002, 2005, 2009-2010 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 AC_DEFUN([gl_FUNC_RMDIR],
8 [
9   AC_REQUIRE([gl_AC_DOS])
10   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
11   dnl FIXME: simplify this module in 2010 if no one reports a missing rmdir
12   AC_REPLACE_FUNCS([rmdir])
13   if test $ac_cv_func_rmdir = no; then
14     REPLACE_RMDIR=1
15     # If someone lacks rmdir, make configure fail, and request
16     # a bug report to inform us about it.
17     if test x"$SKIP_RMDIR_CHECK" != xyes; then
18       AC_MSG_FAILURE([Your system lacks the rmdir function.
19               Please report this, along with the output of "uname -a", to the
20               bug-coreutils@gnu.org mailing list.  To continue past this point,
21               rerun configure with SKIP_RMDIR_CHECK=yes.
22               E.g., ./configure SKIP_RMDIR_CHECK=yes])
23     fi
24   else
25     dnl Detect cygwin 1.5.x bug.
26     AC_CACHE_CHECK([whether rmdir works], [gl_cv_func_rmdir_works],
27       [mkdir conftest.dir
28        touch conftest.file
29        AC_RUN_IFELSE(
30          [AC_LANG_PROGRAM(
31            [[#include <stdio.h>
32              #include <errno.h>
33              #include <unistd.h>
34 ]], [[return !rmdir ("conftest.file/") || errno != ENOTDIR
35        || !rmdir ("conftest.dir/./");]])],
36          [gl_cv_func_rmdir_works=yes], [gl_cv_func_rmdir_works=no],
37          [gl_cv_func_rmdir_works="guessing no"])
38        rm -rf conftest.dir conftest.file])
39     if test x"$gl_cv_func_rmdir_works" != xyes; then
40       REPLACE_RMDIR=1
41       AC_LIBOBJ([rmdir])
42     fi
43   fi
44 ])