diff --git a/config/ChangeLog b/config/ChangeLog index 6e1743fe4b..5d20a96d53 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,10 @@ +2003-12-15 Angus Leeming + + * lyxinclude.m4: define AC_FUNC_MKDIR. + + * configure.ac: add AC_FUNC_MKDIR test and code to + #define mkdir should a non-POSIX version be found. + 2004-12-06 Jean-Marc Lasgouttes * *.m4: quote the name of the macro in AC_DEFUN diff --git a/config/configure.ac b/config/configure.ac index a5759306e9..262310ad1e 100644 --- a/config/configure.ac +++ b/config/configure.ac @@ -248,6 +248,9 @@ LYX_CHECK_DECL(vsnprintf, stdio.h) LYX_CHECK_DECL(istreambuf_iterator, iterator) LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h]) +# Check the form of mkdir() +AC_FUNC_MKDIR + dnl This is a slight hack: the tests generated by autoconf 2.52 do not dnl work correctly because of some conflict with stdlib.h with g++ 2.96 dnl We aim to remove this eventually, since we should test as much as @@ -337,6 +340,20 @@ int mkstemp(char*); #endif #endif +#if HAVE_MKDIR +# if MKDIR_TAKES_ONE_ARG + /* MinGW32 */ +# define mkdir(a, b) mkdir(a) +# endif +#else +# if HAVE__MKDIR + /* plain Windows 32 */ +# define mkdir(a, b) _mkdir(a) +# else +# error "Don't know how to create a directory on this system." +# endif +#endif + #ifdef __EMX__ #include "support/os2_defines.h" #endif diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index 7de1050aa6..8de4eebd87 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -693,3 +693,27 @@ AM_PROG_LIBTOOL dnl for libraries CC=$ac_save_cc CFLAGS="$ac_save_cflags" ]) + +## ------------------------------------------------------------------------ +## Check whether mkdir() is mkdir or _mkdir, and whether it takes +## one or two arguments. +## +## http://ac-archive.sourceforge.net/C_Support/ac_func_mkdir.html +## ------------------------------------------------------------------------ +## +AC_DEFUN([AC_FUNC_MKDIR], +[AC_CHECK_FUNCS([mkdir _mkdir]) +AC_CACHE_CHECK([whether mkdir takes one argument], + [ac_cv_mkdir_takes_one_arg], +[AC_TRY_COMPILE([ +#include +#if HAVE_UNISTD_H +# include +#endif +], [mkdir (".");], +[ac_cv_mkdir_takes_one_arg=yes], [ac_cv_mkdir_takes_one_arg=no])]) +if test x"$ac_cv_mkdir_takes_one_arg" = xyes; then + AC_DEFINE([MKDIR_TAKES_ONE_ARG], 1, + [Define if mkdir takes only one argument.]) +fi +])