[PATCH v2 4/8] Test for number of mkdir() arguments
Ladislav Michl <[email protected]> Tue, 4 Dec 2018 22:24:52 +0100
| Newsgroups | gmane.linux.drivers.gnokii |
|---|---|
| Message-ID | <20181204212452.GE10937@lenoch> |
Windows' mkdir() takes only 1 argument, so add a test for that. --- CHANGES: v2: dropped MSVC change as unrelated configure.ac | 1 + include/compat.h | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index a5648fe5..b2892d27 100644 --- a/configure.ac +++ b/configure.ac @@ -898,6 +898,7 @@ AC_PROG_GCC_TRADITIONAL AC_FUNC_MEMCMP AC_TYPE_SIGNAL AC_FUNC_STRFTIME +AC_FUNC_MKDIR AC_CHECK_FUNCS(mktime timegm gettimeofday select poll wcrtomb) AC_CHECK_FUNCS(strchr strdup strndup strstr strtol strtok strsep) AC_CHECK_FUNCS(asprintf vasprintf snprintf vsnprintf getpass setenv) diff --git a/include/compat.h b/include/compat.h index acb91fc6..cae13a69 100644 --- a/include/compat.h +++ b/include/compat.h @@ -207,6 +207,20 @@ int vasprintf(char **ptr, const char *format, va_list ap); time_t timegm(struct tm *tm); #endif +#if HAVE_MKDIR +# if MKDIR_TAKES_ONE_ARG + /* Mingw32 */ +# define mkdir(a,b) mkdir(a) +# endif +#else +# if HAVE__MKDIR + /* plain Win32 */ +# define mkdir(a,b) _mkdir(a) +# else +# error "Don't know how to create a directory on this system." +# endif +#endif + /* * The following code was taken from W. Richard Stevens' * "UNIX Network Programming", Volume 1, Second Edition. -- 2.20.0.rc2