GNU bug report logs - #8784
Support developer-reserved AM_DISTCHECK_CONFIGURE_FLAGS

Previous Next

Package: automake;

Reported by: Stefano Lattarini <stefano.lattarini <at> gmail.com>

Date: Thu, 2 Jun 2011 10:09:02 UTC

Severity: wishlist

Tags: patch

Done: Stefano Lattarini <stefano.lattarini <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 8784 <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: automake-patches <at> gnu.org
Cc: 8784 <at> debbugs.gnu.org
Subject: [PATCH] {maint} distcheck: add support for
	AM_DISTCHECK_CONFIGURE_FLAGS (was: Re: bug#8784: Support
	developer-reserved AM_DISTCHECK_CONFIGURE_FLAGS)
Date: Fri, 10 Jun 2011 17:33:39 +0200
[Message part 1 (text/plain, inline)]
Reference:
 <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8784>

On Thursday 02 June 2011, Stefano Lattarini wrote:
> Severity: wishlist
> 
> Hello automakers.
> 
> Continuing with the good trend of avoiding to impinge on the user
> namespace, we should start supporting AM_DISTCHECK_CONFIGURE_FLAGS
> in addition to DISTCHECK_CONFIGURE_FLAGS, so that the former can be
> reserved for the developer to be set in the 'Makefile.am's, and the
> latter left for the user, packager or tester to use freely.
> 
> Sorry for the curtness of this message, but it is thought more as
> a "note to self" than a bug report proper.
> 
> Regards,
>   Stefano
> 
> 
Implemented in the first one of the attached patches.  The second patch
is a follow-up updating the "maintainer-check" rules accordingly.

OK for maint?  This should be quite uncontroversial, so I'll push in 72
hours if there is no review by then.

Regards,
  Stefano
[0001-distcheck-add-support-for-AM_DISTCHECK_CONFIGURE_FLA.patch (text/x-patch, inline)]
From 976003923e43d17985a776f82cf8168e8741f7de Mon Sep 17 00:00:00 2001
Message-Id: <976003923e43d17985a776f82cf8168e8741f7de.1307718833.git.stefano.lattarini <at> gmail.com>
From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Date: Fri, 10 Jun 2011 12:26:42 +0200
Subject: [PATCH 1/2] distcheck: add support for AM_DISTCHECK_CONFIGURE_FLAGS

