autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_MKDIR/cross-cc/number-of-args??


From: Guido Draheim
Subject: Re: AC_MKDIR/cross-cc/number-of-args??
Date: Wed, 10 Jan 2001 17:03:44 +0100

ADL's version looks good - atleast for mkdir as it is okay to
put a single string at mkdir. I did overlook this one as
I had problems with -fwrite-strings and vxworks headers
that declare mkdir(char*), however ac-compile checks 
wouldn't use that compile-option...

Otherwise, yes, there are good deal of problems about
the permission-bits themselves, especially with some
win/dos or embedded/rtos targets. In my sources, these
are solved with a few nulldef defines like
#ifndef S_IRWXG \n #define S_IRWXG 0 \n #endif
which is just the thing that we do wherever O_BINARY
is not available (many unix'ish systems don't have it).

Many thanks to everyone, esp. ADL. I'll test it in the
next time, after which I'll send a notice to ADL, as
it may be a good idea to have this one in the
autoconf-archive too. Mo, you have the most platform
experience - wherever mkdir is (posix'ish) with two
args, it is okay to feed existing S_-defines, right?
And to define non-exisiting to null will be okay if
done locally, right? (I did never hear of a system
that would be offended by S_-bits it declares for
other places, but I'd not be amazed either).

cheers
-- guido

Mo DeJong wrote:
> >
> > I have been using the following macro for a few weeks,
> > it might not be really perfect but at least it works for the
> > hosts I need (this include crosscompiling to mingw32).
> >
> > dnl AC_FUNC_MKDIR
> > dnl Check for mkdir.
> > dnl Can define HAVE_MKDIR, HAVE__MKDIR and MKDIR_TAKES_ONE_ARG.
> > dnl
> > dnl #if HAVE_MKDIR
> > dnl # if MKDIR_TAKES_ONE_ARG
> > dnl    /* Mingw32 */
> > dnl #  define mkdir(a,b) mkdir(a)
> > dnl # endif
> > dnl #else
> > dnl # if HAVE__MKDIR
> > dnl    /* plain Win32 */
> > dnl #  define mkdir(a,b) _mkdir(a)
> > dnl # else
> > dnl #  error "Don't know how to create a directory on this system."
> > dnl # endif
> > dnl #endif
> > dnl
> > dnl Written by Alexandre Duret-Lutz <address@hidden>.
> >
> > 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>
> > #ifdef 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
> > ])
> >
> > --
> > Alexandre Duret-Lutz
> 
> Along these same lines, here is the mkdir check from
> the configure.in in Jikes. Note that the mac version
> is just for kicks, I don't think it actually works.
> 
> dnl We need to do some nasty checks here to make sure that
> dnl we know what version of mkdir() to call.
> 
> dnl First, we just make sure mkdir() actually exists
> AC_CHECK_FUNCS(mkdir, , AC_MSG_ERROR([No mkdir() function found]))
> 
> AC_CACHE_CHECK(for mac style mkdir, jikes_cv_mac_mkdir,
>     AC_TRY_LINK([
> #include <sys/stat.h>
> #include <stat.mac.h>
> ], [mkdir("foo.dir", 0);
> ], jikes_cv_mac_mkdir=yes,
>    jikes_cv_mac_mkdir=no)
> )
> 
> AC_CACHE_CHECK(for glibc style mkdir, jikes_cv_glibc_mkdir,
>     AC_TRY_LINK([
> #include <sys/stat.h>
> #include <unistd.h>
> ], [mkdir("foo.dir", S_IRWXU | S_IRWXG | S_IRWXO);
> ], jikes_cv_glibc_mkdir=yes,
>    jikes_cv_glibc_mkdir=no)
> )
> 
> AC_CACHE_CHECK(for libc5 style mkdir, jikes_cv_libc5_mkdir,
>     AC_TRY_LINK([
> #include <sys/stat.h>
> #include <unistd.h>
> ], [mkdir("foo.dir", S_IRWXU);
> ], jikes_cv_libc5_mkdir=yes,
>    jikes_cv_libc5_mkdir=no)
> )
> 
> AC_CACHE_CHECK(for win32 style mkdir, jikes_cv_win32_mkdir,
>     AC_TRY_LINK([
> #include <direct.h>
> ], [mkdir("foo.dir");
> ], jikes_cv_win32_mkdir=yes,
>    jikes_cv_win32_mkdir=no)
> )
> 
> if test "$jikes_cv_glibc_mkdir" = "yes" ; then
>     AC_DEFINE(HAVE_GLIBC_MKDIR, ,
>         [use unix style mkdir(str, S_IRWXU | S_IRWXG | S_IRWXO)])
> elif test "$jikes_cv_libc5_mkdir" = "yes" ; then
>     AC_DEFINE(HAVE_LIBC5_MKDIR, ,
>         [use unix style mkdir(str, S_IRWXU)])
> elif test "$jikes_cv_win32_mkdir" = "yes" ; then
>     AC_DEFINE(HAVE_WIN32_MKDIR, ,
>         [use win32 style mkdir(str) from <direct.h>])
> elif test "$jikes_cv_mac_mkdir" = "yes" ; then
>     AC_DEFINE(HAVE_MAC_MKDIR, ,
>         [use mac style mkdir(str,0) from <stat.mac.h>])
> else
>     AC_MSG_ERROR([Could not locate a working mkdir() implementation])
> fi
> 
> cheers
> Mo DeJong
> Red Hat Inc




reply via email to

[Prev in Thread] Current Thread [Next in Thread]