2 dnl Copyright (C) 2009-2020 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.
7 AC_DEFUN([gl_FUNC_REMOVE],
9 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
10 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
11 AC_REQUIRE([gl_FUNC_RMDIR])
12 AC_REQUIRE([gl_FUNC_UNLINK])
13 if { case "$gl_cv_func_rmdir_works:$gl_cv_func_unlink_honors_slashes" in
18 dnl If either underlying syscall is broken, then remove likely has
19 dnl the same bug; blindly use our replacement.
22 dnl C89 requires remove(), but only POSIX requires it to handle
23 dnl directories. On mingw, directories fails with EPERM.
24 AC_CACHE_CHECK([whether remove handles directories],
25 [gl_cv_func_remove_dir_works],
30 ]], [[return remove ("conftest.dir");]])],
31 [gl_cv_func_remove_dir_works=yes], [gl_cv_func_remove_dir_works=no],
33 mingw*) gl_cv_func_remove_dir_works="guessing no";;
34 *) gl_cv_func_remove_dir_works="guessing yes";;
37 case $gl_cv_func_remove_dir_works in
38 *no*) REPLACE_REMOVE=1;;