Subject: Re: bug#10791: aclocal fails if /usr/share/aclocal does not exist

From: Stefano Lattarini <[email-masked]>
Date: Wed, 22 Feb 2012 10:14:18 +0100

On 02/22/2012 09:26 AM, Stefano Lattarini wrote:
>
>> But /usr/share/aclocal does not, because there are no third-party
>> m4 files required at the time that GNU Make was being compiled.
>>
> Weird; the directory is created unconditionally by automake's
> "make install".  Might it be the fault of cowbuilder that it somehow
> removes empty directories when creating its chroot environment?
> 
If this is the case, it might be worth applying the attached patch...

Regards,
  Stefano
>From 2cdeaea412c6643a10e256363cd51d4cf16a8392 Mon Sep 17 00:00:00 2001
Message-Id: <2cdeaea41[email-masked]>
From: Stefano Lattarini <[email-masked]>
Date: Wed, 22 Feb 2012 10:12:02 +0100
Subject: [PATCH] aclocal: don't create /usr/share/aclocal as empty

Fixes automake bug#10791.

See also Debian bug#659482:
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=659482>

Since automake 1.11.2, aclocal no longer succeeds if the system
acdir ("${datadir}/aclocal", i.e., "/usr/share/aclocal" when
${prefix} is "/usr") does not exist.  Unfortunately, this causes
at least Debian's "make" package to FTBFS under the minimal chroot
environment "cowbuilder", because autoreconf somehow ends up being
called there when /usr/share/aclocal is not present.

Now, this is mostly the fault of cowbuilder, since it's likely it
is it that removes the automake-created but empty /usr/share/aclocal
directory when creating the chroot where the build is performed.

Still, we can easily work around this issue by creating the system
acdir with some "real content" from the start: a README files that
explains what the directory is there for, and tell not to remove it.
And in hindsight, doing so seems like a good idea, independently
from the cowbuilder issue, since it's not that nice to just create
what might appear as an empty random directory, but which will
utterly break the package when removed.

* m4/acdir/README: New file.
* m4/Makefile.am (dist_system_ac_DATA): Add it.
* m4/acdir/.placeholder: Delete, no more needed.
* m4/Makefile.am (EXTRA_DIST): Remove it.
* THANKS: Update.
---
 THANKS                |    1 +
 m4/Makefile.am        |    5 ++---
 m4/acdir/.placeholder |    2 --
 m4/acdir/README       |    6 ++++++
 4 files changed, 9 insertions(+), 5 deletions(-)
 delete mode 100644 m4/acdir/.placeholder
 create mode 100644 m4/acdir/README

diff --git a/THANKS b/THANKS
index 36f8f4b..7b7c9df 100644
--- a/THANKS
+++ b/THANKS
@@ -360,6 +360,7 @@ Thomas Tanner		[email-masked]
 Toralf Förster		[email-masked]
 Tim Goodwin		[email-masked]
 Tim Mooney		[email-masked]
+Tim Retout		[email-masked]
 Tim Rice		[email-masked]
 Tim Van Holder		[email-masked]
 Toshio Kuratomi		[email-masked]
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 2f5ead3..c281e28 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -55,10 +55,9 @@ tar.m4 \
 upc.m4 \
 vala.m4
 
-# So that $(system_acdir) will be created by "make install".
-dist_system_ac_DATA =
+dist_system_ac_DATA = acdir/README
 
-EXTRA_DIST = acdir/.placeholder amversion.in
+EXTRA_DIST = amversion.in
 
 # We build amversion.m4 here, instead of from config.status,
 # because config.status is rerun each time one of configure's
diff --git a/m4/acdir/.placeholder b/m4/acdir/.placeholder
deleted file mode 100644
index 8dd7f67..0000000
--- a/m4/acdir/.placeholder
+++ /dev/null
@@ -1,2 +0,0 @@
-This file is here only to ensure the directory containing it exists
-in the git repository, and goes in the distribution tarball.
diff --git a/m4/acdir/README b/m4/acdir/README
new file mode 100644
index 0000000..d3a25e7
--- /dev/null
+++ b/m4/acdir/README
@@ -0,0 +1,6 @@
+This directory is where .m4 files providing third-party autoconf
+macros can be placed to be automatically found by the aclocal(1)
+program.
+
+This directory, even if empty, is required in order for aclocal to
+work properly.  Please do not remove it.
-- 
1.7.9