[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8168: macros directory not created automatically
From: |
Stefano Lattarini |
Subject: |
bug#8168: macros directory not created automatically |
Date: |
Mon, 14 Mar 2011 20:44:03 +0100 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
[dropping automake list, adding automake-patches]
References:
<http://lists.gnu.org/archive/html/automake/2011-03/msg00000.html>
<http://lists.gnu.org/archive/html/bug-automake/2011-03/msg00004.html>
-*-*-
Hello Javier and all automakes, and sorry for the delay.
On Thursday 03 March 2011, Stefano Lattarini wrote:
>
> On Thursday 03 March 2011, Javier Jardón wrote:
> > Hi,
> >
> Hi Javier, and thanks for the report.
>
> > I'm using
> >
> > ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
> >
> > in my main Makefile.am, but I have to add the m4 directory to the git
> > tree, or create it in my autogen script (and this doesnt work if I do
> > not use a autogen file and only autoreconf instead)
> >
> > Shouldnt be automake smart enough to create that directory automatically?
> >
> Probably yes -- but IMHO it should then also be smart enough to create
> the directory *only* when it makes sense, i.e. only when the `--install'
> flag is used too.
>
> Also, it might be useful if aclocal would not complain (or at least would
> not error out) in case it is passed a non-existent or unreadable directory
> through the `-I' option. This "laxer" behaviour is implemented in many
> other gnu tools already (e.g., make, m4. gcc).
>
> I might take a look at this issues in the next(ish) days.
>
> Thanks,
> Stefano
>
Attached is a patch series (2 patches) that should address the issue.
The series is based off of maint -- as I'm not yet sure whether it
would be better to merge it to master only, or to maint too.
Javier, are you ok with your name being added to THANKS?
Ralf, OK to apply? If yes, where (maint, or master only)?
Regards,
Stefano
-*-*-
PATCH 1/2] aclocal: `-I' does not bail out on invalid directories.
Related to automake bug#8168.
* aclocal.in (scan_m4_dirs): If a user-specified "include
directory" is unreadable or non-existent, do not issue a
fatal error anymore, but simply issue a warning, and only
when running in verbose mode.
* NEWS: Update.
* tests/aclocal-bad-dirlist-include-dir.test: New test.
* tests/aclocal-bad-local-include-dir.test: Likewise.
* tests/aclocal-bad-system-include-dir.test: Likewise.
* tests/Makefile.am (TESTS): Update.
* tests/.gitignore: Update.
---
ChangeLog | 15 +++++
NEWS | 5 ++
aclocal.in | 10 +++-
tests/.gitignore | 4 +-
tests/Makefile.am | 3 +
tests/Makefile.in | 3 +
tests/aclocal-bad-dirlist-include-dir.test | 36 +++++++++++
tests/aclocal-bad-local-include-dir.test | 90 ++++++++++++++++++++++++++++
tests/aclocal-bad-system-include-dir.test | 36 +++++++++++
9 files changed, 199 insertions(+), 3 deletions(-)
create mode 100755 tests/aclocal-bad-dirlist-include-dir.test
create mode 100755 tests/aclocal-bad-local-include-dir.test
create mode 100755 tests/aclocal-bad-system-include-dir.test
-*-*-
[PATCH 2/2] aclocal: create local directory where to install m4 files
Before this change, a call like `aclocal -I m4 --install' would
fail if the `m4' directory wasn't pre-existing. This could be
particularly annoying when running in a checked-out version
from a VCS like git, which doesn't allow empty directories to
be tracked.
Closes automake bug#8168.
* aclocal.in (install_file): Change signature: take as second
argument the destination directory rather than the destination
file. Crate the destination directory if it doesn't already
exist. In verbose mode, tell what is being copied where.
(write_aclocal: Update.
* NEWS: Update.
* THANKS: Update.
* tests/aclocal-install-fail.test: New test.
* tests/aclocal-install-mkdir.test: Likewise.
* tests/aclocal-no-install-no-mkdir.test: Likewise.
* tests/aclocal-verbose-install.test: Likewise.
* tests/Makefile.am (TESTS): Update.
From a report by Javier Jardón.
---
ChangeLog | 23 ++++++++++++
NEWS | 4 ++
THANKS | 1 +
aclocal.in | 13 ++++---
tests/Makefile.am | 4 ++
tests/Makefile.in | 4 ++
tests/aclocal-install-fail.test | 52 ++++++++++++++++++++++++++
tests/aclocal-install-mkdir.test | 62 ++++++++++++++++++++++++++++++++
tests/aclocal-no-install-no-mkdir.test | 39 ++++++++++++++++++++
tests/aclocal-verbose-install.test | 53 +++++++++++++++++++++++++++
10 files changed, 250 insertions(+), 5 deletions(-)
create mode 100755 tests/aclocal-install-fail.test
create mode 100755 tests/aclocal-install-mkdir.test
create mode 100755 tests/aclocal-no-install-no-mkdir.test
create mode 100755 tests/aclocal-verbose-install.test
From 7e00010b25459b62c62f011b0d4909313c131217 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Mon, 14 Mar 2011 17:06:49 +0100
Subject: [PATCH 1/2] aclocal: `-I' does not bail out on invalid directories.
Related to automake bug#8168.
* aclocal.in (scan_m4_dirs): If a user-specified "include
directory" is unreadable or non-existent, do not issue a
fatal error anymore, but simply issue a warning, and only
when running in verbose mode.
* NEWS: Update.
* tests/aclocal-bad-dirlist-include-dir.test: New test.
* tests/aclocal-bad-local-include-dir.test: Likewise.
* tests/aclocal-bad-system-include-dir.test: Likewise.
* tests/Makefile.am (TESTS): Update.
* tests/.gitignore: Update.
---
ChangeLog | 15 +++++
NEWS | 5 ++
aclocal.in | 10 +++-
tests/.gitignore | 4 +-
tests/Makefile.am | 3 +
tests/Makefile.in | 3 +
tests/aclocal-bad-dirlist-include-dir.test | 36 +++++++++++
tests/aclocal-bad-local-include-dir.test | 90 ++++++++++++++++++++++++++++
tests/aclocal-bad-system-include-dir.test | 36 +++++++++++
9 files changed, 199 insertions(+), 3 deletions(-)
create mode 100755 tests/aclocal-bad-dirlist-include-dir.test
create mode 100755 tests/aclocal-bad-local-include-dir.test
create mode 100755 tests/aclocal-bad-system-include-dir.test
diff --git a/ChangeLog b/ChangeLog
index 804fae6..ed9f35b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2011-03-14 Stefano Lattarini <address@hidden>
+
+ aclocal: `-I' does not bail out on invalid directories.
+ Related to automake bug#8168.
+ * aclocal.in (scan_m4_dirs): If a user-specified "include
+ directory" is unreadable or non-existent, do not issue a
+ fatal error anymore, but simply issue a warning, and only
+ when running in verbose mode.
+ * NEWS: Update.
+ * tests/aclocal-bad-dirlist-include-dir.test: New test.
+ * tests/aclocal-bad-local-include-dir.test: Likewise.
+ * tests/aclocal-bad-system-include-dir.test: Likewise.
+ * tests/Makefile.am (TESTS): Update.
+ * tests/.gitignore: Update.
+
2011-03-04 Stefano Lattarini <address@hidden>
tests: fix bug in alloca*.test
diff --git a/NEWS b/NEWS
index 3132b16..953e62a 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,11 @@ New in 1.11.0a:
- The `lzma' compression scheme and associated automake option `dist-lzma'
is obsoleted by `xz' and `dist-xz' due to upstream changes.
+* Changes to aclocal:
+
+ - aclocal does not issue a fatal error anymore if one of the directories
+ specified with `-I' does not exist, or is not readable.
+
Bugs fixed in 1.11.0a:
* Bugs introduced by 1.11:
diff --git a/aclocal.in b/aclocal.in
index 2210fe3..3b9beab 100644
--- a/aclocal.in
+++ b/aclocal.in
@@ -312,7 +312,15 @@ sub scan_m4_dirs ($@)
{
if (! opendir (DIR, $m4dir))
{
- fatal "couldn't open directory `$m4dir': $!";
+ if ($type == FT_USER)
+ {
+ verb "cannot open directory `$m4dir': $!";
+ next;
+ }
+ else
+ {
+ fatal "couldn't open directory `$m4dir': $!";
+ }
}
# We reverse the directory contents so that foo2.m4 gets
diff --git a/tests/.gitignore b/tests/.gitignore
index 3c1f990..5e97c89 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,5 +1,5 @@
-aclocal-*
-automake-*
+aclocal-1.*
+automake-1.*
defs
parallel-tests.am
*.dir
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3fdb90a..da4a037 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -59,6 +59,9 @@ acloca19.test \
acloca20.test \
acloca21.test \
acloca22.test \
+aclocal-bad-dirlist-include-dir.test \
+aclocal-bad-local-include-dir.test \
+aclocal-bad-system-include-dir.test \
acoutnoq.test \
acoutpt.test \
acoutpt2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index cd00833..6467f1a 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -329,6 +329,9 @@ acloca19.test \
acloca20.test \
acloca21.test \
acloca22.test \
+aclocal-bad-dirlist-include-dir.test \
+aclocal-bad-local-include-dir.test \
+aclocal-bad-system-include-dir.test \
acoutnoq.test \
acoutpt.test \
acoutpt2.test \
diff --git a/tests/aclocal-bad-dirlist-include-dir.test
b/tests/aclocal-bad-dirlist-include-dir.test
new file mode 100755
index 0000000..1b8df7d
--- /dev/null
+++ b/tests/aclocal-bad-dirlist-include-dir.test
@@ -0,0 +1,36 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that `aclocal' errors out when passed a non-readable directory
+# with the `dirlist' file.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+END
+
+mkdir dirlist-test
+chmod a-r dirlist-test
+ls -l disrlist-test && Exit 77
+
+$ACLOCAL 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep " couldn't open directory .*dirlist-test" stderr
+
+:
diff --git a/tests/aclocal-bad-local-include-dir.test
b/tests/aclocal-bad-local-include-dir.test
new file mode 100755
index 0000000..680c754
--- /dev/null
+++ b/tests/aclocal-bad-local-include-dir.test
@@ -0,0 +1,90 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that `aclocal' does not bail out when passed a non-existent
+# or non-readable directory with the `-I' option. Also check that
+# warns appropriately when `--verbose' is used.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+MY_MACRO
+NOT_A_MACRO
+END
+
+mkdir m4
+cat > m4/my-defs.m4 <<END
+AC_DEFUN([MY_MACRO], [my--macro--expansion])
+END
+
+mkdir unreadable unopenable unopenable/sub private
+
+cat > unreadable/not-defs.m4 <<END
+AC_DEFUN([NOT_A_MACRO], [invalid--expansion])
+END
+cp unreadable/not-defs.m4 unopenable/sub
+cp unreadable/not-defs.m4 private
+
+chmod a-r unreadable
+chmod a-x unopenable
+chmod a-rwx private
+
+ls -l unreadable && Exit 77
+ls -l unopenable/sub && Exit 77
+ls -l private && Exit 77
+
+aclocal_call ()
+{
+ $ACLOCAL -I m4 \
+ -I non-existent \
+ -I "$cwd"/non-existent \
+ -I unreadable \
+ -I "$cwd"/unreadable \
+ -I unopenable/sub \
+ -I "$cwd"/unopenable/sub \
+ -I private \
+ -I "$cwd"/private \
+ ${1+"$@"} >stdout 2>stderr
+}
+
+cwd=`pwd` || Exit 99
+
+aclocal_call && test ! -s stdout && test ! -s stderr \
+ || { cat stdout; cat stderr >&2; Exit 1; }
+
+$EGREP '(MY_MACRO|my-defs\.m4)' aclocal.m4
+$EGREP '(NOT_A_MACRO|not-defs\.m4)' aclocal.m4 && Exit 1
+
+$AUTOCONF
+
+$FGREP MY_MACRO configure && Exit 1
+$FGREP my--macro--expansion configure
+$FGREP NOT_A_MACRO configure
+$FGREP invalid--expansion configure && Exit 1
+
+aclocal_call --verbose || { cat stdout; cat stderr >&2; Exit 1; }
+cat stdout
+cat stderr >&2
+
+for d in non-existent unreadable unopenable/sub private; do
+ grep " cannot open .*$d" stderr
+ grep " cannot open .*$cwd/$d" stderr
+done
+
+:
diff --git a/tests/aclocal-bad-system-include-dir.test
b/tests/aclocal-bad-system-include-dir.test
new file mode 100755
index 0000000..f497d9e
--- /dev/null
+++ b/tests/aclocal-bad-system-include-dir.test
@@ -0,0 +1,36 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that `aclocal' errors out when passed a non-existent or
+# non-readable directory with the `dirlist' file.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+END
+
+mkdir fake-acdir
+chmod a-r fake-acdir
+ls -l fake-acdir && Exit 77
+
+$ACLOCAL --acdir fake-acdir 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep " couldn't open directory .*fake-acdir" stderr
+
+:
--
1.7.2.3
From 8e31da6cb5712bc43181861c715cc2d4e1d8def7 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Mon, 14 Mar 2011 19:41:55 +0100
Subject: [PATCH 2/2] aclocal: create local directory where to install m4 files
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Before this change, a call like `aclocal -I m4 --install' would
fail if the `m4' directory wasn't pre-existing. This could be
particularly annoying when running in a checked-out version
from a VCS like git, which doesn't allow empty directories to
be tracked.
Closes automake bug#8168.
* aclocal.in (install_file): Change signature: take as second
argument the destination directory rather than the destination
file. Crate the destination directory if it doesn't already
exist. In verbose mode, tell what is being copied where.
(write_aclocal: Update.
* NEWS: Update.
* THANKS: Update.
* tests/aclocal-install-fail.test: New test.
* tests/aclocal-install-mkdir.test: Likewise.
* tests/aclocal-no-install-no-mkdir.test: Likewise.
* tests/aclocal-verbose-install.test: Likewise.
* tests/Makefile.am (TESTS): Update.
From a report by Javier Jardón.
---
ChangeLog | 23 ++++++++++++
NEWS | 4 ++
THANKS | 1 +
aclocal.in | 13 ++++---
tests/Makefile.am | 4 ++
tests/Makefile.in | 4 ++
tests/aclocal-install-fail.test | 52 ++++++++++++++++++++++++++
tests/aclocal-install-mkdir.test | 62 ++++++++++++++++++++++++++++++++
tests/aclocal-no-install-no-mkdir.test | 39 ++++++++++++++++++++
tests/aclocal-verbose-install.test | 53 +++++++++++++++++++++++++++
10 files changed, 250 insertions(+), 5 deletions(-)
create mode 100755 tests/aclocal-install-fail.test
create mode 100755 tests/aclocal-install-mkdir.test
create mode 100755 tests/aclocal-no-install-no-mkdir.test
create mode 100755 tests/aclocal-verbose-install.test
diff --git a/ChangeLog b/ChangeLog
index ed9f35b..ae47a54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,28 @@
2011-03-14 Stefano Lattarini <address@hidden>
+ aclocal: create local directory where to install m4 files
+ Before this change, a call like `aclocal -I m4 --install' would
+ fail if the `m4' directory wasn't pre-existing. This could be
+ particularly annoying when running in a checked-out version
+ from a VCS like git, which doesn't allow empty directories to
+ be tracked.
+ Closes automake bug#8168.
+ * aclocal.in (install_file): Change signature: take as second
+ argument the destination directory rather than the destination
+ file. Crate the destination directory if it doesn't already
+ exist. In verbose mode, tell what is being copied where.
+ (write_aclocal: Update.
+ * NEWS: Update.
+ * THANKS: Update.
+ * tests/aclocal-install-fail.test: New test.
+ * tests/aclocal-install-mkdir.test: Likewise.
+ * tests/aclocal-no-install-no-mkdir.test: Likewise.
+ * tests/aclocal-verbose-install.test: Likewise.
+ * tests/Makefile.am (TESTS): Update.
+ From a report by Javier Jardón.
+
+2011-03-14 Stefano Lattarini <address@hidden>
+
aclocal: `-I' does not bail out on invalid directories.
Related to automake bug#8168.
* aclocal.in (scan_m4_dirs): If a user-specified "include
diff --git a/NEWS b/NEWS
index 953e62a..a1383b2 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,10 @@ New in 1.11.0a:
- aclocal does not issue a fatal error anymore if one of the directories
specified with `-I' does not exist, or is not readable.
+ - If `aclocal --install' is used, and the first directory specified with
+ `-I' is non-existent, aclocal will now create it before trying to copy
+ files in it.
+
Bugs fixed in 1.11.0a:
* Bugs introduced by 1.11:
diff --git a/THANKS b/THANKS
index 60af1ee..fdf01b2 100644
--- a/THANKS
+++ b/THANKS
@@ -144,6 +144,7 @@ Janos Farkas address@hidden
Jared Davis address@hidden
Jason Duell address@hidden
Jason Molenda address@hidden
+Javier Jardón address@hidden
Jeff Bailey address@hidden
Jeff Garzik address@hidden
Jeff Squyres address@hidden
diff --git a/aclocal.in b/aclocal.in
index 3b9beab..bc582d6 100644
--- a/aclocal.in
+++ b/aclocal.in
@@ -207,12 +207,15 @@ sub reset_maps ()
undef &search;
}
-# install_file ($SRC, $DEST)
+# install_file ($SRC, $DESTDIR)
sub install_file ($$)
{
- my ($src, $dest) = @_;
+ my ($src, $destdir) = @_;
+ my $dest = $destdir . "/" . basename $src;
my $diff_dest;
+ verb "installing $src to $dest";
+
if ($force_output
|| !exists $file_contents{$dest}
|| $file_contents{$src} ne $file_contents{$dest})
@@ -265,6 +268,8 @@ sub install_file ($$)
}
elsif (!$dry_run)
{
+ xsystem ('mkdir', $destdir)
+ unless -d $destdir;
xsystem ('cp', $src, $dest);
}
}
@@ -778,9 +783,7 @@ sub write_aclocal ($@)
my $dest;
for my $ifile (@{$file_includes{$file}}, $file)
{
- $dest = "$user_includes[0]/" . basename $ifile;
- verb "installing $ifile to $dest";
- install_file ($ifile, $dest);
+ install_file ($ifile, $user_includes[0]);
}
$installed = 1;
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index da4a037..f3a1fb1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -62,6 +62,10 @@ acloca22.test \
aclocal-bad-dirlist-include-dir.test \
aclocal-bad-local-include-dir.test \
aclocal-bad-system-include-dir.test \
+aclocal-install-fail.test \
+aclocal-install-mkdir.test \
+aclocal-no-install-no-mkdir.test \
+aclocal-verbose-install.test \
acoutnoq.test \
acoutpt.test \
acoutpt2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 6467f1a..40db068 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -332,6 +332,10 @@ acloca22.test \
aclocal-bad-dirlist-include-dir.test \
aclocal-bad-local-include-dir.test \
aclocal-bad-system-include-dir.test \
+aclocal-install-fail.test \
+aclocal-install-mkdir.test \
+aclocal-no-install-no-mkdir.test \
+aclocal-verbose-install.test \
acoutnoq.test \
acoutpt.test \
acoutpt2.test \
diff --git a/tests/aclocal-install-fail.test b/tests/aclocal-install-fail.test
new file mode 100755
index 0000000..7f672c0
--- /dev/null
+++ b/tests/aclocal-install-fail.test
@@ -0,0 +1,52 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that `aclocal --install' fails when it should.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+MY_MACRO
+END
+
+mkdir dirlist-test
+cat > dirlist-test/my-defs.m4 <<END
+AC_DEFUN([MY_MACRO], [:])
+END
+
+: > a-regular-file
+mkdir unwritable-dir
+chmod a-w unwritable-dir
+
+ACLOCAL_TESTSUITE_FLAGS='-I a-regular-file' $ACLOCAL --install 2>stderr \
+ && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep 'mkdir:.*a-regular-file' stderr
+
+ACLOCAL_TESTSUITE_FLAGS='-I unwritable-dir/sub' $ACLOCAL --install \
+ 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep 'mkdir:.*unwritable-dir/sub' stderr
+
+ACLOCAL_TESTSUITE_FLAGS='-I unwritable-dir' $ACLOCAL --install 2>stderr \
+ && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep 'cp:.*unwritable-dir' stderr
+
+:
diff --git a/tests/aclocal-install-mkdir.test b/tests/aclocal-install-mkdir.test
new file mode 100755
index 0000000..e727f59
--- /dev/null
+++ b/tests/aclocal-install-mkdir.test
@@ -0,0 +1,62 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that `aclocal --install' create the local m4 directory if
+# necessary.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+MY_MACRO
+END
+
+mkdir dirlist-test
+cat > dirlist-test/my-defs.m4 <<END
+AC_DEFUN([MY_MACRO], [:])
+END
+
+ACLOCAL_TESTSUITE_FLAGS='-I foo' $ACLOCAL --install
+ls -l . foo
+test -f foo/my-defs.m4
+
+cwd=`pwd`
+case $pwd in
+ *$sp*|*$tab*)
+ : cannot run this check
+ ;;
+ *)
+ ACLOCAL_TESTSUITE_FLAGS="-I $cwd/bar" $ACLOCAL --install
+ ls -l . bar
+ test -f bar/my-defs.m4
+ ;;
+esac
+
+mkdir zardoz
+# What should happen:
+# * quux should be created, and required m4 files copied into there.
+# * zardoz shouldn't be preferred to quux, if if the former exists while
+# the latter does not.
+# * blah shouldn't be uselessly created.
+ACLOCAL_TESTSUITE_FLAGS='-I quux -I zardoz -I blah' $ACLOCAL --install
+ls -l . quux zardoz
+grep MY_MACRO quux/my-defs.m4
+ls zardoz | grep . && Exit 1
+test -d blah || test -r blah && Exit 1
+
+:
diff --git a/tests/aclocal-no-install-no-mkdir.test
b/tests/aclocal-no-install-no-mkdir.test
new file mode 100755
index 0000000..c826c5e
--- /dev/null
+++ b/tests/aclocal-no-install-no-mkdir.test
@@ -0,0 +1,39 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that `aclocal' do not create non-existent local m4 directory
+# if the `--install' option is not given.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+MY_MACRO
+END
+
+mkdir dirlist-test
+cat > dirlist-test/my-defs.m4 <<END
+AC_DEFUN([MY_MACRO], [:])
+END
+
+# Ignore the exit status of aclocal; that is checked in other tests.
+ACLOCAL_TESTSUITE_FLAGS='-I foo' $ACLOCAL -I bar || :
+test ! -d foo && test ! -r foo
+test ! -d bar && test ! -r bar
+
+:
diff --git a/tests/aclocal-verbose-install.test
b/tests/aclocal-verbose-install.test
new file mode 100755
index 0000000..5479ed4
--- /dev/null
+++ b/tests/aclocal-verbose-install.test
@@ -0,0 +1,53 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check verbose messages by `aclocal --install'.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+MY_MACRO_BAR
+MY_MACRO_QUUX
+END
+
+mkdir dirlist-test
+cat > dirlist-test/bar.m4 <<END
+AC_DEFUN([MY_MACRO_BAR], [:])
+END
+cat > dirlist-test/quux.m4 <<END
+AC_DEFUN([MY_MACRO_QUUX], [:])
+END
+
+mkdir foodir
+: > foodir/bar.m4
+
+ACLOCAL_TESTSUITE_FLAGS='-I foodir' $ACLOCAL --install --verbose 2>stderr \
+ || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep ' installing .*dirlist-test/bar\.m4.* to .*foodir/bar\.m4' stderr
+grep ' installing .*dirlist-test/quux\.m4.* to .*foodir/quux\.m4' stderr
+grep ' overwriting .*foodir/bar\.m4.* with .*dirlist-test/bar\.m4' stderr
+grep ' installing .*foodir/quux\.m4.* from .*dirlist-test/quux\.m4' stderr
+
+# Sanity checks.
+ls -l foodir
+grep MY_MACRO_BAR foodir/bar.m4
+grep MY_MACRO_QUUX foodir/quux.m4
+
+:
--
1.7.2.3