added missing dependencies to fix failing unistr/ tests
[gnulib.git] / m4 / remove.m4
1 # remove.m4 serial 1
2 dnl Copyright (C) 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_REMOVE],
8 [
9   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
10   AC_REQUIRE([gl_AC_DOS])
11   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
12   AC_REQUIRE([gl_FUNC_RMDIR])
13   AC_REQUIRE([gl_FUNC_UNLINK])
14   if test "$gl_cv_func_rmdir_works:$gl_cv_func_unlink_works" != yes:yes; then
15     dnl If either underlying syscall is broken, then remove likely has
16     dnl the same bug; blindly use our replacement.
17     REPLACE_REMOVE=1
18     AC_LIBOBJ([remove])
19   else
20     dnl C89 requires remove(), but only POSIX requires it to handle
21     dnl directories.  On mingw, directories fails with EPERM.
22     AC_CACHE_CHECK([whether remove handles directories],
23       [gl_cv_func_remove_dir_works],
24       [mkdir conftest.dir
25        AC_RUN_IFELSE(
26          [AC_LANG_PROGRAM(
27            [[#include <stdio.h>
28 ]], [[return remove ("conftest.dir");]])],
29          [gl_cv_func_remove_dir_works=yes], [gl_cv_func_remove_dir_works=no],
30          [case $host_os in
31             mingw*) gl_cv_func_remove_dir_works="guessing no";;
32             *) gl_cv_func_remove_dir_works="guessing yes";;
33           esac])
34        rm -rf conftest.dir])
35     case $gl_cv_func_remove_dir_works in
36       *no*) REPLACE_REMOVE=1
37         AC_LIBOBJ([remove]);;
38     esac
39   fi
40 ])