Debian Codegraph @

m4/rmdir.m4

raw
1 # rmdir.m4 serial 18
2 dnl Copyright (C) 2002, 2005, 2009-2023 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_UNISTD_H_DEFAULTS])
10 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
11 dnl Detect cygwin 1.5.x bug.
12 AC_CHECK_HEADERS_ONCE([unistd.h])
13 AC_CACHE_CHECK([whether rmdir works], [gl_cv_func_rmdir_works],
14 [mkdir conftest.dir
15 touch conftest.file
16 AC_RUN_IFELSE(
17 [AC_LANG_PROGRAM(
18 [[#include <stdio.h>
19 #include <errno.h>
20 #if HAVE_UNISTD_H
21 # include <unistd.h>
22 #else /* on Windows with MSVC */
23 # include <direct.h>
24 #endif
25 ]GL_MDA_DEFINES],
26 [[int result = 0;
27 if (!rmdir ("conftest.file/"))
28 result |= 1;
29 else if (errno != ENOTDIR)
30 result |= 2;
31 if (!rmdir ("conftest.dir/./"))
32 result |= 4;
33 return result;
34 ]])],
35 [gl_cv_func_rmdir_works=yes], [gl_cv_func_rmdir_works=no],
36 [case "$host_os" in
37 # Guess yes on Linux systems.
38 linux-* | linux) gl_cv_func_rmdir_works="guessing yes" ;;
39 # Guess yes on systems that emulate the Linux system calls.
40 midipix*) gl_cv_func_rmdir_works="guessing yes" ;;
41 # Guess yes on glibc systems.
42 *-gnu* | gnu*) gl_cv_func_rmdir_works="guessing yes" ;;
43 # Guess no on native Windows.
44 mingw*) gl_cv_func_rmdir_works="guessing no" ;;
45 # If we don't know, obey --enable-cross-guesses.
46 *) gl_cv_func_rmdir_works="$gl_cross_guess_normal" ;;
47 esac
48 ])
49 rm -rf conftest.dir conftest.file])
50 case "$gl_cv_func_rmdir_works" in
51 *yes) ;;
52 *)
53 REPLACE_RMDIR=1
54 ;;
55 esac
56 ])