[Top][All Lists]

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

Re: Use "$(MKDIR_P) sys", not race-prone "test -d sys || mkdir sys".

From: Jim Meyering
Subject: Re: Use "$(MKDIR_P) sys", not race-prone "test -d sys || mkdir sys".
Date: Mon, 22 Jan 2007 15:52:21 +0100

Bruno Haible <address@hidden> wrote:

> James Youngman wrote:
>> The following patch fixes the problem.  I'm not sure if it is
>> the *right* fix for the problem, since I have only been working with
>> Autoconf/Automake macros for ten years, and so I don't understand it
>> well enough yet.
>> 2007-01-22  James Youngman  <address@hidden>
>>         * m4/gnulib-common.m4 (AC_PROG_MKDIR_P): If AC_PROG_MKDIR_P
>>         is already provided, call AC_SUBST on MKDIR_P anyway, since
>>         the version of AC_PROG_MKDIR_P in Autoconf-2.61 (at least)
>>         doesn't do that.
> Yes, this appears right. I'll give it more thorough testing tomorrow,
> but for now I've applied your patch (with different comments only). Thanks.

I thought so too, at first, but then saw this comment in
autoconf's lib/autoconf/programs.m4:

    dnl Do special magic for MKDIR_P instead of AC_SUBST, to get
    dnl relative names right.

The only case I can imagine is when MKDIR_P is specified
as e.g., MKDIR_P='../build-aux/install-sh -d' in one place,
and later (in another Makefile) as
MKDIR_P='somewhere/else/install-sh -d' in another.

I wonder which use case made it so using AC_SUBST wasn't an option.
Here's a related ChangeLog entry from autoconf (rev. 1.53 of

2006-05-13  Paul Eggert  <address@hidden>

        * doc/autoconf.texi (Particular Programs): AC_PROG_MKDIR_P now
        sets MKDIR_P, not mkdir_p, to avoid collisions with Automake.
        Warn about obsolete install-sh files.  Remove stray sentence
        fragment and fix cross reference.
        * lib/autoconf/programs.m4 (AC_PROG_INSTALL): Don't insist on
        install -d; this undoes the 2006-05-10 change.
        (MKDIR_P): Mark with AN_MAKEVAR.
        (AC_PROG_MKDIR_P): Fall back on $ac_install_sh, not $INSTALL, so
        that we don't require $INSTALL to be thread-safe.  Move comments
        out of generated code.  Require AC_CONFIG_AUX_DIR_DEFAULT instead
        of AC_PROG_INSTALL.  Output a message saying that we're checking
        mkdir -p.  Set MKDIR_P rather than mkdir_p.  Do special magic for
        MKDIR_P instead of AC_SUBST.
        * lib/autoconf/status.m4 (_AC_OUTPUT_FILE, _AC_OUTPUT_CONFIG_STATUS):
        Special magic for MKDIR_P, too.
        * lib/m4sugar/m4sh.m4 (AS_MKDIR_P): Remove comment that defeated
        a dnl.
        * tests/ (AT_CHECK_ENV): mkdir_p -> MKDIR_P.

reply via email to

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