Configure tests for mkdir.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@9379 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2004-12-15 21:04:03 +00:00
parent c855de6c0d
commit 76e155ea7d
3 changed files with 48 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2003-12-15 Angus Leeming <leeming-0hXrFu2P2+c@public.gmane.org>
* 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 <lasgouttes@lyx.org>
* *.m4: quote the name of the macro in AC_DEFUN

View File

@ -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

View File

@ -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 <sys/stat.h>
#if HAVE_UNISTD_H
# include <unistd.h>
#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
])