Commit | Line | Data |
---|---|---|
35428fb6 | 1 | # rmdir.m4 serial 12 |
f0007cad | 2 | dnl Copyright (C) 2002, 2005, 2009-2012 Free Software Foundation, Inc. |
a67f2fce AW |
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 | dnl Detect cygwin 1.5.x bug. | |
35428fb6 | 11 | AC_CHECK_HEADERS_ONCE([unistd.h]) |
a67f2fce AW |
12 | AC_CACHE_CHECK([whether rmdir works], [gl_cv_func_rmdir_works], |
13 | [mkdir conftest.dir | |
14 | touch conftest.file | |
15 | AC_RUN_IFELSE( | |
16 | [AC_LANG_PROGRAM( | |
17 | [[#include <stdio.h> | |
18 | #include <errno.h> | |
35428fb6 LC |
19 | #if HAVE_UNISTD_H |
20 | # include <unistd.h> | |
21 | #else /* on Windows with MSVC */ | |
22 | # include <direct.h> | |
23 | #endif | |
a67f2fce AW |
24 | ]], [[int result = 0; |
25 | if (!rmdir ("conftest.file/")) | |
26 | result |= 1; | |
27 | else if (errno != ENOTDIR) | |
28 | result |= 2; | |
29 | if (!rmdir ("conftest.dir/./")) | |
30 | result |= 4; | |
31 | return result; | |
32 | ]])], | |
33 | [gl_cv_func_rmdir_works=yes], [gl_cv_func_rmdir_works=no], | |
34 | [gl_cv_func_rmdir_works="guessing no"]) | |
35 | rm -rf conftest.dir conftest.file]) | |
36 | if test x"$gl_cv_func_rmdir_works" != xyes; then | |
37 | REPLACE_RMDIR=1 | |
38 | fi | |
39 | ]) |