Re: moving $(mkdir_p) from automake to autoconf

2006-04-19 Thread Ralf Wildenhues
Hello,

I'm still undecided with this.  I see the benefit, but I see quite a few
subtle issues with it as well.  I'd like to see a more evolved patch
before judging.

* Bruno Haible wrote on Tue, Apr 18, 2006 at 02:43:42PM CEST:
   
 + @defmac AC_PROG_MKDIR_P
 + @acindex{AC_PROG_MKDIR_P}
 + @ovindex mkdir_p
 + Set output variable @code{mkdir_p} to a command that ensures that for
 + each argument, a directory named by this argument exists, creating it
 + and its parent directories if needed.
 + 
 + This macro uses the @samp{mkdir} command if possible.  It may also fall
 + back to the @samp{install-sh -d} command.
 + 
 + Autoconf comes with a copy of @file{install-sh} that you can use.  If
 + you use @code{AC_PROG_MKDIR_P}, you must include @file{install-sh} in
 + your distribution.
 + @end defmac
 + 

First, this description does not document that `install_sh' will be set
and AC_SUBSTed.

This description does not make it clear that @mkdir_p@ may only be used
in files later used as input to `make'.  The naive user may choose to
use $mkdir_p in, say, shell scripts, maybe in configure.ac even: on his
GNU/Linux system, that will work fine, and not expose the limitations.

For the internal, undocumented Automake macro this may have been ok, but
for a generic, documented Autoconf macro this is definitely not ok.

This also opens up the question of whether we could actually make
$mkdir_p work in shell scripts as well, and if, how.  Surely it'd have
to be
  mkdir_p='${install_sh} -d'

then, and track down further issues with how $install_sh may have been
set.  Unfortunately, this setting changed over past Automake versions:
now there may be a $(SHELL) prepending it (automake/m4/install-sh.m4):
  install_sh=${install_sh-\$(SHELL) $am_aux_dir/install-sh}

Probably best to link to the documentation of AS_MKDIR_P for use in
configure.ac itself, and forbid use in other, non-M4sh shell scripts.


The next issue that comes with this macro is that, because both Automake
and Autoconf race for setting $install_sh and $mkdir_p currently, it
depends on the order in which the user invokes AC_PROG_MKDIR_P and
AM_INIT_AUTOMAKE, which will win.  This certainly needs to be
documented, or better even, a preferred order be enforced by AC_BEFORE
et al.

The proposed macro for Autoconf disallows user overrides for both
$install_sh and $mkdir_p, whereas Automake would override the latter
only.

Cheers,
Ralf




Re: moving $(mkdir_p) from automake to autoconf

2006-04-19 Thread Paul Eggert
Stepan Kasal [EMAIL PROTECTED] writes:

 I second this proposal.  I think this could be added right now, even though
 we are in a freeze.

I tend to agree, since it's taken from Automake.  Assuming my minor
patch to Automake for leading - is accepted I'd like that change put
into Autoconf as well.




Re: moving $(mkdir_p) from automake to autoconf

2006-04-18 Thread Stepan Kasal
Hello,

On Tue, Apr 18, 2006 at 02:43:42PM +0200, Bruno Haible wrote:
 Therefore I propose to move the AM_PROG_MKDIR_P that defines an @mkdir_p@
 variable to autoconf. The sooner, the better.

I second this proposal.  I think this could be added right now, even though
we are in a freeze.

I think that the long comment about why we don't use `mkdir -p -- .'
should go at the end of the comment before the macro, so that it is
not copied to ./configure.

I'll wait for more suggestions, and make an updated version of the patch
later.

Have a nice day,
Stepan Kasal