automake
[Top][All Lists]
Advanced

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

[RFC] Make build and install dirs used by distcheck configurable. (was:


From: Stefano Lattarini
Subject: [RFC] Make build and install dirs used by distcheck configurable. (was: Re: absolute build directory with spaces)
Date: Mon, 6 Sep 2010 22:35:42 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

On Sunday 05 September 2010, Ralf Wildenhues wrote:
> Hello,
> 
> * Jim Meyering wrote on Sat, Sep 04, 2010 at 07:28:58PM CEST:
> > Stefano Lattarini wrote:
> > > What about instead making the names of the temporaries
> > > source/build/install directories used by "make distcheck"
> > > configurable?
It turns out that making the srcdir configurable is not very easy or
natural; also, I don't see any real use case for that.  So I didn't
add this feature in the patch series.  If anyone would find this
feature useful nonetheless, please speak up.
> > > This will offer more flexibility, and won't
> > > introduce still another automake option which would make
> > > backward-compatibility more problematic.
> > > 
> > > I was thinking of something on these lines:
> > >   $ cat Makefile.am
> > >   ...
> > >   AM_DISTCHECK_BUILDDIR_NAME = _ b u i l d ## will be relative to 
> > > $(distdir)
> > >   AM_DISTCHECK_SRCDIR_NAME = .             ## likewise
> > >   AM_DISTCHECK_INSTALLDIR_NAME = address@hidden   ## likewise
In the end, I went for the slighty shorter names `AM_DISTCHECK_BUILDDIR'
and `AM_DISTCHECK_INSTALLDIR'.
> > > 
> > > If you like the proposal, I might try to implement this (but not
> > > right away).
> > 
> > I do like it.  Thanks!
> 
> Me too, but the onus for quoting should probably be with the person
> defining the variables, because there is no well-defined way to do
> otherwise.  (And of course you cannot have comments in variables.)
In my patch, I let Automake take the onus for quoting, the only additional
limit being that AM_DISTCHECK_BUILDDIR and AM_DISTCHECK_INSTALLDIR cannot
contain the single-quote character.  We might still change this of course,
as the attached patch is mostly tentative.
> I like it also because some packages will never want to care about
> being buildable under more stressful circumstances.

IMPORTANT NOTE: I still haven't run the whole testsuite against this
patch.  I will if they are no serious objection or proposals of
changes/extensions.

Regards,
  Stefano

-*-*-*-

Make build and install dirs used by distcheck configurable.

* automake.in (generate_makefile): Define makefile variables
AM_DISTCHECK_BUILDDIR and AM_DISTCHECK_INSTALLDIR when needed;
they default respectively to `_build' and `_inst'.
* lib/am/distdir.am (distcheck): Sanitize and honour variables
$(AM_DISTCHECK_BUILDDIR) and $(AM_DISTCHECK_INSTALLDIR).
* tests/distcheck0.test: New test script.
* tests/distcheck1a.test: Likewise.
* tests/distcheck1b.test: Likewise.
* tests/distcheck2a.test: Likewise.
* tests/distcheck2b.test: Likewise.
* tests/distcheck3.test: Likewise.
* tests/distcheck4.test: Likewise.
* tests/distcheck5.test: Likewise.
* tests/distcheck6.test: Likewise.
* tests/distcheck7.test: Likewise.
* tests/distcheck8.test: Likewise.
* tests/distcheck9.test: Likewise.
* tests/Makefile.am (TESTS): Updated.
---
 ChangeLog              |   22 +++++++
 Makefile.in            |   42 +++++++++++--
 automake.in            |    9 +++
 lib/am/distdir.am      |   50 +++++++++++++---
 tests/Makefile.am      |   12 ++++
 tests/Makefile.in      |   12 ++++
 tests/distcheck0.test  |   45 ++++++++++++++
 tests/distcheck1a.test |   56 +++++++++++++++++
 tests/distcheck1b.test |   61 +++++++++++++++++++
 tests/distcheck2a.test |   69 +++++++++++++++++++++
 tests/distcheck2b.test |   74 +++++++++++++++++++++++
 tests/distcheck3.test  |   79 ++++++++++++++++++++++++
 tests/distcheck4.test  |   71 ++++++++++++++++++++++
 tests/distcheck5.test  |   77 ++++++++++++++++++++++++
 tests/distcheck6.test  |   88 +++++++++++++++++++++++++++
 tests/distcheck7.test  |   86 ++++++++++++++++++++++++++
 tests/distcheck8.test  |  156 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/distcheck9.test  |   50 +++++++++++++++
 18 files changed, 1044 insertions(+), 15 deletions(-)
 create mode 100755 tests/distcheck0.test
 create mode 100755 tests/distcheck1a.test
 create mode 100755 tests/distcheck1b.test
 create mode 100755 tests/distcheck2a.test
 create mode 100755 tests/distcheck2b.test
 create mode 100755 tests/distcheck3.test
 create mode 100755 tests/distcheck4.test
 create mode 100755 tests/distcheck5.test
 create mode 100755 tests/distcheck6.test
 create mode 100755 tests/distcheck7.test
 create mode 100755 tests/distcheck8.test
 create mode 100755 tests/distcheck9.test
From bd9c7804d24297ef9e3c9e7492a1247a71f9279a Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Sun, 5 Sep 2010 12:00:05 +0200
Subject: [PATCH] Make build and install dirs used by distcheck configurable.

* automake.in (generate_makefile): Define makefile variables
AM_DISTCHECK_BUILDDIR and AM_DISTCHECK_INSTALLDIR when needed;
they default respectively to `_build' and `_inst'.
* lib/am/distdir.am (distcheck): Sanitize and honour variables
$(AM_DISTCHECK_BUILDDIR) and $(AM_DISTCHECK_INSTALLDIR).
* tests/distcheck0.test: New test script.
* tests/distcheck1a.test: Likewise.
* tests/distcheck1b.test: Likewise.
* tests/distcheck2a.test: Likewise.
* tests/distcheck2b.test: Likewise.
* tests/distcheck3.test: Likewise.
* tests/distcheck4.test: Likewise.
* tests/distcheck5.test: Likewise.
* tests/distcheck6.test: Likewise.
* tests/distcheck7.test: Likewise.
* tests/distcheck8.test: Likewise.
* tests/distcheck9.test: Likewise.
* tests/Makefile.am (TESTS): Updated.
---
 ChangeLog              |   22 +++++++
 Makefile.in            |   42 +++++++++++--
 automake.in            |    9 +++
 lib/am/distdir.am      |   50 +++++++++++++---
 tests/Makefile.am      |   12 ++++
 tests/Makefile.in      |   12 ++++
 tests/distcheck0.test  |   45 ++++++++++++++
 tests/distcheck1a.test |   56 +++++++++++++++++
 tests/distcheck1b.test |   61 +++++++++++++++++++
 tests/distcheck2a.test |   69 +++++++++++++++++++++
 tests/distcheck2b.test |   74 +++++++++++++++++++++++
 tests/distcheck3.test  |   79 ++++++++++++++++++++++++
 tests/distcheck4.test  |   71 ++++++++++++++++++++++
 tests/distcheck5.test  |   77 ++++++++++++++++++++++++
 tests/distcheck6.test  |   88 +++++++++++++++++++++++++++
 tests/distcheck7.test  |   86 ++++++++++++++++++++++++++
 tests/distcheck8.test  |  156 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/distcheck9.test  |   50 +++++++++++++++
 18 files changed, 1044 insertions(+), 15 deletions(-)
 create mode 100755 tests/distcheck0.test
 create mode 100755 tests/distcheck1a.test
 create mode 100755 tests/distcheck1b.test
 create mode 100755 tests/distcheck2a.test
 create mode 100755 tests/distcheck2b.test
 create mode 100755 tests/distcheck3.test
 create mode 100755 tests/distcheck4.test
 create mode 100755 tests/distcheck5.test
 create mode 100755 tests/distcheck6.test
 create mode 100755 tests/distcheck7.test
 create mode 100755 tests/distcheck8.test
 create mode 100755 tests/distcheck9.test

diff --git a/ChangeLog b/ChangeLog
index 825589d..cf1964c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2010-09-06 Stefano Lattarini  <address@hidden>
+
+       Make build and install dirs used by distcheck configurable.
+       * automake.in (generate_makefile): Define makefile variables
+       AM_DISTCHECK_BUILDDIR and AM_DISTCHECK_INSTALLDIR when needed;
+       they default respectively to `_build' and `_inst'.
+       * lib/am/distdir.am (distcheck): Sanitize and honour variables
+       $(AM_DISTCHECK_BUILDDIR) and $(AM_DISTCHECK_INSTALLDIR).
+       * tests/distcheck0.test: New test script.
+       * tests/distcheck1a.test: Likewise.
+       * tests/distcheck1b.test: Likewise.
+       * tests/distcheck2a.test: Likewise.
+       * tests/distcheck2b.test: Likewise.
+       * tests/distcheck3.test: Likewise.
+       * tests/distcheck4.test: Likewise.
+       * tests/distcheck5.test: Likewise.
+       * tests/distcheck6.test: Likewise.
+       * tests/distcheck7.test: Likewise.
+       * tests/distcheck8.test: Likewise.
+       * tests/distcheck9.test: Likewise.
+       * tests/Makefile.am (TESTS): Updated.
+
 2010-09-02  Peter Rosin  <address@hidden>
 
        Make ar-lib support backslashed files in archives.
diff --git a/Makefile.in b/Makefile.in
index 3a89eba..be7a436 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -685,6 +685,33 @@ dist dist-all:
 # it guarantees that the distribution is self-contained by making another
 # tarfile.
 distcheck: dist
+       @set -x; \
+        estatus=0; \
+        case '$(AM_DISTCHECK_BUILDDIR)' in \
+          /*) \
+            echo "$@: ERROR: AM_DISTCHECK_BUILDDIR is an absolute" \
+                 'path: $(AM_DISTCHECK_BUILDDIR)' >&2; \
+            estatus=1;; \
+        esac; \
+        case '$(AM_DISTCHECK_INSTALLDIR)' in \
+          /*) \
+            echo "$@: ERROR: AM_DISTCHECK_INSTALLDIR is an absolute" \
+                 'path: $(AM_DISTCHECK_INSTALLDIR)' >&2; \
+            estatus=1;; \
+        esac; \
+        case '/$(AM_DISTCHECK_BUILDDIR)/' in \
+          */../*) \
+            echo "$@: ERROR: AM_DISTCHECK_BUILDDIR contains a \`..'" \
+                 'component: $(AM_DISTCHECK_BUILDDIR)' >&2; \
+            estatus=1;; \
+        esac; \
+        case '/$(AM_DISTCHECK_INSTALLDIR)/' in \
+          */../*) \
+            echo "$@: ERROR: AM_DISTCHECK_INSTALLDIR contains a \`..'" \
+                 'component: $(AM_DISTCHECK_INSTALLDIR)' >&2; \
+            estatus=1;; \
+        esac; \
+        exit $$estatus
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
          GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
@@ -704,15 +731,18 @@ distcheck: dist
          unzip $(distdir).zip ;;\
        esac
        chmod -R a-w $(distdir); chmod a+w $(distdir)
-       mkdir $(distdir)/_build
-       mkdir $(distdir)/_inst
+       $(MKDIR_P) '$(distdir)/$(AM_DISTCHECK_BUILDDIR)'
+       $(MKDIR_P) '$(distdir)/$(AM_DISTCHECK_INSTALLDIR)'
        chmod a-w $(distdir)
-       test -d $(distdir)/_build || exit 0; \
-       dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 
's,^[^:\\/]:[\\/],/,'` \
+       test -d '$(distdir)/$(AM_DISTCHECK_BUILDDIR)' || exit 0; \
+       dc_install_base=`$(am__cd) '$(distdir)/$(AM_DISTCHECK_INSTALLDIR)' \
+                          && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
          && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
          && am__cwd=`pwd` \
-         && $(am__cd) $(distdir)/_build \
-         && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+         && dc_srcdir=`$(am__cd) $(distdir) && pwd` \
+         && $(am__cd) '$(distdir)/$(AM_DISTCHECK_BUILDDIR)' \
+         && "$$dc_srcdir/configure" --srcdir="$$dc_srcdir" \
+           --prefix="$$dc_install_base" \
            $(DISTCHECK_CONFIGURE_FLAGS) \
          && $(MAKE) $(AM_MAKEFLAGS) \
          && $(MAKE) $(AM_MAKEFLAGS) dvi \
diff --git a/automake.in b/automake.in
index c0c5289..c25021e 100644
--- a/automake.in
+++ b/automake.in
@@ -8207,6 +8207,15 @@ sub generate_makefile ($$)
   # Must do this after reading .am file.
   define_variable ('subdir', $relative_dir, INTERNAL);
 
+  # Name of temporary build and install directories used by "make
+  # distcheck".  These variables are obviously required only in the
+  # top-level Makefile, i.e. when `$relative_dir' is `.'.
+  if (! option 'no-dist' && $relative_dir eq '.')
+    {
+      define_variable ('AM_DISTCHECK_BUILDDIR', '_build', INTERNAL);
+      define_variable ('AM_DISTCHECK_INSTALLDIR', '_inst', INTERNAL);
+    }
+
   # If DIST_SUBDIRS is defined, make sure SUBDIRS is, so that
   # recursive rules are enabled.
   define_pretty_variable ('SUBDIRS', TRUE, INTERNAL, '')
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index fd82838..aedd4ac 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -434,6 +434,35 @@ endif %?SUBDIRS%
 # tarfile.
 .PHONY: distcheck
 distcheck: dist
+## Sanitize $(AM_DISTCHECK_BUILDDIR) and $(AM_DISTCHECK_INSTALLDIR).
+       @set -x; \
+        estatus=0; \
+        case '$(AM_DISTCHECK_BUILDDIR)' in \
+          /*) \
+            echo "$@: ERROR: AM_DISTCHECK_BUILDDIR is an absolute" \
+                 'path: $(AM_DISTCHECK_BUILDDIR)' >&2; \
+            estatus=1;; \
+        esac; \
+        case '$(AM_DISTCHECK_INSTALLDIR)' in \
+          /*) \
+            echo "$@: ERROR: AM_DISTCHECK_INSTALLDIR is an absolute" \
+                 'path: $(AM_DISTCHECK_INSTALLDIR)' >&2; \
+            estatus=1;; \
+        esac; \
+        case '/$(AM_DISTCHECK_BUILDDIR)/' in \
+          */../*) \
+            echo "$@: ERROR: AM_DISTCHECK_BUILDDIR contains a \`..'" \
+                 'component: $(AM_DISTCHECK_BUILDDIR)' >&2; \
+            estatus=1;; \
+        esac; \
+        case '/$(AM_DISTCHECK_INSTALLDIR)/' in \
+          */../*) \
+            echo "$@: ERROR: AM_DISTCHECK_INSTALLDIR contains a \`..'" \
+                 'component: $(AM_DISTCHECK_INSTALLDIR)' >&2; \
+            estatus=1;; \
+        esac; \
+        exit $$estatus
+## Create source directory from distribution tarball.
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
          GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
@@ -456,8 +485,8 @@ distcheck: dist
 ## this case.  However, make the top-level directory writable so we
 ## can make our new subdirs.
        chmod -R a-w $(distdir); chmod a+w $(distdir)
-       mkdir $(distdir)/_build
-       mkdir $(distdir)/_inst
+       $(MKDIR_P) '$(distdir)/$(AM_DISTCHECK_BUILDDIR)'
+       $(MKDIR_P) '$(distdir)/$(AM_DISTCHECK_INSTALLDIR)'
 ## Undo the write access.
        chmod a-w $(distdir)
 ## With GNU make, the following command will be executed even with `make -n',
@@ -465,11 +494,12 @@ distcheck: dist
 ## is necessary for things like parallel distcheck), but here we don't want
 ## execution.  To avoid MAKEFLAGS parsing hassles, use a witness file that a
 ## non-`-n' run would have just created.
-       test -d $(distdir)/_build || exit 0; \
-## Compute the absolute path of `_inst'.  Strip any leading DOS drive
-## to allow DESTDIR installations.  Otherwise "$(DESTDIR)$(prefix)" would
-## expand to "c:/temp/am-dc-5668/c:/src/package/package-1.0/_inst".
-       dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 
's,^[^:\\/]:[\\/],/,'` \
+       test -d '$(distdir)/$(AM_DISTCHECK_BUILDDIR)' || exit 0; \
+## Compute the absolute path of temporary install directory.  Strip any leading
+## DOS drive to allow DESTDIR installations. Otherwise "$(DESTDIR)$(prefix)"
+## would expand to e.g. "c:/temp/am-dc-5668/c:/src/package/package-1.0/_inst".
+       dc_install_base=`$(am__cd) '$(distdir)/$(AM_DISTCHECK_INSTALLDIR)' \
+                          && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
 ## We will attempt a DESTDIR install in $dc_destdir.  We don't
 ## create this directory under $dc_install_base, because it would
 ## create very long directory names.
@@ -478,8 +508,10 @@ distcheck: dist
 ## Parallel BSD make may not start a new shell for each command in a recipe,
 ## so be sure to `cd' back to the original directory after this.
          && am__cwd=`pwd` \
-         && $(am__cd) $(distdir)/_build \
-         && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+         && dc_srcdir=`$(am__cd) $(distdir) && pwd` \
+         && $(am__cd) '$(distdir)/$(AM_DISTCHECK_BUILDDIR)' \
+         && "$$dc_srcdir/configure" --srcdir="$$dc_srcdir" \
+           --prefix="$$dc_install_base" \
 ?GETTEXT?          --with-included-gettext \
 ## Additional flags for configure.  Keep this last in the configure
 ## invocation so the user can override previous options.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d86b03b..7d3c0c5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -300,6 +300,18 @@ dirlist.test \
 dirlist2.test \
 discover.test \
 distcleancheck.test \
+distcheck0.test \
+distcheck1a.test \
+distcheck1b.test \
+distcheck2a.test \
+distcheck2b.test \
+distcheck3.test \
+distcheck4.test \
+distcheck5.test \
+distcheck6.test \
+distcheck7.test \
+distcheck8.test \
+distcheck9.test \
 distcom2.test \
 distcom3.test \
 distcom4.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 77ec888..2db8158 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -511,6 +511,18 @@ dirlist.test \
 dirlist2.test \
 discover.test \
 distcleancheck.test \
+distcheck0.test \
+distcheck1a.test \
+distcheck1b.test \
+distcheck2a.test \
+distcheck2b.test \
+distcheck3.test \
+distcheck4.test \
+distcheck5.test \
+distcheck6.test \
+distcheck7.test \
+distcheck8.test \
+distcheck9.test \
 distcom2.test \
 distcom3.test \
 distcom4.test \
diff --git a/tests/distcheck0.test b/tests/distcheck0.test
new file mode 100755
index 0000000..d7f10ad
--- /dev/null
+++ b/tests/distcheck0.test
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Copyright (C) 2010 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 automake defines `AM_DISTCHECK_BUILDDIR' and
+# `AM_DISTCHECK_INSTALLDIR' to proper defaults.  These defaults
+# are better not changed for backward-compatibility reasons.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+check-local:
+       test x'$(AM_DISTCHECK_BUILDDIR)' = x'_build'
+       test x'$(AM_DISTCHECK_INSTALLDIR)' = x'_inst'
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE
+$MAKE check
+$MAKE distcheck
+
+:
diff --git a/tests/distcheck1a.test b/tests/distcheck1a.test
new file mode 100755
index 0000000..0d0f44b
--- /dev/null
+++ b/tests/distcheck1a.test
@@ -0,0 +1,56 @@
+#! /bin/sh
+# Copyright (C) 2010 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 the user cann override the builddir used by the
+# distcheck rule.
+# Keep this in sync with sister test distcheck1b.test.
+# See also similar tests distcheck{2a,2b,3,4,5,6}.test.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+echo "me = $me" > Makefile.am
+cat >> Makefile.am << 'END'
+AM_DISTCHECK_BUILDDIR = OverriddenBuildDirectory
+check-local:
+       cwd=`pwd` \
+         && echo "*** $(me): INFO: cwd: $$cwd" \
+         && case $$cwd in \
+              */$(distdir)/OverriddenBuildDirectory) true;; \
+              *) false;; \
+            esac
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+# These variables should both be defined.
+grep '^ *AM_DISTCHECK_BUILDDIR *=' Makefile.in
+grep '^ *AM_DISTCHECK_INSTALLDIR *=' Makefile.in
+
+./configure
+
+$MAKE
+$MAKE check && Exit 1 # sanity check
+$MAKE distcheck
+
+:
diff --git a/tests/distcheck1b.test b/tests/distcheck1b.test
new file mode 100755
index 0000000..82769c7
--- /dev/null
+++ b/tests/distcheck1b.test
@@ -0,0 +1,61 @@
+#! /bin/sh
+# Copyright (C) 2010 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 the user cann override the builddir used by the distcheck
+# rule, even through indirections with other makefile variables.
+# Keep this in sync with sister test distcheck1a.test.
+# See also similar tests distcheck{2a,2b,3,4,5,6}.test.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+echo "me = $me" > Makefile.am
+cat >> Makefile.am << 'END'
+foo = Overridden
+bar = $(zardoz)
+baz = Dir$(empty)ectory
+empty =
+zardoz = Build
+AM_DISTCHECK_BUILDDIR = $(foo)$(bar)$(baz)
+check-local:
+       cwd=`pwd` \
+         && echo "*** $(me): INFO: cwd: $$cwd" \
+         && case $$cwd in \
+              */$(distdir)/OverriddenBuildDirectory) true;; \
+              *) false;; \
+            esac
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+# These variables should both be defined.
+grep '^ *AM_DISTCHECK_BUILDDIR *=' Makefile.in
+grep '^ *AM_DISTCHECK_INSTALLDIR *=' Makefile.in
+
+./configure
+
+$MAKE
+$MAKE check && Exit 1 # sanity check
+$MAKE distcheck
+
+:
diff --git a/tests/distcheck2a.test b/tests/distcheck2a.test
new file mode 100755
index 0000000..4bdeb19
--- /dev/null
+++ b/tests/distcheck2a.test
@@ -0,0 +1,69 @@
+#! /bin/sh
+# Copyright (C) 2010 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 the user cann override the installdir used by the
+# distcheck rule.
+# Keep this in sync with sister test distcheck2b.test.
+# See also similar tests distcheck{1a,1b,3,4,5,6}.test.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+echo "me = $me" > Makefile.am
+cat >> Makefile.am << 'END'
+AM_DISTCHECK_INSTALLDIR = OverriddenInstallDirectory
+foodir = ${prefix}
+dist_foo_DATA = foo.txt
+check-local:
+       echo "*** $(me): INFO: prefix: $(prefix)"
+       case '$(prefix)' in \
+         */$(distdir)/OverriddenInstallDirectory) exit 0;; \
+         *) exit 1;; \
+       esac
+installcheck-local:
+       ## Will be run inside the builddir, so that $(distdir) is in `..'
+        ## Do a sanity check about this.
+       uwd=`(cd .. && pwd)` \
+         && echo "*** $(me): INFO: uwd: $$uwd" \
+         && case $$uwd in \
+              */$(distdir)) true;; \
+              *) false;; \
+            esac
+       test -f ../OverriddenInstallDirectory/foo.txt
+END
+
+: > foo.txt
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+# These variables should both be defined.
+grep '^ *AM_DISTCHECK_BUILDDIR *=' Makefile.in
+grep '^ *AM_DISTCHECK_INSTALLDIR *=' Makefile.in
+
+./configure
+
+$MAKE
+$MAKE check && Exit 1 # sanity check
+$MAKE distcheck
+
+:
diff --git a/tests/distcheck2b.test b/tests/distcheck2b.test
new file mode 100755
index 0000000..48a69f8
--- /dev/null
+++ b/tests/distcheck2b.test
@@ -0,0 +1,74 @@
+#! /bin/sh
+# Copyright (C) 2010 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 the user cann override the builddir used by the distcheck
+# rule, even through indirections with other makefile variables.
+# Keep this in sync with sister test distcheck2a.test.
+# See also similar tests distcheck{1a,1b,3,4,5,6}.test.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+echo "me = $me" > Makefile.am
+cat >> Makefile.am << 'END'
+foo = Overridden
+bar = $(zardoz)
+baz = Dir$(empty)ectory
+empty =
+zardoz = Install
+AM_DISTCHECK_INSTALLDIR = $(foo)$(bar)$(baz)
+foodir = ${prefix}
+dist_foo_DATA = foo.txt
+check-local:
+       echo "*** $(me): INFO: prefix: $(prefix)"
+       case '$(prefix)' in \
+         */$(distdir)/OverriddenInstallDirectory) exit 0;; \
+         *) exit 1;; \
+       esac
+installcheck-local:
+       ## Will be run inside the builddir, so that $(distdir) is in `..'
+        ## Do a sanity check about this.
+       uwd=`(cd .. && pwd)` \
+         && echo "*** $(me): INFO: uwd: $$uwd" \
+         && case $$uwd in \
+              */$(distdir)) true;; \
+              *) false;; \
+            esac
+       test -f ../OverriddenInstallDirectory/foo.txt
+END
+
+: > foo.txt
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+# These variables should both be defined.
+grep '^ *AM_DISTCHECK_BUILDDIR *=' Makefile.in
+grep '^ *AM_DISTCHECK_INSTALLDIR *=' Makefile.in
+
+./configure
+
+$MAKE
+$MAKE check && Exit 1 # sanity check
+$MAKE distcheck
+
+:
diff --git a/tests/distcheck3.test b/tests/distcheck3.test
new file mode 100755
index 0000000..8ae1638
--- /dev/null
+++ b/tests/distcheck3.test
@@ -0,0 +1,79 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test that "distcheck" works when builddir and installdir are both
+# overridden.  Also, check that they work in a project using a
+# recursive layout.
+# See also related tests distcheck{1a,1b,2a,2b,4,5,6}.test.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+echo "me = $me" > Makefile.am
+cat >> Makefile.am << 'END'
+SUBDIRS = sub
+AM_DISTCHECK_INSTALLDIR = OverriddenInstallDirectory
+AM_DISTCHECK_BUILDDIR = OverriddenBuildDirectory
+check-local:
+       cwd=`pwd` \
+         && echo "*** $(me): INFO: cwd: $$cwd" \
+         && case $$cwd in \
+              */$(distdir)/OverriddenBuildDirectory) true;; \
+              *) false;; \
+            esac
+       echo "*** $(me): INFO: prefix: $(prefix)"
+       case '$(prefix)' in \
+         */$(distdir)/OverriddenInstallDirectory) exit 0;; \
+         *) exit 1;; \
+       esac
+installcheck-local:
+       ## Will be run inside the builddir, so that $(distdir) is in `..'
+        ## Do a sanity check about this.
+       uwd=`(cd .. && pwd)` \
+         && echo "*** $(me): INFO: uwd: $$uwd" \
+         && case $$uwd in \
+              */$(distdir)) true;; \
+              *) false;; \
+            esac
+       test -f ../OverriddenInstallDirectory/foo.txt
+END
+
+mkdir sub
+
+cat > sub/Makefile.am << 'END'
+foodir = ${prefix}
+dist_foo_DATA = foo.txt
+END
+
+: > sub/foo.txt
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE
+$MAKE check && Exit 1 # sanity check
+$MAKE distcheck
+
+:
diff --git a/tests/distcheck4.test b/tests/distcheck4.test
new file mode 100755
index 0000000..7a86fef
--- /dev/null
+++ b/tests/distcheck4.test
@@ -0,0 +1,71 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test distcheck builddir and distcheck installdir with multiple
+# components.
+# See also related tests distcheck{1a,1b,2a,2b,3,5,6}.test.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+echo "me = $me" > Makefile.am
+cat >> Makefile.am << 'END'
+AM_DISTCHECK_INSTALLDIR = path/to/install/directory
+AM_DISTCHECK_BUILDDIR = the_build/directory
+foodir = ${prefix}
+dist_foo_DATA = foo.txt
+check-local:
+       cwd=`pwd` \
+         && echo "*** $(me): INFO: cwd: $$cwd" \
+         && case $$cwd in \
+              */$(distdir)/the_build/directory) ;; \
+              *) exit 1;; \
+            esac
+       echo "*** $(me): INFO: prefix: $(prefix)"
+       case '$(prefix)' in \
+         */$(distdir)/path/to/install/directory) exit 0;; \
+         *) exit 1;; \
+       esac
+installcheck-local:
+       ## Will be run inside the builddir, so $(distdir) is in `../..'
+        ## Do a sanity check about this.
+       uwd=`(cd ../.. && pwd)` \
+         && echo "*** $(me): INFO: uwd: $$uwd" \
+         && case $$uwd in \
+              */$(distdir)) true;; \
+              *) false;; \
+            esac
+       test -f ../../path/to/install/directory/foo.txt
+END
+
+: > foo.txt
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE
+$MAKE check && Exit 1 # sanity check
+$MAKE distcheck
+
+:
diff --git a/tests/distcheck5.test b/tests/distcheck5.test
new file mode 100755
index 0000000..a1ef176
--- /dev/null
+++ b/tests/distcheck5.test
@@ -0,0 +1,77 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test distcheck builddir and distcheck installdir with spaces.
+# See also related tests distcheck{1a,1b,2a,2b,3,4,6}.test.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+tab='  '
+mkdir " x$tab" && test -d " x$tab" || Exit 77
+rmdir " x$tab"
+
+echo "me = $me" > Makefile.am
+echo "tab = $tab\$(empty)" >> Makefile.am
+cat >> Makefile.am << 'END'
+spaced_builddir = $(empty) x x  xx$(tab)x $(tab)$(tab)$(empty)
+spaced_instdir  = $(empty) y y  yy$(tab)y $(tab)$(tab)$(empty)
+AM_DISTCHECK_INSTALLDIR = $(empty)$(spaced_instdir)$(empty)
+AM_DISTCHECK_BUILDDIR = $(empty)$(spaced_builddir)$(empty)
+foodir = ${prefix}
+dist_foo_DATA = foo.txt
+check-local:
+       cwd=`pwd` \
+         && echo "*** $(me): INFO: cwd='$$cwd'" \
+         && case $$cwd in \
+              */$(distdir)/'$(spaced_builddir)');; \
+              *) exit 1;; \
+            esac
+       echo "*** $(me): INFO: prefix='$(prefix)'"
+       case '$(prefix)' in \
+         */$(distdir)/'$(spaced_instdir)') exit 0;; \
+         *) exit 1;; \
+       esac
+installcheck-local:
+       ## Will be run inside the builddir, so $(distdir) is in `..'
+        ## Do a sanity check about this.
+       uwd=`(cd .. && pwd)` \
+         && echo "*** $(me): INFO: uwd='$$uwd'" \
+         && case $$uwd in \
+              */$(distdir)) true;; \
+              *) false;; \
+            esac
+       test -f '../$(spaced_instdir)/foo.txt'
+END
+
+: > foo.txt
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE
+$MAKE check && Exit 1 # sanity check
+$MAKE distcheck
+
+:
diff --git a/tests/distcheck6.test b/tests/distcheck6.test
new file mode 100755
index 0000000..90d678e
--- /dev/null
+++ b/tests/distcheck6.test
@@ -0,0 +1,88 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test distcheck builddir and distcheck installdir with globbing
+# characters.
+# Keep this in sync with sister test distcheck7.test.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+# This match at least configure.in in the distdir.
+glob_1='[xc]?nfigure.??'
+# This match at least Makefile.am and Makefile.in in the distdir.
+glob_2='Makefile.*'
+
+mkdir "$glob_1" && test -d "$glob_1" || Exit 77
+mkdir "$glob_2" && test -d "$glob_2" || Exit 77
+rmdir "$glob_1" "$glob_2"
+
+builddir=$glob_1
+instdir=$glob_2
+
+cat > Makefile.am << END
+AM_DISTCHECK_INSTALLDIR = $instdir
+AM_DISTCHECK_BUILDDIR = $builddir
+foodir = \${prefix}
+dist_foo_DATA = foo.txt
+dist-hook: ## sanity check
+       cd \$(distdir) && ls -1 $glob_1 > ../t1 && ls -1 $glob_2 > ../t2
+       cat t1 && cat t2
+       grep '^configure\.in\$\$' t1
+       grep '^Makefile\.in\$\$' t2
+       grep '^Makefile\.am\$\$' t2
+       rm -f t1 t2
+check-local:
+       cwd=\`pwd\` \
+         && echo "*** $me: INFO: cwd: \$\$cwd" \
+         && case \$\$cwd in \
+              */\$(distdir)/'$builddir');; \
+              *) exit 1;; \
+            esac
+       echo '*** $me: INFO: prefix: \$(prefix)'
+       case '\$(prefix)' in \
+         */\$(distdir)/'$instdir') ;; \
+         *) exit 1;; \
+       esac
+installcheck-local:
+       ## Will be run inside the builddir, so \$(distdir) is in '..'
+        ## Do a sanity check about this.
+       uwd=\`(cd .. && pwd)\` \
+         && echo "*** $me: INFO: uwd: \$\$uwd" \
+         && case \$\$uwd in \
+              */\$(distdir)) true;; \
+              *) false;; \
+            esac
+       test -f '../$instdir/foo.txt'
+END
+
+: > foo.txt
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE
+$MAKE distcheck
+
+:
diff --git a/tests/distcheck7.test b/tests/distcheck7.test
new file mode 100755
index 0000000..7f7c8f3
--- /dev/null
+++ b/tests/distcheck7.test
@@ -0,0 +1,86 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test distcheck builddir and distcheck installdir with meta-characters.
+# Keep this in sync with sister test distcheck6.test.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+# Autoconf-generated scripts refuses to work in a directory
+# whose absolute path contains one of the following characters:
+# ' ` " # $ & \ (newline)
+# The newline is not acceptable due to make limitations.
+# The `$' carachter is problematic due to make limitations.
+# The double-quote and the back-quote carachter is problematic
+# due to Automake limitations.
+# The single quote and the `#' character are not acceptable
+# due to make limitations and implementation details of the
+# "distcheck" target.
+weird_chars='?*(@)[=]<;>'
+
+mkdir "$weird_chars" && test -d "$weird_chars" || Exit 77
+rmdir "$weird_chars"
+
+builddir=_build_$weird_chars
+instdir=_inst_$weird_chars
+
+cat > Makefile.am << END
+AM_DISTCHECK_INSTALLDIR = $instdir
+AM_DISTCHECK_BUILDDIR = $builddir
+foodir = \${prefix}
+dist_foo_DATA = foo.txt
+check-local:
+       cwd=\`pwd\` \
+         && echo "*** $me: INFO: cwd: \$\$cwd" \
+         && case \$\$cwd in \
+              */\$(distdir)/'$builddir');; \
+              *) exit 1;; \
+            esac
+       echo '*** $me: INFO: prefix: \$(prefix)'
+       case '\$(prefix)' in \
+         */\$(distdir)/'$instdir') ;; \
+         *) exit 1;; \
+       esac
+installcheck-local:
+       ## Will be run inside the builddir, so \$(distdir) is in '..'
+       ## Do a sanity check about this.
+       uwd=\`(cd .. && pwd)\` \
+         && echo "*** $me: INFO: uwd: \$\$uwd" \
+         && case \$\$uwd in \
+              */\$(distdir)) true;; \
+              *) false;; \
+            esac
+       test -f '../$instdir/foo.txt'
+END
+
+: > foo.txt
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE
+$MAKE distcheck
+
+:
diff --git a/tests/distcheck8.test b/tests/distcheck8.test
new file mode 100755
index 0000000..78c69b8
--- /dev/null
+++ b/tests/distcheck8.test
@@ -0,0 +1,156 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test that "make distcheck" complains and abort properly when builddir
+# and installdir are overridden with bad values.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+distdir=$me-1.0
+
+# run once and for all, since we are not going to modify configure.in
+$ACLOCAL
+$AUTOCONF
+
+#-#-#
+
+cat > Makefile.am << 'END'
+AM_DISTCHECK_INSTALLDIR = /install/path
+AM_DISTCHECK_BUILDDIR = /build/path
+END
+
+$AUTOMAKE
+
+./configure
+
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+test ! -d $distdir
+test ! -r $distdir
+grep 'ERROR:.* AM_DISTCHECK_INSTALLDIR.*absolute path' output
+grep 'ERROR:.* AM_DISTCHECK_BUILDDIR.*absolute path' output
+grep 'ERROR:.*/install/path' output
+grep 'ERROR:.*/build/path' output
+
+#-#-#
+
+cat > Makefile.am << 'END'
+AM_DISTCHECK_INSTALLDIR = foobar/..
+AM_DISTCHECK_BUILDDIR = zardoz/..
+END
+
+$AUTOMAKE
+
+./configure
+
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+test ! -d $distdir
+test ! -r $distdir
+grep "ERROR:.* AM_DISTCHECK_INSTALLDIR.*['\`]\\.\\.' component" output
+grep "ERROR:.* AM_DISTCHECK_BUILDDIR.*['\`]\\.\\.' component" output
+grep 'ERROR:.*foobar/\.\.' output
+grep 'ERROR:.*zardoz/\.\.' output
+
+#-#-#
+
+cat > Makefile.am << 'END'
+AM_DISTCHECK_INSTALLDIR = ../foobar
+AM_DISTCHECK_BUILDDIR = ../zardoz
+END
+
+$AUTOMAKE
+
+./configure
+
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+test ! -d $distdir
+test ! -r $distdir
+grep "ERROR:.* AM_DISTCHECK_INSTALLDIR.*['\`]\\.\\.' component" output
+grep "ERROR:.* AM_DISTCHECK_BUILDDIR.*['\`]\\.\\.' component" output
+grep 'ERROR:.*\.\./foobar' output
+grep 'ERROR:.*\.\./zardoz' output
+
+#-#-#
+
+cat > Makefile.am << 'END'
+AM_DISTCHECK_INSTALLDIR = foo/../bar
+AM_DISTCHECK_BUILDDIR = baz/../qux
+END
+
+$AUTOMAKE
+
+./configure
+
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+test ! -d $distdir
+test ! -r $distdir
+grep "ERROR:.* AM_DISTCHECK_INSTALLDIR.*['\`]\\.\\.' component" output
+grep "ERROR:.* AM_DISTCHECK_BUILDDIR.*['\`]\\.\\.' component" output
+grep 'ERROR:.*foo/\.\./bar' output
+grep 'ERROR:.*baz/\.\./qux' output
+
+#-#-#
+
+cat > Makefile.am << 'END'
+AM_DISTCHECK_INSTALLDIR = ..
+AM_DISTCHECK_BUILDDIR = ..
+END
+
+$AUTOMAKE
+
+./configure
+
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+test ! -d $distdir
+test ! -r $distdir
+grep "ERROR:.* AM_DISTCHECK_INSTALLDIR.*['\`]\\.\\.' component" output
+grep "ERROR:.* AM_DISTCHECK_BUILDDIR.*['\`]\\.\\.' component" output
+
+#-#-#
+
+cat > Makefile.am << 'END'
+AM_DISTCHECK_INSTALLDIR = /install/../path
+AM_DISTCHECK_BUILDDIR = /build/../path
+END
+
+$AUTOMAKE
+
+./configure
+
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+test ! -d $distdir
+test ! -r $distdir
+grep 'ERROR:.* AM_DISTCHECK_INSTALLDIR.*absolute path' output
+grep 'ERROR:.* AM_DISTCHECK_BUILDDIR.*absolute path' output
+grep "ERROR:.* AM_DISTCHECK_INSTALLDIR.*['\`]\\.\\.' component" output
+grep "ERROR:.* AM_DISTCHECK_BUILDDIR.*['\`]\\.\\.' component" output
+grep 'ERROR:.*/install/\.\./path' output
+grep 'ERROR:.*/build/\.\./path' output
+
+#-#-#
+
+:
diff --git a/tests/distcheck9.test b/tests/distcheck9.test
new file mode 100755
index 0000000..b86edfe
--- /dev/null
+++ b/tests/distcheck9.test
@@ -0,0 +1,50 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test that assignements to AM_DISTCHECK_BUILDDIR and
+# AM_DISTCHECK_INSTALLDIR are not uselessly generated.
+
+. ./defs || Exit 1
+
+set -e
+
+# Sanity check.
+: > Makefile.am
+$ACLOCAL
+$AUTOMAKE
+$FGREP 'AM_DISTCHECK_BUILDDIR' Makefile.in
+$FGREP 'AM_DISTCHECK_INSTALLDIR' Makefile.in
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = no-dist
+END
+$ACLOCAL
+$AUTOMAKE
+$EGREP 'AM_DISTCHECK_(BUILDDIR|INSTALLDIR)' Makefile.in && Exit 1
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub
+END
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/Makefile])
+END
+mkdir sub
+: > sub/Makefile.am
+$ACLOCAL
+$AUTOMAKE
+$EGREP 'AM_DISTCHECK_(BUILDDIR|INSTALLDIR)' sub/Makefile.in && Exit 1
+
+:
-- 
1.7.1


reply via email to

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