* doc/automake.texi (Checking the Distribution): Suggest to use
AM_DISTCHECK_CONFIGURE_FLAGS, not DISTCHECK_CONFIGURE_FLAGS, to
define (in the top-level Makefile.am) extra flags to be passed
to configure at "make distcheck" time; DISTCHECK_CONFIGURE_FLAGS
should be reserved for the user.  Add proper `@vindex' directive.
Document that AM_DISTCHECK_CONFIGURE_FLAGS is not honoured in a
subpackage Makefile.am, but the flags in it are passed down to
the configure script of the subpackage.
* lib/am/distdir.am (distcheck): Also pass the flags in
$(AM_DISTCHECK_CONFIGURE_FLAGS) to the configure invocation.
Update comments.
* tests/defs.in.test (AM_DISTCHECK_CONFIGURE_FLAGS,
DISTCHECK_CONFIGURE_FLAGS): Unset in case they are exported in
the environment, they might improperly influence our testsuite.
* tests/distcheck-configure-flags.test: New test.
* tests/distcheck-configure-flags-am.test: Likewise.
* tests/distcheck-configure-flags-subpkg.test: Likewise.
* distcheck-hook.test: Likewise.
* distcheck-hook2.test: Likewise.
* tests/Makefile.am (TESTS): Update.

Closes automake bug#8487.
---
 ChangeLog                                   |   25 ++++++++
 Makefile.in                                 |    1 +
 doc/automake.texi                           |   14 +++--
 lib/am/distdir.am                           |    4 +-
 tests/Makefile.am                           |    5 ++
 tests/Makefile.in                           |    5 ++
 tests/defs.in                               |    2 +
 tests/distcheck-configure-flags-am.test     |   68 ++++++++++++++++++++++
 tests/distcheck-configure-flags-subpkg.test |   83 +++++++++++++++++++++++++++
 tests/distcheck-configure-flags.test        |   56 ++++++++++++++++++
 tests/distcheck-hook.test                   |   53 +++++++++++++++++
 tests/distcheck-hook2.test                  |   81 ++++++++++++++++++++++++++
 12 files changed, 391 insertions(+), 6 deletions(-)
 create mode 100755 tests/distcheck-configure-flags-am.test
 create mode 100755 tests/distcheck-configure-flags-subpkg.test
 create mode 100755 tests/distcheck-configure-flags.test
 create mode 100755 tests/distcheck-hook.test
 create mode 100755 tests/distcheck-hook2.test

diff --git a/ChangeLog b/ChangeLog
index cb9918f..1a11eb2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2011-06-10  Stefano Lattarini  <stefano.lattarini <at> gmail.com>
+
+	distcheck: add support for AM_DISTCHECK_CONFIGURE_FLAGS
+	* doc/automake.texi (Checking the Distribution): Suggest to use
+	AM_DISTCHECK_CONFIGURE_FLAGS, not DISTCHECK_CONFIGURE_FLAGS, to
+	define (in the top-level Makefile.am) extra flags to be passed
+	to configure at "make distcheck" time; DISTCHECK_CONFIGURE_FLAGS
+	should be reserved for the user.  Add proper `@vindex' directive.
+	Document that AM_DISTCHECK_CONFIGURE_FLAGS is not honoured in a
+	subpackage Makefile.am, but the flags in it are passed down to
+	the configure script of the subpackage.
+	* lib/am/distdir.am (distcheck): Also pass the flags in
+	$(AM_DISTCHECK_CONFIGURE_FLAGS) to the configure invocation.
+	Update comments.
+	* tests/defs.in.test (AM_DISTCHECK_CONFIGURE_FLAGS,
+	DISTCHECK_CONFIGURE_FLAGS): Unset in case they are exported in
+	the environment, they might improperly influence our testsuite.
+	* tests/distcheck-configure-flags.test: New test.
+	* tests/distcheck-configure-flags-am.test: Likewise.
+	* tests/distcheck-configure-flags-subpkg.test: Likewise.
+	* distcheck-hook.test: Likewise.
+	* distcheck-hook2.test: Likewise.
+	* tests/Makefile.am (TESTS): Update.
+	Closes automake bug#8784.
+
 2011-06-02  Stefano Lattarini  <stefano.lattarini <at> gmail.com>
 
 	maintcheck: fix some failures, extend some checks
diff --git a/Makefile.in b/Makefile.in
index d0951e0..d6743e4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -721,6 +721,7 @@ distcheck: dist
 	  && am__cwd=`pwd` \
 	  && $(am__cd) $(distdir)/_build \
 	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
diff --git a/doc/automake.texi b/doc/automake.texi
index 3846e0d..b3aecfc 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -8417,11 +8417,14 @@ makes a distribution, then tries to do a @code{VPATH} build
 (@pxref{VPATH Builds}), run the test suite, and finally make another
 tarball to ensure the distribution is self-contained.
 
+@vindex AM_DISTCHECK_CONFIGURE_FLAGS
 @vindex DISTCHECK_CONFIGURE_FLAGS
 Building the package involves running @samp{./configure}.  If you need
 to supply additional flags to @command{configure}, define them in the
-@code{DISTCHECK_CONFIGURE_FLAGS} variable, either in your top-level
-@file{Makefile.am}, or on the command line when invoking @command{make}.
+@code{AM_DISTCHECK_CONFIGURE_FLAGS} variable in your top-level
+@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}.
 
 @trindex distcheck-hook
 If the @code{distcheck-hook} rule is defined in your top-level
@@ -8431,9 +8434,10 @@ is configured and built.  Your @code{distcheck-hook} can do almost
 anything, though as always caution is advised.  Generally this hook is
 used to check for potential distribution errors not caught by the
 standard mechanism.  Note that @code{distcheck-hook} as well as
