bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: [Mingw-users] Re: More patch 2.5.9 hacking


From: Manu
Subject: Re: [Mingw-users] Re: More patch 2.5.9 hacking
Date: Sat, 25 Oct 2003 02:38:50 +0200

Paul Eggert wrote:

> "Manu" <address@hidden> writes:
> 
> > > If it's some other patch then I must have missed it; sorry.
> > 
> > Here it is:
> > http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00168.html
> 
> Thanks, but we need to know why those changes were needed.
> 
> In common.h, the proposed change moves the mkdir macro definition to
> the end of the file.  Presumably this is because some of the
> intervening include files declares mkdir.  Which include file is it?

<unistd.h>, line 219, while "# define mkdir(name, mode) ((mkdir) (name))"
is line 290. So the mkdir function is undeclared.

In fact unistd.h doesn't exist under Windows. MinGW provides a
wrapper to the standard "io.h" of Windows.

/*
 * This file is part of the Mingw32 package.
 *
 * unistd.h maps (roughly) to io.h
 */
#ifndef __STRICT_ANSI__
#include <io.h>
#endif

> In mkdir.m4, the proposed change avoids including <sys/types.h>
> and <sys/stat.h>.  This will break 'configure' on non-mingw platforms,
> so I'd rather leave those include directives in.  Is it really necessary
> to remove these include directives on mingw?  Why?

It is not necessary, I thought it was useless for a test that mostly
concerns DOS/Windows. I'm missing some knowledge about
including <sys/types.h>, <sys/stat.h>.
Anyway the following compiles just fine with MinGW:

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

int main(void)
{
    mkdir(".");
    return 0;
}


> Also, in mkdir.m4, the proposed change includes <dir.h>
> unconditionally.  Presumably this is an include file that is available
> on mingw.

Yes, but in fact <io.h> would  be more accurate with Windows
compilers. Then under MinGW, <unistd.h> would be just fine.

> It is not available on other platforms, so we can't include
> it unconditionally.  Also, nowhere else does the mainline code include
> <dir.h>, and this doesn't sound correct: if the configure test
> includes <dir.h>, then the actual code should include <dir.h>.
> Conversely, since you had to make the above-described change to
> <common.h>, this suggests that mkdir is declared by one of the
> standard include files.  If so, I'd rather test with that file (which
> the mainline code is already using) than with <dir.h>.

You are correct, let's use <unistd.h>. If it needs a conditional, then
we would get:

 AC_TRY_COMPILE([
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
   ],
   [mkdir (".");],
   patch_cv_mkdir_takes_one_arg=yes,
   patch_cv_mkdir_takes_one_arg=no
   )

If you agree, I'll have to "./configure && make" under both
MinGW and MSYS, then I'll send a new patch.

Manu.






reply via email to

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