rmdir.m4 1.2 KB

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