-@code{DISTCHECK_CONFIGURE_FLAGS} are not honored in a subpackage
-@file{Makefile.am}, but the @code{DISTCHECK_CONFIGURE_FLAGS} are
-passed down to the @command{configure} script of the subpackage.
+@code{AM_DISTCHECK_CONFIGURE_FLAGS} and @code{DISTCHECK_CONFIGURE_FLAGS}
+are not honored in a subpackage @file{Makefile.am}, but the flags from
+@code{AM_DISTCHECK_CONFIGURE_FLAGS} and @code{DISTCHECK_CONFIGURE_FLAGS}
+are passed down to the @command{configure} script of the subpackage.
 
 @trindex distcleancheck
 @vindex DISTCLEANFILES
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index e0f3bce..c2dd7c5 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -468,7 +468,9 @@ distcheck: dist
 	  && ../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.
+## invocation so the developer and user can override previous options,
+## and let the user's flags take precedence over the developer's ones.
+	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 33ae8bc..42a8813 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -313,6 +313,11 @@ distdir.test \
 distlinks.test \
 distlinksbrk.test \
 distname.test \
+distcheck-configure-flags.test \
+distcheck-configure-flags-am.test \
+distcheck-configure-flags-subpkg.test \
+distcheck-hook.test \
+distcheck-hook2.test \
 dmalloc.test \
 dollar.test \
 dollarvar.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index d7a1761..664ecaa 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -584,6 +584,11 @@ distdir.test \
 distlinks.test \
 distlinksbrk.test \
 distname.test \
+distcheck-configure-flags.test \
+distcheck-configure-flags-am.test \
+distcheck-configure-flags-subpkg.test \
+distcheck-hook.test \
+distcheck-hook2.test \
 dmalloc.test \
 dollar.test \
 dollarvar.test \
diff --git a/tests/defs.in b/tests/defs.in
index 87a350d..32fba30 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -425,6 +425,8 @@ unset DESTDIR
 unset prefix exec_prefix bindir datarootdir datadir docdir dvidir
 unset htmldir includedir infodir libdir libexecdir localedir mandir
 unset oldincludedir pdfdir psdir sbindir sharedstatedir sysconfdir
+# Unset variables that might change the "make distcheck" behaviour.
+unset DISTCHECK_CONFIGURE_FLAGS AM_DISTCHECK_CONFIGURE_FLAGS
 # Also unset variables that control our test driver.  While not
 # conceptually independent, they cause some changed semantics we
 # need to control (and test for) in some of the tests to ensure
diff --git a/tests/distcheck-configure-flags-am.test b/tests/distcheck-configure-flags-am.test
new file mode 100755
index 0000000..a5cab6a
--- /dev/null
+++ b/tests/distcheck-configure-flags-am.test
@@ -0,0 +1,68 @@
+#! /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 support for AM_DISTCHECK_CONFIGURE_FLAGS at "make distcheck"
+# time, and its interactions with DISTCHECK_CONFIGURE_FLAGS.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_ARG_ENABLE([success], [], [success=$enableval], [success=no])
+AS_IF([test $success = yes && test "$sentence" = 'it works :-)'],
+      [:],
+      [AC_MSG_ERROR([success='$success', sentence='$sentence'])])
+AC_OUTPUT
+END
+
+unset sentence || :
+
+cat > Makefile.am << 'END'
+AM_DISTCHECK_CONFIGURE_FLAGS = --enable-success sentence='it works :-)'
+END
+
+$ACLOCAL
+$AUTOMAKE
+$FGREP '$(DISTCHECK_CONFIGURE_FLAGS)' Makefile.in
+$FGREP '$(AM_DISTCHECK_CONFIGURE_FLAGS)' Makefile.in
+grep 'DISTCHECK_CONFIGURE_FLAGS.*AM_DISTCHECK_CONFIGURE_FLAGS' Makefile.in \
+  && Exit 1
+
+$AUTOCONF
+./configure --enable-success sentence='it works :-)'
+
+# The configure call in "make distcheck" should honour
+# $(AM_DISTCHECK_CONFIGURE_FLAGS).
+
+$MAKE distcheck
+
+# $(DISTCHECK_CONFIGURE_FLAGS) takes precedence over
+# $(AM_DISTCHECK_CONFIGURE_FLAGS)
+
+cat >> Makefile.am << 'END'
+AM_DISTCHECK_CONFIGURE_FLAGS += --disable-success
+END
+$AUTOMAKE Makefile
+./config.status Makefile
+
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+grep "^configure:.* success='no', sentence='it works :-)'" output
+
+$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-success=yes"
+
+:
diff --git a/tests/distcheck-configure-flags-subpkg.test b/tests/distcheck-configure-flags-subpkg.test
new file mode 100755
index 0000000..695b47c
--- /dev/null
+++ b/tests/distcheck-configure-flags-subpkg.test
@@ -0,0 +1,83 @@
+#! /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 AM_DISTCHECK_CONFIGURE_FLAGS and DISTCHECK_CONFIGURE_FLAGS
+# are not honored in a subpackage Makefile.am, but the flags from
+# AM_DISTCHECK_CONFIGURE_FLAGS and DISTCHECK_CONFIGURE_FLAGS are
+# passed down to the configure script of the subpackage.  This is
+# explicitly documented in the manual.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_SUBDIRS([subpkg])
+if test $dc != ok || test $am_dc != ok; then
+  AC_MSG_ERROR([dc=$dc am_dc=$dc])
+fi
+AC_OUTPUT
+END
+
+mkdir subpkg
+
+sed <configure.in >subpkg/configure.in \
+    -e 's/^AC_INIT.*/AC_INIT([subpkg], [2.0])/' \
+    -e '/^AC_CONFIG_SUBDIRS/d' \
+
+cat configure.in
+cat subpkg/configure.in
+
+dc=KO am_dc=KO; export dc am_dc
+
+cat > Makefile.am << 'END'
+AM_DISTCHECK_CONFIGURE_FLAGS = am_dc=ok
+DISTCHECK_CONFIGURE_FLAGS = dc=ok
+END
+
+: > subpkg/Makefile.am
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+cd subpkg
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+cd ..
+
+# For debugging.
+$FGREP 'DISTCHECK_CONFIGURE_FLAGS' Makefile.in subpkg/Makefile.in
+
+grep '^AM_DISTCHECK_CONFIGURE_FLAGS =' Makefile.in
+grep '^DISTCHECK_CONFIGURE_FLAGS =' Makefile.in
+$EGREP '^(AM_)?DISTCHECK_CONFIGURE_FLAGS' subpkg/Makefile.in && Exit 1
+
+./configure dc=ok am_dc=ok
+
+# Flags in $(DISTCHECK_CONFIGURE_FLAGS) and $(AM_DISTCHECK_CONFIGURE_FLAGS)
+# should be passed down to the subpackage configure when "make distcheck"
+# is run from the top-level package ...
+$MAKE distcheck
+
+# ... but not when "make distcheck" is run from the subpackage.
+cd subpkg
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+grep '^configure:.* dc=KO am_dc=KO' output
+
+:
diff --git a/tests/distcheck-configure-flags.test b/tests/distcheck-configure-flags.test
new file mode 100755
index 0000000..117d83c
--- /dev/null
+++ b/tests/distcheck-configure-flags.test
@@ -0,0 +1,56 @@
+#! /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 support for DISTCHECK_CONFIGURE_FLAGS at "make distcheck" time.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_ARG_ENABLE([success], [], [success=$enableval], [success=no])
+AS_IF([test $success = yes && test "$sentence" = 'it works :-)'],
+      [:],
+      [AC_MSG_ERROR([success='$success', sentence='$sentence'])])
+AC_OUTPUT
+END
+
+unset sentence || :
+
+: > Makefile.am
+
+$ACLOCAL
+$AUTOMAKE
+$FGREP '$(DISTCHECK_CONFIGURE_FLAGS)' Makefile.in
+
+$AUTOCONF
+./configure --enable-success sentence='it works :-)'
+
+# It should be ok to define DISTCHECK_CONFIGURE_FLAGS either on the
+# make command line or in the environment.
+
+env DISTCHECK_CONFIGURE_FLAGS='--enable-success sentence=it\ works\ :-\)' \
+  $MAKE distcheck # Not `make -e' here, deliberately.
+
+$MAKE distcheck \
+  DISTCHECK_CONFIGURE_FLAGS="--enable-success=yes sentence='it works :-)'"
+
+# Sanity check.
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+grep "^configure:.* success='no', sentence=''" output
+
+:
diff --git a/tests/distcheck-hook.test b/tests/distcheck-hook.test
new file mode 100755
index 0000000..9a2c384
--- /dev/null
+++ b/tests/distcheck-hook.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 basic support for distcheck-hook.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+distcheck-hook:
+	ls -l $(distdir)
+	chmod u+w $(distdir)
+	: > $(distdir)/dc-hook-has-run
+	chmod a-w $(distdir)
+check-local:
+	ls -l $(srcdir)
+	test -f $(srcdir)/dc-hook-has-run
+END
+
+$ACLOCAL
+$AUTOMAKE
+$FGREP 'distcheck-hook' Makefile.in
+$FGREP '$(MAKE) $(AM_MAKEFLAGS) distcheck-hook' Makefile.in
+grep '^distcheck-hook:' Makefile.in
+
+$AUTOCONF
+./configure
+
+$MAKE
+$MAKE check && Exit 1
+$MAKE distdir
+test -f $distdir/dc-hook-has-run && Exit 1
+$MAKE distcheck
+
+:
diff --git a/tests/distcheck-hook2.test b/tests/distcheck-hook2.test
new file mode 100755
index 0000000..befc1d6
--- /dev/null
+++ b/tests/distcheck-hook2.test
@@ -0,0 +1,81 @@
+#! /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 no 'distcheck-hook' target is created automatically by
+# Automake, and that a used-defined 'distcheck-hook' is *not* honored
+# in a subpackage Makefile.am.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_SUBDIRS([subpkg])
+AC_OUTPUT
+END
+
+mkdir subpkg
+
+cat > subpkg/configure.in << 'END'
+AC_INIT([subpkg], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+distcheck-hook:
+	ls -l $(distdir)
+	chmod u+w $(distdir)
+	: > $(distdir)/dc-hook-has-run
+	chmod a-w $(distdir)
+check-local:
+	ls -l $(srcdir)
+	test -f $(srcdir)/dc-hook-has-run
+END
+
+cat > subpkg/Makefile.am <<'END'
+check-local:
+	ls -l $(srcdir)
+	test ! -r $(srcdir)/dc-hook-has-run
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+cd subpkg
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+cd ..
+
+# For debugging.
+$FGREP 'distcheck-hook' Makefile.in subpkg/Makefile.in
+
+$FGREP 'distcheck-hook' subpkg/Makefile.in && Exit 1
+$FGREP '$(MAKE) $(AM_MAKEFLAGS) distcheck-hook' Makefile.in
+grep '^distcheck-hook:' Makefile.in
+
+./configure
+
+$MAKE
+$MAKE check && Exit 1
+cd subpkg
+$MAKE check
+cd ..
+$MAKE distcheck
+
+:
-- 
1.7.2.3

[0002-maintcheck-DISTCHECK_CONFIGURE_FLAGS-can-be-defined-.patch (text/x-patch, inline)]
From f84f54f530c8aa0fd3dcd7a31506eef169958a0a Mon Sep 17 00:00:00 2001
Message-Id: <f84f54f530c8aa0fd3dcd7a31506eef169958a0a.1307718833.git.stefano.lattarini <at> gmail.com>
In-Reply-To: <976003923e43d17985a776f82cf8168e8741f7de.1307718833.git.stefano.lattarini <at> gmail.com>
References: <976003923e43d17985a776f82cf8168e8741f7de.1307718833.git.stefano.lattarini <at> gmail.com>
From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Date: Fri, 10 Jun 2011 17:13:17 +0200
Subject: [PATCH 2/2] maintcheck: DISTCHECK_CONFIGURE_FLAGS can be defined on make cmdline

* Makefile.am (sc_tests_overriding_macros_on_cmdline): It's now
acceptable that the test scripts override DISTCHECK_CONFIGURE_FLAGS
on the make command line.  Update comments accordingly.  Since we
are at it, make the relevant grepping rules slightly tighter.
---
 ChangeLog   |    8 ++++++++
 Makefile.am |   17 ++++++++++++-----
 Makefile.in |    8 ++++++--
 3 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1a11eb2..6d8233e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-06-10  Stefano Lattarini  <stefano.lattarini <at> gmail.com>
 
+	maintcheck: DISTCHECK_CONFIGURE_FLAGS can be defined on make cmdline
+	* Makefile.am (sc_tests_overriding_macros_on_cmdline): It's now
+	acceptable that the test scripts override DISTCHECK_CONFIGURE_FLAGS
+	on the make command line.  Update comments accordingly.  Since we
+	are at it, make the relevant grepping rules slightly tighter.
+
+2011-06-10  Stefano Lattarini  <stefano.lattarini <at> gmail.com>
+
 	distcheck: add support for AM_DISTCHECK_CONFIGURE_FLAGS
 	* doc/automake.texi (Checking the Distribution): Suggest to use
 	AM_DISTCHECK_CONFIGURE_FLAGS, not DISTCHECK_CONFIGURE_FLAGS, to
diff --git a/Makefile.am b/Makefile.am
index f0cc95e..b25a30a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -442,17 +442,24 @@ sc_tests_required_after_defs:
 	done
 
 ## Overriding a Makefile macro on the command line is not portable when
-## recursive targets are used.  Better use an envvar.  SHELL is an exception,
-## POSIX says it can't come from the environment.  V and DESTDIRS are exceptions,
-## too, as package authors are urged not to initialize them anywhere.
+## recursive targets are used.  Better use an envvar.  SHELL is an
+## exception, POSIX says it can't come from the environment.  DESTDIR and
+## DISTCHECK_CONFIGURE_FLAGS and V are exceptions, too, as package authors
+## are urged not to initialize them anywhere.
 sc_tests_overriding_macros_on_cmdline:
 	@if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(srcdir)/tests/*.test; then \
 	  echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
 	  echo ' in the above lines, it is more portable.' 1>&2; \
 	  exit 1; \
 	fi
-	@if sed 's/DESTDIR=[^ ]*//; s/SHELL=[^ ]*//; s/V=[^ ]*//' $(srcdir)/tests/*.test | \
-	    grep '\$$MAKE .*=' ; then \
+	@if sed -e 's/ DESTDIR=[^ ]*/ /' -e 's/ SHELL=[^ ]*/ /' \
+	        -e 's/ V=[^ ]*/ /' -e 's///' \
+## DISTCHECK_CONFIGURE_FLAGS is allowed to contain whitespace in its
+## definition, so the more complex substitutions below.
+	        -e "s/ DISTCHECK_CONFIGURE_FLAGS='[^']*'/ /" \
+		-e 's/ DISTCHECK_CONFIGURE_FLAGS="[^"]*"/ /' \
+		-e 's/ DISTCHECK_CONFIGURE_FLAGS=[^ ]/ /' \
+	      $(srcdir)/tests/*.test | grep '\$$MAKE .*='; then \
 	  echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
 	  echo 'it is more portable.' 1>&2; \
 	  exit 1; \
diff --git a/Makefile.in b/Makefile.in
index d6743e4..6539f3c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1141,8 +1141,12 @@ sc_tests_overriding_macros_on_cmdline:
 	  echo ' in the above lines, it is more portable.' 1>&2; \
 	  exit 1; \
 	fi
-	@if sed 's/DESTDIR=[^ ]*//; s/SHELL=[^ ]*//; s/V=[^ ]*//' $(srcdir)/tests/*.test | \
-	    grep '\$$MAKE .*=' ; then \
+	@if sed -e 's/ DESTDIR=[^ ]*/ /' -e 's/ SHELL=[^ ]*/ /' \
+	        -e 's/ V=[^ ]*/ /' -e 's///' \
+	        -e "s/ DISTCHECK_CONFIGURE_FLAGS='[^']*'/ /" \
+		-e 's/ DISTCHECK_CONFIGURE_FLAGS="[^"]*"/ /' \
+		-e 's/ DISTCHECK_CONFIGURE_FLAGS=[^ ]/ /' \
+	      $(srcdir)/tests/*.test | grep '\$$MAKE .*='; then \
 	  echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
 	  echo 'it is more portable.' 1>&2; \
 	  exit 1; \
-- 
1.7.2.3


This bug report was last modified 14 years and 77 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.