1 # ===========================================================================
2 # https://www.gnu.org/software/autoconf-archive/ax_func_mkdir.html
3 # ===========================================================================
11 # Check whether mkdir() is mkdir or _mkdir, and whether it takes one or
14 # This macro can define HAVE_MKDIR, HAVE__MKDIR, and MKDIR_TAKES_ONE_ARG,
15 # which are expected to be used as follows:
18 # # if MKDIR_TAKES_ONE_ARG
20 # # define mkdir(a, b) mkdir(a)
24 # /* plain Windows 32 */
25 # # define mkdir(a, b) _mkdir(a)
27 # # error "Don't know how to create a directory on this system."
33 # Copyright (c) 2008 Alexandre Duret-Lutz <adl@gnu.org>
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.
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.
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/>.
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.
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.
63 AU_ALIAS([AC_FUNC_MKDIR], [AX_FUNC_MKDIR])
64 AC_DEFUN([AX_FUNC_MKDIR],
65 [AC_CHECK_FUNCS([mkdir _mkdir])
66 AC_CACHE_CHECK([whether mkdir takes one argument],
67 [ac_cv_mkdir_takes_one_arg],
68 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
73 ]], [[mkdir (".");]])],
74 [ac_cv_mkdir_takes_one_arg=yes], [ac_cv_mkdir_takes_one_arg=no])])
75 if test x"$ac_cv_mkdir_takes_one_arg" = xyes; then
76 AC_DEFINE([MKDIR_TAKES_ONE_ARG], 1,
77 [Define if mkdir takes only one argument.])
83 dnl I have not implemented the following suggestion because I don't have
84 dnl access to such a broken environment to test the macro. So I'm just
85 dnl appending the comments here in case you have, and want to fix
86 dnl AX_FUNC_MKDIR that way.
88 dnl |Thomas E. Dickey (dickey@herndon4.his.com) said:
89 dnl | it doesn't cover the problem areas (compilers that mistreat mkdir
90 dnl | may prototype it in dir.h and dirent.h, for instance).
93 dnl | Would it be sufficient to check for these headers and #include
94 dnl | them in the AC_COMPILE_IFELSE block? (and is AC_HEADER_DIRENT
95 dnl | suitable for this?)
98 dnl | I think that might be a good starting point (with the set of recommended
99 dnl | ifdef's and includes for AC_HEADER_DIRENT, of course).