For PR automake/186:
authorAlexandre Duret-Lutz <adl@gnu.org>
Fri, 17 May 2002 10:49:55 +0000 (10:49 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Fri, 17 May 2002 10:49:55 +0000 (10:49 +0000)
* lib/am/distdir.am (distcheck): Attempt a DESTDIR install.
* tests/destdir.test: New file.
* tests/Makefile.am (TESTS): Add destdir.test.

ChangeLog
NEWS
lib/am/distdir.am
tests/Makefile.am
tests/Makefile.in
tests/destdir.test [new file with mode: 0755]

index 3fb5902..09f4da3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-05-17  Alexandre Duret-Lutz  <duret_g@epita.fr>
+
+       For PR automake/186:
+       * lib/am/distdir.am (distcheck): Attempt a DESTDIR install.
+       * tests/destdir.test: New file.
+       * tests/Makefile.am (TESTS): Add destdir.test.
+
 2002-05-16  Alexandre Duret-Lutz  <duret_g@epita.fr>
 
        * automake.in (conditional_true_when): Return false if $WHEN == FALSE.
diff --git a/NEWS b/NEWS
index 1af7979..8133eca 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,6 @@
 New in 1.6a:
+* `make distcheck' will enforce DESTDIR support by attempting
+  a DESTDIR install.
 * `+=' can be used in conditionals, even if the augmented variable
   was defined for another condition.
 * It is no longuer a requirement to use AM_CONFIG_HEADER instead of
index 4b9d46c..ac96b3f 100644 (file)
@@ -270,9 +270,13 @@ distcheck: dist
 ## Undo the write access.
        chmod a-w $(distdir)
        dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
+## We will attemp a DESTDIR install in $dc_destdir.  We don't
+## create this directory under $dc_install_base, because it would
+## create very long directory names.
+         && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
 ?DISTCHECK-HOOK?         && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \
          && cd $(distdir)/=build \
-         && ../configure --srcdir=.. --prefix=$$dc_install_base \
+         && ../configure --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.
@@ -284,10 +288,27 @@ distcheck: dist
          && $(MAKE) $(AM_MAKEFLAGS) installcheck \
          && $(MAKE) $(AM_MAKEFLAGS) uninstall \
 ## We use -le 1 because the `dir' file might still exist after uninstall.
-         && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
+         && (test `find "$$dc_install_base" -type f -print | wc -l` -le 1 \
              || { echo "ERROR: files left after uninstall:" ; \
                   find $$dc_install_base -type f -print ; \
                   exit 1; } >&2 ) \
+## Make sure the package has proper DESTDIR support (we could not test this
+## in the previous install/installcheck/uninstall test, because it's reasonable
+## for installcheck to fails in a DESTDIR install).
+## We make the `$dc_install_base' read-only because this is where files
+## with missing DESTDIR support are likely to be installed.
+         && chmod -R a-w "$$dc_install_base" \
+## The logic here is quire convoluted because we must clean $dc_destdir
+## whatever happens (it won't be erased by the next run of distcheck like
+## $(dirstir) is).
+         && ({   $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+              && (test `find "$$dc_destdir" -type f -print | wc -l` -le 1 \
+                  || { echo "ERROR: files left after uninstall (check DESTDIR support):" ; \
+                       find "$$dc_destdir" -type f -print ; \
+                       exit 1; } >&2 ) \
+             } || { rm -rf "$$dc_destdir"; exit 1; }) \
+         && rm -rf "$$dc_destdir" \
          && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
 ## Make sure to remove the dist file we created in the test build
 ## directory.
index 33e5ed4..4d744bc 100644 (file)
@@ -124,6 +124,7 @@ depend.test \
 depend2.test \
 depend3.test \
 depend4.test \
+destdir.test \
 dirforbid.test \
 dirname.test \
 discover.test \
index 45b4f2a..a1ace4d 100644 (file)
@@ -208,6 +208,7 @@ depend.test \
 depend2.test \
 depend3.test \
 depend4.test \
+destdir.test \
 dirforbid.test \
 dirname.test \
 discover.test \
diff --git a/tests/destdir.test b/tests/destdir.test
new file mode 100755 (executable)
index 0000000..8a4fd8c
--- /dev/null
@@ -0,0 +1,33 @@
+#! /bin/sh
+
+# Make sure that `make distcheck' can find some $(DESTDIR) omissions.
+# PR/186.
+
+. $srcdir/defs || exit 1
+
+set -e
+
+cat >> configure.in <<'EOF'
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+dist_data_DATA = foo
+
+# This rule is bogus because it doesn't use $(DESTDIR) on the
+# second argument of cp.  distcheck is expected to catch this.
+install-data-hook:
+       cp $(DESTDIR)$(datadir)/foo $(datadir)/bar
+
+uninstall-local:
+       rm -f $(DESTDIR)$(datadir)/bar
+EOF
+
+: > foo
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+$MAKE distcheck && exit 1
+: