distcheck: don't allow overriding of --prefix and --srcdir by the user
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 30 Oct 2013 21:41:39 +0000 (21:41 +0000)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 30 Oct 2013 22:26:01 +0000 (22:26 +0000)
Not through AM_DISTCHECK_FLAGS, nor through DISTCHECK_FLAGS.  Apparently,
some packages got in the habit of relaying all the options passed to the
original ./configure invocation through to the configure invocations
in "make distcheck".  This was causing problems, because it also passed
through the original --srcdir and --prefix options.

Fixes: expose bug#14991 (relates to 'distcheck')

* lib/am/distdir.am (distcheck): Pass the hard-coded --srcdir and
--prefix options *after* both the developer-defined options in
$(AM_DISTCHECK_FLAGS) and the user-defined options in $(DISTCHECK_FLAGS).
* t/list-of-tests.mk (XFAIL_TESTS): Remove the now-passing test
'distcheck-no-destdist-or-srcdir-override.sh'.
* doc/automake.texi (Checking the Distribution): Update.
* NEWS: Likewise.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
NEWS
doc/automake.texi
lib/am/distdir.am
t/list-of-tests.mk

diff --git a/NEWS b/NEWS
index aaec7c0..77dcbbc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -108,6 +108,9 @@ New in 1.14.1:
 
 * Bugs fixed:
 
+  - The user is no longer allowed to override the --srcdir nor the --prefix
+    configure options used by "make distcheck" (bug#14991).
+
   - Fixed a gross inefficiency in the recipes for installing byte-compiled
     python files, that was causing an O(N^2) performance on the number N of
     files, instead of the expected O(N) performance.  Note that this bug
index 62728d4..cd33ad7 100644 (file)
@@ -8556,11 +8556,18 @@ to supply additional flags to @command{configure}, define them in the
 @file{Makefile.am}.  The user can still extend or override the flags
 provided there by defining the @code{DISTCHECK_CONFIGURE_FLAGS} variable,
 on the command line when invoking @command{make}.
-
-Still, developers are encouraged to strive to make their code buildable
-without requiring any special configure option; thus, in general, you
-shouldn't define @code{AM_DISTCHECK_CONFIGURE_FLAGS}. However, there
-might be few scenarios in which the use of this variable is justified.
+@c See automake bug#14991 for more details about how the following holds.
+It's worth nothing that @command{make distcheck} needs complete control
+over the @command{configure} options @option{--srcdir} and
+@option{--prefix}, so those options cannot be overridden by
+@code{AM_DISTCHECK_CONFIGURE_FLAGS} nor by
+@code{DISTCHECK_CONFIGURE_FLAGS}.
+
+Also note that developers are encouraged to strive to make their code
+buildable without requiring any special configure option; thus, in
+general, you shouldn't define @code{AM_DISTCHECK_CONFIGURE_FLAGS}.
+However, there might be few scenarios in which the use of this variable
+is justified.
 GNU @command{m4} offers an example.  GNU @command{m4} configures by
 default with its experimental and seldom used "changeword" feature
 disabled; so in its case it is useful to have @command{make distcheck}
index f354987..a8ad63c 100644 (file)
@@ -452,13 +452,16 @@ distcheck: dist
 ## 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" \
+         && ../configure \
 ?GETTEXT?          --with-included-gettext \
-## Additional flags for configure.  Keep this last in the configure
-## invocation so the developer and user can override previous options,
-## and let the user's flags take precedence over the developer's ones.
+## Additional flags for configure.
            $(AM_DISTCHECK_CONFIGURE_FLAGS) \
            $(DISTCHECK_CONFIGURE_FLAGS) \
+## At the moment, the code doesn't actually support changes in these --srcdir
+## and --prefix values, so don't allow them to be overridden by the user or
+## the developer.  That used to be allowed, and caused issues in practice
+## (in corner-case usages); see automake bug#14991.
+           --srcdir=.. --prefix="$$dc_install_base" \
          && $(MAKE) $(AM_MAKEFLAGS) \
          && $(MAKE) $(AM_MAKEFLAGS) dvi \
          && $(MAKE) $(AM_MAKEFLAGS) check \
index 8bdbdc0..75f303a 100644 (file)
@@ -35,7 +35,6 @@ t/gcj6.sh \
 t/override-conditional-2.sh \
 t/override-conditional-pr13940.sh \
 t/dist-pr109765.sh \
-t/distcheck-no-prefix-or-srcdir-override.sh \
 t/instdir-cond2.sh \
 t/java-nobase.sh \
 t/objext-pr10128.sh \