Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
3.6KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_func_mkdir.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_FUNC_MKDIR
  8. #
  9. # DESCRIPTION
  10. #
  11. # Check whether mkdir() is mkdir or _mkdir, and whether it takes one or
  12. # two arguments.
  13. #
  14. # This macro can define HAVE_MKDIR, HAVE__MKDIR, and MKDIR_TAKES_ONE_ARG,
  15. # which are expected to be used as follows:
  16. #
  17. # #if HAVE_MKDIR
  18. # # if MKDIR_TAKES_ONE_ARG
  19. # /* MinGW32 */
  20. # # define mkdir(a, b) mkdir(a)
  21. # # endif
  22. # #else
  23. # # if HAVE__MKDIR
  24. # /* plain Windows 32 */
  25. # # define mkdir(a, b) _mkdir(a)
  26. # # else
  27. # # error "Don't know how to create a directory on this system."
  28. # # endif
  29. # #endif
  30. #
  31. # LICENSE
  32. #
  33. # Copyright (c) 2008 Alexandre Duret-Lutz <adl@gnu.org>
  34. #
  35. # This program is free software; you can redistribute it and/or modify it
  36. # under the terms of the GNU General Public License as published by the
  37. # Free Software Foundation; either version 2 of the License, or (at your
  38. # option) any later version.
  39. #
  40. # This program is distributed in the hope that it will be useful, but
  41. # WITHOUT ANY WARRANTY; without even the implied warranty of
  42. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  43. # Public License for more details.
  44. #
  45. # You should have received a copy of the GNU General Public License along
  46. # with this program. If not, see <https://www.gnu.org/licenses/>.
  47. #
  48. # As a special exception, the respective Autoconf Macro's copyright owner
  49. # gives unlimited permission to copy, distribute and modify the configure
  50. # scripts that are the output of Autoconf when processing the Macro. You
  51. # need not follow the terms of the GNU General Public License when using
  52. # or distributing such scripts, even though portions of the text of the
  53. # Macro appear in them. The GNU General Public License (GPL) does govern
  54. # all other use of the material that constitutes the Autoconf Macro.
  55. #
  56. # This special exception to the GPL applies to versions of the Autoconf
  57. # Macro released by the Autoconf Archive. When you make and distribute a
  58. # modified version of the Autoconf Macro, you may extend this special
  59. # exception to the GPL to apply to your modified version as well.
  60. #serial 5
  61. AU_ALIAS([AC_FUNC_MKDIR], [AX_FUNC_MKDIR])
  62. AC_DEFUN([AX_FUNC_MKDIR],
  63. [AC_CHECK_FUNCS([mkdir _mkdir])
  64. AC_CACHE_CHECK([whether mkdir takes one argument],
  65. [ac_cv_mkdir_takes_one_arg],
  66. [AC_TRY_COMPILE([
  67. #include <sys/stat.h>
  68. #if HAVE_UNISTD_H
  69. # include <unistd.h>
  70. #endif
  71. ], [mkdir (".");],
  72. [ac_cv_mkdir_takes_one_arg=yes], [ac_cv_mkdir_takes_one_arg=no])])
  73. if test x"$ac_cv_mkdir_takes_one_arg" = xyes; then
  74. AC_DEFINE([MKDIR_TAKES_ONE_ARG], 1,
  75. [Define if mkdir takes only one argument.])
  76. fi
  77. ])
  78. dnl Note:
  79. dnl =====
  80. dnl I have not implemented the following suggestion because I don't have
  81. dnl access to such a broken environment to test the macro. So I'm just
  82. dnl appending the comments here in case you have, and want to fix
  83. dnl AX_FUNC_MKDIR that way.
  84. dnl
  85. dnl |Thomas E. Dickey (dickey@herndon4.his.com) said:
  86. dnl | it doesn't cover the problem areas (compilers that mistreat mkdir
  87. dnl | may prototype it in dir.h and dirent.h, for instance).
  88. dnl |
  89. dnl |Alexandre:
  90. dnl | Would it be sufficient to check for these headers and #include
  91. dnl | them in the AC_TRY_COMPILE block? (and is AC_HEADER_DIRENT
  92. dnl | suitable for this?)
  93. dnl |
  94. dnl |Thomas:
  95. dnl | I think that might be a good starting point (with the set of recommended
  96. dnl | ifdef's and includes for AC_HEADER_DIRENT, of course).