Author: cazfi Date: Fri Jul 1 21:29:35 2016 New Revision: 33141 URL: http://svn.gna.org/viewcvs/freeciv?rev=33141&view=rev Log: Added configure check for _mkdir().
See bug #24356 Modified: trunk/configure.ac trunk/utility/shared.c Modified: trunk/configure.ac URL: http://svn.gna.org/viewcvs/freeciv/trunk/configure.ac?rev=33141&r1=33140&r2=33141&view=diff ============================================================================== --- trunk/configure.ac (original) +++ trunk/configure.ac Fri Jul 1 21:29:35 2016 @@ -1359,6 +1359,13 @@ strerror strlcat strlcpy strstr uname usleep \ getline _strcoll stricoll _stricoll strcasecoll \ backtrace setenv putenv]) + +dnl Possible "-Wmissing-declarations" and "-Werror" will prune out +dnl cases where we should not use _mkdir() even if it's possible to link against it +fc_save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS -Werror $EXTRA_DEBUG_CFLAGS" +AC_CHECK_FUNCS([_mkdir]) +CPPFLAGS="$fc_save_CPPFLAGS" AC_MSG_CHECKING(for working gettimeofday) FC_CHECK_GETTIMEOFDAY_RUNTIME(,AC_DEFINE([HAVE_GETTIMEOFDAY], [1], Modified: trunk/utility/shared.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/shared.c?rev=33141&r1=33140&r2=33141&view=diff ============================================================================== --- trunk/utility/shared.c (original) +++ trunk/utility/shared.c Fri Jul 1 21:29:35 2016 @@ -1717,12 +1717,23 @@ } #ifdef WIN32_NATIVE - char *path_in_local_encoding = internal_to_local_string_malloc(path); - _mkdir(path_in_local_encoding); - free(path_in_local_encoding); -#else +#ifdef HAVE__MKDIR + /* Prefer _mkdir() in Windows even if mkdir() would seem to be available - + * chances are that it's wrong kind of mkdir(). + * TODO: Make a configure check for mkdir() that also makes sure that it + * takes two parameters, and prefer such proper mkdir() here. */ + { + char *path_in_local_encoding = internal_to_local_string_malloc(path); + + _mkdir(path_in_local_encoding); + free(path_in_local_encoding); + } +#else /* HAVE__MKDIR */ mkdir(path, 0755); -#endif +#endif /* HAVE__MKDIR */ +#else /* WIN32_NATIVE */ + mkdir(path, 0755); +#endif /* WIN32_NATIVE */ if (dir) { *dir = DIR_SEPARATOR_CHAR; _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits