Subject: bug#9037: distcheck should check for missing m4 files too

From: Stefano Lattarini <[email-masked]>
Date: Thu, 1 Sep 2011 15:04:34 +0200

Hello automakers, and sorry for the delay.

References:
 <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9037>
 <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9026>

On Saturday 09 July 2011, Stefano Lattarini wrote:
> On Saturday 09 July 2011, Peter Johansson wrote:
> > Hi Bruno,
> > 
> > On 7/8/11 5:24 PM, Bruno Haible wrote:
> > > +If you are using GNU @code{automake} 1.10 or newer, it is even easier:
> > > +Add the line
> > > +
> > > +@example
> > > +ACLOCAL_AMFLAGS = --install -I m4
> > > +@end example
> > > +
> > > +@noindent
> > > +to your top level @file{Makefile.am}, and run @samp{aclocal --install -I m4}.
> > > +This will copy the needed files to the @file{m4/} subdirectory automatically,
> > > +before updating @file{aclocal.m4}.
> > > +
> > I used to do this as it is an easy way to stay up to date with 3rd party 
> > m4 files. I stopped doing this, however, after Ralf Wildenhues made me 
> > aware there is a risk doing so. The risk is that aclocal will copy 3rd 
> > party m4 files into m4 not only for you but also for your users if they 
> > happen to run aclocal. Say, e.g., that a user want to build a somewhat 
> > old version of your package from git; he bootstraps and as he has newer 
> > versions of the m4 files available on his system aclocal copies them 
> > into m4, which may cause problems as they are not necessarily compatible 
> > with your configure.ac. To avoid this from happen, I've removed the 
> > --install flag from my packages and calls aclocal --install -I m4 
> > frequently instead.
> >
> Oh, good point, I hadn't thought about the precise semantics of `--install'
> when I wrote my answer.
> 
> > There is, obviously, a risk doing this way, as mentioned above in this 
> > thread, because if I'm not careful I may release a tarball with missing 
> > m4 files. Would distcheck detect a missing m4 file, or would it be 
> > possible to modify distcheck so it could warn about this case?
> >
> I think improving distcheck to catch such an error would be worthwhile.
>
OK, I've managed to come up with a test case that demonstrates how one can
use a "distcheck-hook" to diagnose this kind of errors.  I'm not sure if
this should integrated into the automake-generated distcheck recipe proper
(maybe only when a new automake option, say "check-m4-distribution", is
used?), or if we should report Peter's description of the potential
problems with `--install' in the manual, and add our distcheck-hook there
in a new example (to be kept synced with the new testcase).

Opinions?

Regards,
  Stefano