automake-patches
[Top][All Lists]
Advanced

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

[PATCH v2.2] Improve support for non-default autotools in rebuild rules.


From: Stefano Lattarini
Subject: [PATCH v2.2] Improve support for non-default autotools in rebuild rules.
Date: Sun, 15 Aug 2010 15:23:05 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

Hmpf.  I attached the old patch by mistake, instead of a the new one.
What a dope.  Hopefully I got it right this time.

Again, sorry for the noise.
  Stefano
From 7c44c1df66d4fc5ed3e3978ae95bc0db99f7582c Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Thu, 12 Aug 2010 18:57:25 +0200
Subject: [PATCH] Improve support for non-default autotools in rebuild rules.

* lib/am/configure.am: Bumped serial number: 16 -> 17.
(%MAKEFILE-IN%): When appropriate, export AUTOCONF and AUTOM4TE
to proper values when calling $(AUTOMAKE).
(%MAKEFILE-IN%) [%?TOPDIR_P%]: Likewise.
($(ACLOCAL_M4)) [!%?TOPDIR_P%]: Likewise (but when calling
$(ACLOCAL).
* m4/init.m4 (AM_INIT_AUTOMAKE): New AC_SUBSTitution `AUTOM4TE',
an autom4te program wrapped with the `missing' script.  Also,
AC_SUBST `am__nomissing_AUTOCONF' and `am__nomissing_AUTOM4TE',
respectively to overridden `autoconf' and `autom4te' programs,
*not* wrapped by the `missing' script.
* configure.ac (am_AUTOM4TE): New AC_SUBST'd variable.
* tests/defs.in ($AUTOM4TE): New shell variable, defaulting
to AC_SUBST'd address@hidden@'.
($APIVERSION): New variable, AC_SUBST'd.
($ACLOCAL, $AUTOMAKE): Use it.
* tests/remake8a.test: New test.
* tests/remake8b.test: Likewise.
* tests/remake8c.test: Likewise.
* tests/remake8d.test: Likewise.
* tests/remake8e.test: Likewise.
* tests/remake8f.test: Likewise.
* tests/remake8g.test: Likewise.
* tests/remake8h.test: Likewise.
* tests/Makefile.am (TESTS): Updated.
---
 ChangeLog                      |   29 +++++++
 Makefile.in                    |   40 ++++++++-
 configure                      |   13 +++
 configure.ac                   |    1 +
 doc/Makefile.in                |   15 +++-
 lib/Automake/Makefile.in       |   15 +++-
 lib/Automake/tests/Makefile.in |   15 +++-
 lib/Makefile.in                |   15 +++-
 lib/am/Makefile.in             |   15 +++-
 lib/am/configure.am            |   45 +++++++++-
 m4/Makefile.in                 |   15 +++-
 m4/init.m4                     |   14 +++-
 tests/Makefile.am              |    8 ++
 tests/Makefile.in              |   23 +++++-
 tests/defs.in                  |    7 +-
 tests/remake8a.test            |   94 +++++++++++++++++++++
 tests/remake8b.test            |   98 ++++++++++++++++++++++
 tests/remake8c.test            |  111 +++++++++++++++++++++++++
 tests/remake8d.test            |  179 ++++++++++++++++++++++++++++++++++++++++
 tests/remake8e.test            |  175 +++++++++++++++++++++++++++++++++++++++
 tests/remake8f.test            |  119 ++++++++++++++++++++++++++
 tests/remake8g.test            |  140 +++++++++++++++++++++++++++++++
 tests/remake8h.test            |   59 +++++++++++++
 23 files changed, 1227 insertions(+), 18 deletions(-)
 create mode 100755 tests/remake8a.test
 create mode 100755 tests/remake8b.test
 create mode 100755 tests/remake8c.test
 create mode 100755 tests/remake8d.test
 create mode 100755 tests/remake8e.test
 create mode 100755 tests/remake8f.test
 create mode 100755 tests/remake8g.test
 create mode 100755 tests/remake8h.test

diff --git a/ChangeLog b/ChangeLog
index 5453722..62ed0c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2010-08-14  Stefano Lattarini  <address@hidden>
+
+       Improve support for non-default autotools in rebuild rules.
+       * lib/am/configure.am: Bumped serial number: 16 -> 17.
+       (%MAKEFILE-IN%): When appropriate, export AUTOCONF and AUTOM4TE
+       to proper values when calling $(AUTOMAKE).
+       (%MAKEFILE-IN%) [%?TOPDIR_P%]: Likewise.
+       ($(ACLOCAL_M4)) [!%?TOPDIR_P%]: Likewise (but when calling
+       $(ACLOCAL).
+       * m4/init.m4 (AM_INIT_AUTOMAKE): New AC_SUBSTitution `AUTOM4TE',
+       an autom4te program wrapped with the `missing' script.  Also,
+       AC_SUBST `am__nomissing_AUTOCONF' and `am__nomissing_AUTOM4TE',
+       respectively to overridden `autoconf' and `autom4te' programs,
+       *not* wrapped by the `missing' script.
+       * configure.ac (am_AUTOM4TE): New AC_SUBST'd variable.
+       * tests/defs.in ($AUTOM4TE): New shell variable, defaulting
+       to AC_SUBST'd address@hidden@'.
+       ($APIVERSION): New variable, AC_SUBST'd.
+       ($ACLOCAL, $AUTOMAKE): Use it.
+       * tests/remake8a.test: New test.
+       * tests/remake8b.test: Likewise.
+       * tests/remake8c.test: Likewise.
+       * tests/remake8d.test: Likewise.
+       * tests/remake8e.test: Likewise.
+       * tests/remake8f.test: Likewise.
+       * tests/remake8g.test: Likewise.
+       * tests/remake8h.test: Likewise.
+       * tests/Makefile.am (TESTS): Updated.
+
 2010-08-10  Stefano Lattarini  <address@hidden>
 
        Tweak and/or extend some `acloca*.test' tests.
diff --git a/Makefile.in b/Makefile.in
index 528b80e..56672ce 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -150,6 +150,7 @@ AMTAR = @AMTAR@
 APIVERSION = @APIVERSION@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
+AUTOM4TE = @AUTOM4TE@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 CYGPATH_W = @CYGPATH_W@
@@ -194,7 +195,10 @@ abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOM4TE = @am_AUTOM4TE@
 am__leading_dot = @am__leading_dot@
+am__nomissing_AUTOCONF = @am__nomissing_AUTOCONF@
+am__nomissing_AUTOM4TE = @am__nomissing_AUTOM4TE@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
@@ -328,14 +332,32 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  
$(am__configure_deps)
          case '$(am__configure_deps)' in \
            *$$dep*) \
              echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
-             $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
-               && exit 0; \
+             $(am__cd) $(srcdir) && \
+               ( if test -n '$(am__nomissing_AUTOCONF)'; then \
+                   AUTOCONF='$(am__nomissing_AUTOCONF)'; \
+                   export AUTOCONF; \
+                 fi; \
+                 if test -n '$(am__nomissing_AUTOM4TE)'; then \
+                   AUTOM4TE='$(am__nomissing_AUTOM4TE)'; \
+                   export AUTOM4TE; \
+                 fi; \
+                 $(AUTOMAKE) --gnu; \
+               ) && exit 0; \
              exit 1;; \
          esac; \
        done; \
        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
        $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu Makefile
+         ( if test -n '$(am__nomissing_AUTOCONF)'; then \
+             AUTOCONF='$(am__nomissing_AUTOCONF)'; \
+             export AUTOCONF; \
+           fi; \
+           if test -n '$(am__nomissing_AUTOM4TE)'; then \
+             AUTOM4TE='$(am__nomissing_AUTOM4TE)'; \
+             export AUTOM4TE; \
+           fi; \
+           $(AUTOMAKE) --gnu Makefile; \
+         )
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
        @case '$?' in \
@@ -353,7 +375,17 @@ $(top_builddir)/config.status: $(top_srcdir)/configure 
$(CONFIG_STATUS_DEPENDENC
 $(top_srcdir)/configure:  $(am__configure_deps)
        $(am__cd) $(srcdir) && $(AUTOCONF)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+       @echo ' cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)'; \
+       $(am__cd) $(srcdir) && \
+         ( if test -n '$(am__nomissing_AUTOCONF)'; then \
+             AUTOCONF='$(am__nomissing_AUTOCONF)'; \
+             export AUTOCONF; \
+           fi; \
+           if test -n '$(am__nomissing_AUTOM4TE)'; then \
+             AUTOM4TE='$(am__nomissing_AUTOM4TE)'; \
+             export AUTOM4TE; \
+           fi; \
+           $(ACLOCAL) $(ACLOCAL_AMFLAGS) )
 $(am__aclocal_m4_deps):
 install-binSCRIPTS: $(bin_SCRIPTS)
        @$(NORMAL_INSTALL)
diff --git a/configure b/configure
index ae88625..c913f4c 100755
--- a/configure
+++ b/configure
@@ -584,10 +584,13 @@ INSTALL_STRIP_PROGRAM
 STRIP
 install_sh
 MAKEINFO
+AUTOM4TE
 AUTOHEADER
 AUTOMAKE
 AUTOCONF
 ACLOCAL
+am__nomissing_AUTOM4TE
+am__nomissing_AUTOCONF
 VERSION
 PACKAGE
 CYGPATH_W
@@ -596,6 +599,7 @@ INSTALL_DATA
 INSTALL_SCRIPT
 INSTALL_PROGRAM
 am_AUTOHEADER
+am_AUTOM4TE
 am_AUTOCONF
 build_os
 build_vendor
@@ -1769,6 +1773,8 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 
's/ /-/g'`;; esac
 # suite) without being bothered by `missing'.  Likewise for autoheader.
 am_AUTOCONF="${AUTOCONF-autoconf}"
 
+am_AUTOM4TE="${AUTOM4TE-autom4te}"
+
 am_AUTOHEADER="${AUTOHEADER-autoheader}"
 
 
@@ -2227,6 +2233,10 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 # Some tools Automake needs.
+test -n "$AUTOCONF" && am__nomissing_AUTOCONF=$AUTOCONF
+
+test -n "$AUTOM4TE" && am__nomissing_AUTOM4TE=$AUTOM4TE
+
 
 ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
 
@@ -2240,6 +2250,9 @@ 
AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
 AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
 
 
+AUTOM4TE=${AUTOM4TE-"${am_missing_run}autom4te"}
+
+
 MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
 # We need awk for the "check" target.  The system "awk" is bad on
diff --git a/configure.ac b/configure.ac
index de4583d..10a2279 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,7 @@ AC_CANONICAL_BUILD
 # way we can run Autoconf tests from configure (or from the test
 # suite) without being bothered by `missing'.  Likewise for autoheader.
 AC_SUBST([am_AUTOCONF], ["${AUTOCONF-autoconf}"])
+AC_SUBST([am_AUTOM4TE], ["${AUTOM4TE-autom4te}"])
 AC_SUBST([am_AUTOHEADER], ["${AUTOHEADER-autoheader}"])
 
 AM_INIT_AUTOMAKE([1.10a dist-bzip2 filename-length-max=99 color-tests 
parallel-tests])
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 95a8fb8..13c4eb5 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -117,6 +117,7 @@ AMTAR = @AMTAR@
 APIVERSION = @APIVERSION@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
+AUTOM4TE = @AUTOM4TE@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 CYGPATH_W = @CYGPATH_W@
@@ -161,7 +162,10 @@ abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOM4TE = @am_AUTOM4TE@
 am__leading_dot = @am__leading_dot@
+am__nomissing_AUTOCONF = @am__nomissing_AUTOCONF@
+am__nomissing_AUTOM4TE = @am__nomissing_AUTOM4TE@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
@@ -257,7 +261,16 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  
$(am__configure_deps)
        done; \
        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
        $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu doc/Makefile
+         ( if test -n '$(am__nomissing_AUTOCONF)'; then \
+             AUTOCONF='$(am__nomissing_AUTOCONF)'; \
+             export AUTOCONF; \
+           fi; \
+           if test -n '$(am__nomissing_AUTOM4TE)'; then \
+             AUTOM4TE='$(am__nomissing_AUTOM4TE)'; \
+             export AUTOM4TE; \
+           fi; \
+           $(AUTOMAKE) --gnu doc/Makefile; \
+         )
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
        @case '$?' in \
diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in
index e068ab8..7c5c590 100644
--- a/lib/Automake/Makefile.in
+++ b/lib/Automake/Makefile.in
@@ -137,6 +137,7 @@ AMTAR = @AMTAR@
 APIVERSION = @APIVERSION@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
+AUTOM4TE = @AUTOM4TE@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 CYGPATH_W = @CYGPATH_W@
@@ -181,7 +182,10 @@ abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOM4TE = @am_AUTOM4TE@
 am__leading_dot = @am__leading_dot@
+am__nomissing_AUTOCONF = @am__nomissing_AUTOCONF@
+am__nomissing_AUTOM4TE = @am__nomissing_AUTOM4TE@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
@@ -277,7 +281,16 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  
$(am__configure_deps)
        done; \
        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Automake/Makefile'; \
        $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu lib/Automake/Makefile
+         ( if test -n '$(am__nomissing_AUTOCONF)'; then \
+             AUTOCONF='$(am__nomissing_AUTOCONF)'; \
+             export AUTOCONF; \
+           fi; \
+           if test -n '$(am__nomissing_AUTOM4TE)'; then \
+             AUTOM4TE='$(am__nomissing_AUTOM4TE)'; \
+             export AUTOM4TE; \
+           fi; \
+           $(AUTOMAKE) --gnu lib/Automake/Makefile; \
+         )
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
        @case '$?' in \
diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in
index 3d28072..3fdcc25 100644
--- a/lib/Automake/tests/Makefile.in
+++ b/lib/Automake/tests/Makefile.in
@@ -153,6 +153,7 @@ AMTAR = @AMTAR@
 APIVERSION = @APIVERSION@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
+AUTOM4TE = @AUTOM4TE@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 CYGPATH_W = @CYGPATH_W@
@@ -197,7 +198,10 @@ abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOM4TE = @am_AUTOM4TE@
 am__leading_dot = @am__leading_dot@
+am__nomissing_AUTOCONF = @am__nomissing_AUTOCONF@
+am__nomissing_AUTOM4TE = @am__nomissing_AUTOM4TE@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
@@ -265,7 +269,16 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  
$(am__configure_deps)
        done; \
        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu 
lib/Automake/tests/Makefile'; \
        $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu lib/Automake/tests/Makefile
+         ( if test -n '$(am__nomissing_AUTOCONF)'; then \
+             AUTOCONF='$(am__nomissing_AUTOCONF)'; \
+             export AUTOCONF; \
+           fi; \
+           if test -n '$(am__nomissing_AUTOM4TE)'; then \
+             AUTOM4TE='$(am__nomissing_AUTOM4TE)'; \
+             export AUTOM4TE; \
+           fi; \
+           $(AUTOMAKE) --gnu lib/Automake/tests/Makefile; \
+         )
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
        @case '$?' in \
diff --git a/lib/Makefile.in b/lib/Makefile.in
index f90b085..46d7b12 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -139,6 +139,7 @@ AMTAR = @AMTAR@
 APIVERSION = @APIVERSION@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
+AUTOM4TE = @AUTOM4TE@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 CYGPATH_W = @CYGPATH_W@
@@ -183,7 +184,10 @@ abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOM4TE = @am_AUTOM4TE@
 am__leading_dot = @am__leading_dot@
+am__nomissing_AUTOCONF = @am__nomissing_AUTOCONF@
+am__nomissing_AUTOM4TE = @am__nomissing_AUTOM4TE@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
@@ -248,7 +252,16 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  
$(am__configure_deps)
        done; \
        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \
        $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu lib/Makefile
+         ( if test -n '$(am__nomissing_AUTOCONF)'; then \
+             AUTOCONF='$(am__nomissing_AUTOCONF)'; \
+             export AUTOCONF; \
+           fi; \
+           if test -n '$(am__nomissing_AUTOM4TE)'; then \
+             AUTOM4TE='$(am__nomissing_AUTOM4TE)'; \
+             export AUTOM4TE; \
+           fi; \
+           $(AUTOMAKE) --gnu lib/Makefile; \
+         )
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
        @case '$?' in \
diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in
index 8924d17..c69551a 100644
--- a/lib/am/Makefile.in
+++ b/lib/am/Makefile.in
@@ -97,6 +97,7 @@ AMTAR = @AMTAR@
 APIVERSION = @APIVERSION@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
+AUTOM4TE = @AUTOM4TE@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 CYGPATH_W = @CYGPATH_W@
@@ -141,7 +142,10 @@ abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOM4TE = @am_AUTOM4TE@
 am__leading_dot = @am__leading_dot@
+am__nomissing_AUTOCONF = @am__nomissing_AUTOCONF@
+am__nomissing_AUTOM4TE = @am__nomissing_AUTOM4TE@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
@@ -240,7 +244,16 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  
$(am__configure_deps)
        done; \
        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/am/Makefile'; \
        $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu lib/am/Makefile
+         ( if test -n '$(am__nomissing_AUTOCONF)'; then \
+             AUTOCONF='$(am__nomissing_AUTOCONF)'; \
+             export AUTOCONF; \
+           fi; \
+           if test -n '$(am__nomissing_AUTOM4TE)'; then \
+             AUTOM4TE='$(am__nomissing_AUTOM4TE)'; \
+             export AUTOM4TE; \
+           fi; \
+           $(AUTOMAKE) --gnu lib/am/Makefile; \
+         )
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
        @case '$?' in \
diff --git a/lib/am/configure.am b/lib/am/configure.am
index e9299d6..349ebde 100644
--- a/lib/am/configure.am
+++ b/lib/am/configure.am
@@ -40,8 +40,23 @@ endif %?TOPDIR_P%
          case '$(am__configure_deps)' in \
            *$$dep*) \
 ?TOPDIR_P?           echo ' cd $(srcdir) && $(AUTOMAKE) %AUTOMAKE-OPTIONS%'; \
-?TOPDIR_P?           $(am__cd) $(srcdir) && $(AUTOMAKE) %AUTOMAKE-OPTIONS% \
-?TOPDIR_P?             && exit 0; \
+?TOPDIR_P?           $(am__cd) $(srcdir) && \
+## We must export the configure-time values of AUTOCONF and AUTOM4TE only
+## if they have been expicitly overridden by the user; otherwise, it's
+## better leave automake and aclocal pick up those values from either the
+## environment or the built-in defaults (and similarly leave autoconf pick
+## up the value of AUTOM4TE from either the environment or the built-in
+## default).
+?TOPDIR_P?             ( if test -n '$(am__nomissing_AUTOCONF)'; then \
+?TOPDIR_P?                 AUTOCONF='$(am__nomissing_AUTOCONF)'; \
+?TOPDIR_P?                 export AUTOCONF; \
+?TOPDIR_P?               fi; \
+?TOPDIR_P?               if test -n '$(am__nomissing_AUTOM4TE)'; then \
+?TOPDIR_P?                 AUTOM4TE='$(am__nomissing_AUTOM4TE)'; \
+?TOPDIR_P?                 export AUTOM4TE; \
+?TOPDIR_P?               fi; \
+?TOPDIR_P?               $(AUTOMAKE) %AUTOMAKE-OPTIONS%; \
+?TOPDIR_P?             ) && exit 0; \
 ?!TOPDIR_P?          ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) 
am--refresh ) \
 ## If on the other hand, subdir/Makefile.in has been removed, then toplevel
 ## am--refresh will not be aware of any need to run.  We still invoke it
@@ -54,7 +69,17 @@ endif %?TOPDIR_P%
 ## Otherwise, rebuild only this file.
        echo ' cd $(top_srcdir) && $(AUTOMAKE) %AUTOMAKE-OPTIONS% 
%MAKEFILE-AM-SOURCES%'; \
        $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) %AUTOMAKE-OPTIONS% %MAKEFILE-AM-SOURCES%
+## See comments above for why we need this involution.
+         ( if test -n '$(am__nomissing_AUTOCONF)'; then \
+             AUTOCONF='$(am__nomissing_AUTOCONF)'; \
+             export AUTOCONF; \
+           fi; \
+           if test -n '$(am__nomissing_AUTOM4TE)'; then \
+             AUTOM4TE='$(am__nomissing_AUTOM4TE)'; \
+             export AUTOM4TE; \
+           fi; \
+           $(AUTOMAKE) %AUTOMAKE-OPTIONS% %MAKEFILE-AM-SOURCES%; \
+         )
 
 ## Ensure that GNU make doesn't remove Makefile if ./config.status (below)
 ## is interrupted.  Otherwise, the user would need to know to rerun
@@ -119,7 +144,19 @@ $(top_srcdir)/configure: %MAINTAINER-MODE% 
$(am__configure_deps)
 ## the $(am__configure_deps) dependency.
 if %?REGEN-ACLOCAL-M4%
 $(ACLOCAL_M4): %MAINTAINER-MODE% $(am__aclocal_m4_deps)
-?TOPDIR_P?     $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+?TOPDIR_P?     @echo ' cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)'; \
+?TOPDIR_P?     $(am__cd) $(srcdir) && \
+## Please see the comments above about similar code in rules for
+## rebuilding `%MAKEFILE-IN%'.
+?TOPDIR_P?       ( if test -n '$(am__nomissing_AUTOCONF)'; then \
+?TOPDIR_P?           AUTOCONF='$(am__nomissing_AUTOCONF)'; \
+?TOPDIR_P?           export AUTOCONF; \
+?TOPDIR_P?         fi; \
+?TOPDIR_P?         if test -n '$(am__nomissing_AUTOM4TE)'; then \
+?TOPDIR_P?           AUTOM4TE='$(am__nomissing_AUTOM4TE)'; \
+?TOPDIR_P?           export AUTOM4TE; \
+?TOPDIR_P?         fi; \
+?TOPDIR_P?         $(ACLOCAL) $(ACLOCAL_AMFLAGS) )
 ?!TOPDIR_P?    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 
 ## Avoid the "deleted header file" problem for the dependencies.
diff --git a/m4/Makefile.in b/m4/Makefile.in
index 270ee91..4f5eb36 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -97,6 +97,7 @@ AMTAR = @AMTAR@
 APIVERSION = @APIVERSION@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
+AUTOM4TE = @AUTOM4TE@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 CYGPATH_W = @CYGPATH_W@
@@ -141,7 +142,10 @@ abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOM4TE = @am_AUTOM4TE@
 am__leading_dot = @am__leading_dot@
+am__nomissing_AUTOCONF = @am__nomissing_AUTOCONF@
+am__nomissing_AUTOM4TE = @am__nomissing_AUTOM4TE@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
@@ -237,7 +241,16 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  
$(am__configure_deps)
        done; \
        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu m4/Makefile'; \
        $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu m4/Makefile
+         ( if test -n '$(am__nomissing_AUTOCONF)'; then \
+             AUTOCONF='$(am__nomissing_AUTOCONF)'; \
+             export AUTOCONF; \
+           fi; \
+           if test -n '$(am__nomissing_AUTOM4TE)'; then \
+             AUTOM4TE='$(am__nomissing_AUTOM4TE)'; \
+             export AUTOM4TE; \
+           fi; \
+           $(AUTOMAKE) --gnu m4/Makefile; \
+         )
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
        @case '$?' in \
diff --git a/m4/init.m4 b/m4/init.m4
index 365c9ac..b21cd4d 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -7,7 +7,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 16
+# serial 17
 
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
@@ -70,10 +70,22 @@ _AM_IF_OPTION([no-define],,
 # Some tools Automake needs.
 AC_REQUIRE([AM_SANITY_CHECK])dnl
 AC_REQUIRE([AC_ARG_PROGRAM])dnl
+dnl We pass these two commands in the environment of automake and aclocal
+dnl commands in generated Makefile, so wrapping them with `missing' would
+dnl be a bad idea.  For example, if aclocal proper is ever called, it will
+dnl need a working autom4te to get traces from e.g. configure.ac, and
+dnl the workaround provided by `missing --run autom4te' is not enough in
+dnl such a case, and a flat-out failure by aclocal is the best and most
+dnl correct option.
+test -n "$AUTOCONF" && am__nomissing_AUTOCONF=$AUTOCONF
+AC_SUBST([am__nomissing_AUTOCONF])
+test -n "$AUTOM4TE" && am__nomissing_AUTOM4TE=$AUTOM4TE
+AC_SUBST([am__nomissing_AUTOM4TE])
 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
 AM_MISSING_PROG(AUTOCONF, autoconf)
 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
 AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(AUTOM4TE, autom4te)
 AM_MISSING_PROG(MAKEINFO, makeinfo)
 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0558149..5b36431 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -601,6 +601,14 @@ remake4.test \
 remake5.test \
 remake6.test \
 remake7.test \
+remake8a.test \
+remake8b.test \
+remake8c.test \
+remake8d.test \
+remake8e.test \
+remake8f.test \
+remake8g.test \
+remake8h.test \
 regex.test \
 req.test \
 reqd.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index a06026e..6b5f54c 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -158,6 +158,7 @@ AMTAR = @AMTAR@
 APIVERSION = @APIVERSION@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
+AUTOM4TE = @AUTOM4TE@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 CYGPATH_W = @CYGPATH_W@
@@ -202,7 +203,10 @@ abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOM4TE = @am_AUTOM4TE@
 am__leading_dot = @am__leading_dot@
+am__nomissing_AUTOCONF = @am__nomissing_AUTOCONF@
+am__nomissing_AUTOM4TE = @am__nomissing_AUTOM4TE@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
@@ -839,6 +843,14 @@ remake4.test \
 remake5.test \
 remake6.test \
 remake7.test \
+remake8a.test \
+remake8b.test \
+remake8c.test \
+remake8d.test \
+remake8e.test \
+remake8f.test \
+remake8g.test \
+remake8h.test \
 regex.test \
 req.test \
 reqd.test \
@@ -1035,7 +1047,16 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am 
$(srcdir)/parallel-tests.am $(am__
        done; \
        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \
        $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu tests/Makefile
+         ( if test -n '$(am__nomissing_AUTOCONF)'; then \
+             AUTOCONF='$(am__nomissing_AUTOCONF)'; \
+             export AUTOCONF; \
+           fi; \
+           if test -n '$(am__nomissing_AUTOM4TE)'; then \
+             AUTOM4TE='$(am__nomissing_AUTOM4TE)'; \
+             export AUTOM4TE; \
+           fi; \
+           $(AUTOMAKE) --gnu tests/Makefile; \
+         )
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
        @case '$?' in \
diff --git a/tests/defs.in b/tests/defs.in
index 1744a07..36d1086 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -54,6 +54,8 @@ test -f "$srcdir/defs.in" || {
 
 me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'`
 
+APIVERSION='@APIVERSION@'
+
 # Make sure we override the user shell.
 SHELL='@SHELL@'
 export SHELL
@@ -61,12 +63,13 @@ export SHELL
 test -z "$PERL" && PERL='@PERL@'
 test -z "$MAKE" && MAKE=make
 test -z "$AUTOCONF" && AUTOCONF="@am_AUTOCONF@"
+test -z "$AUTOM4TE" && AUTOM4TE="@am_AUTOM4TE@"
 test -z "$AUTOHEADER" && AUTOHEADER="@am_AUTOHEADER@"
 test -z "$AUTOUPDATE" && AUTOUPDATE=autoupdate
 test -z "$MISSING" && MISSING=`pwd`/../lib/missing
 # Use -Werror because this also turns some Perl warnings into error.
 # (Tests for which this is inappropriate should use -Wno-error.)
-test -z "$ACLOCAL" && ACLOCAL="address@hidden@ -Werror"
+test -z "$ACLOCAL" && ACLOCAL="aclocal-$APIVERSION -Werror"
 # Extra flags to pass to aclocal before all other flags added by this script.
 ACLOCAL_TESTSUITE_FLAGS=
 export ACLOCAL_TESTSUITE_FLAGS
@@ -77,7 +80,7 @@ export ACLOCAL_TESTSUITE_FLAGS
 # -Werror by default.  Tests for which this is inappropriate
 # (e.g. when testing that a warning is enabled by a specific switch)
 # should use -Wnone or/and -Wno-error
-test -z "$AUTOMAKE" && AUTOMAKE="address@hidden@ --foreign -Werror -Wall"
+test -z "$AUTOMAKE" && AUTOMAKE="automake-$APIVERSION --foreign -Werror -Wall"
 
 PATH="address@hidden@$PATH"
 echo "$PATH"
diff --git a/tests/remake8a.test b/tests/remake8a.test
new file mode 100755
index 0000000..8d6dfee
--- /dev/null
+++ b/tests/remake8a.test
@@ -0,0 +1,94 @@
+#! /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/>.
+
+# Make sure that rebuild rules behave properly when no configure-time
+# override of autoconf and autom4te is done.
+
+. ./defs || Exit 1
+
+set -e
+
+: > Makefile.am
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([foreign -Wall -Werror])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+mkdir xbin
+
+for p in autom4te autoconf; do
+  cat > xbin/$p <<END
+#! /bin/sh
+echo "Bad $p called: \$0" >&2
+exit 255
+END
+  cat xbin/$p # for debugging
+  chmod a+x xbin/$p
+done
+
+# Unfortunately, we cannot just export our $AUTOCONF and $AUTOM4TE for
+# use by automake and aclocal.  POSIX states that if a Makefile contains
+# a macro definition, and this macro has the same name of an exported
+# environment variable, then that variable will be redefined by make to
+# have the same value of the macro, and thus this will be the value seen
+# by make subprocesses.  For example:
+#   $ cat Makefile
+#   x=1
+#   target:; @echo $$x; env | grep '^x='
+#   $ x=2 make
+#   1
+#   x=1
+# Yuck!  So we need the following workaround.
+for p in automake aclocal; do
+  cat > xbin/$p <<END
+#! /bin/sh
+AUTOCONF='$AUTOCONF'; export AUTOCONF
+AUTOM4TE='$AUTOM4TE'; export AUTOM4TE
+exec '$curdir/$p-$APIVERSION' \${1+"\$@"}
+END
+  cat xbin/$p # for debugging
+  cp xbin/$p xbin/$p-$APIVERSION
+  chmod a+x xbin/$p xbin/$p-$APIVERSION
+done
+
+PATH=`pwd`/xbin:$PATH; export PATH
+
+aclocal-$APIVERSION -Wall -Werror
+automake-$APIVERSION -Wall -Werror
+$AUTOCONF
+
+# We don't want configure to pick these vars up from the environment.
+unset AUTOCONF
+unset AUTOM4TE
+
+./configure
+
+$sleep
+rm -f aclocal.m4
+touch configure.in
+touch Makefile.am
+
+# The `missing' script should save our day w.r.t. broken autoconf,
+# and the rebuild rules shouldn't export the broken autoconf and
+# autom4te to the aclocal and automake calls.
+$MAKE >output 2>&1 || { cat output; Exit 1; }
+cat output
+grep 'WARNING:.*missing' output
+
+:
diff --git a/tests/remake8b.test b/tests/remake8b.test
new file mode 100755
index 0000000..618684e
--- /dev/null
+++ b/tests/remake8b.test
@@ -0,0 +1,98 @@
+#! /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-generated makefiles wraps autotools calls with
+# the `missing' script by default.
+# Keep this in sync with sister test `remake8c.test'.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+: > Makefile.am
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([foreign -Wall -Werror])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+AUTOCONF="$AUTOCONF" AUTOM4TE="$AUTOM4TE" aclocal-$APIVERSION -Werror -Wall
+AUTOCONF="$AUTOCONF" AUTOM4TE="$AUTOM4TE" automake-$APIVERSION -Werror -Wall
+AUTOM4TE="$AUTOM4TE" $AUTOCONF -Werror -Wall
+
+# We don't want AUTOCONF, AUTOMAKE etc. to be picked up by configure,
+# so unset them in case the've been exported in the environment.
+save_AUTOCONF=$AUTOCONF
+save_AUTOM4TE=$AUTOM4TE
+unset ACLOCAL
+unset AUTOMAKE
+unset AUTOCONF
+unset AUTOM4TE
+
+mkdir xbin
+
+for p in autoconf autom4te; do
+  cat > xbin/$p <<END
+#! /bin/sh
+echo 'Fake $p that always fails!' >&2
+exit 255
+END
+  chmod a+x xbin/$p
+done
+
+for p in automake aclocal; do
+  cat > xbin/$p <<END
+#! /bin/sh
+# This is required, otherwise automake and aclocal will try to use
+# our fake & always failing autoconf and autom4te.
+AUTOCONF='$save_AUTOCONF'; export AUTOCONF
+AUTOM4TE='$save_AUTOM4TE'; export AUTOM4TE
+exec '$curdir/$p-$APIVERSION' \${1+"\$@"}
+END
+  cat xbin/$p # for debugging
+  cp -f xbin/$p xbin/$p-$APIVERSION
+  chmod a+x xbin/$p xbin/$p-$APIVERSION
+done
+
+PATH=`pwd`/xbin:$PATH; export PATH
+
+./configure
+
+$sleep
+touch configure.in
+# Check that the `missing' script kicks in and saves the day.
+$MAKE >output 2>&1 || { cat output; Exit 1; }
+cat output
+grep 'Fake autoconf that always fails!' output
+grep 'WARNING:.*autoconf.*missing' output
+
+rm -f aclocal.m4
+# Check that the `missing' script kicks in and saves the day.
+$MAKE >output 2>&1 || { cat output; Exit 1; }
+cat output
+grep 'Fake autoconf that always fails!' output
+grep 'WARNING:.*autoconf.*missing' output
+
+# Now check that we try to bypass `missing', failures ensue.
+./configure AUTOCONF=autoconf
+$sleep
+touch configure.in
+$MAKE && Exit 1
+
+:
diff --git a/tests/remake8c.test b/tests/remake8c.test
new file mode 100755
index 0000000..9addf13
--- /dev/null
+++ b/tests/remake8c.test
@@ -0,0 +1,111 @@
+#! /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-generated makefiles wraps autotools calls with
+# the `missing' script by default.
+# Keep this in sync with sister test `remake8b.test'.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+: > Makefile.am
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([foreign -Wall -Werror])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+AUTOCONF="$AUTOCONF" AUTOM4TE="$AUTOM4TE" aclocal-$APIVERSION -Werror -Wall
+AUTOCONF="$AUTOCONF" AUTOM4TE="$AUTOM4TE" automake-$APIVERSION -Werror -Wall
+AUTOM4TE="$AUTOM4TE" $AUTOCONF -Werror -Wall
+
+# We don't want AUTOCONF, AUTOMAKE etc. to be picked up by configure,
+# so unset them in case the've been exported in the environment.
+unset ACLOCAL
+unset AUTOMAKE
+unset AUTOCONF
+unset AUTOM4TE
+
+mkdir xbin
+
+for p in automake aclocal autoconf autom4te; do
+  cat > xbin/$p <<END
+#! /bin/sh
+echo 'Fake $p that always fails!' >&2
+exit 255
+END
+  cat xbin/$p # for debugging
+  chmod a+x xbin/$p
+done
+cp -f xbin/automake xbin/automake-$APIVERSION
+cp -f xbin/aclocal xbin/aclocal-$APIVERSION
+
+PATH=`pwd`/xbin:$PATH; export PATH
+
+./configure
+
+$sleep
+touch Makefile.am
+# Check that the `missing' script kicks in and saves the day.
+$MAKE >output 2>&1 || { cat output; Exit 1; }
+cat output
+grep 'Fake automake that always fails!' output
+grep 'WARNING:.*automake.*missing' output
+
+$sleep
+touch configure.in
+# Check that the `missing' script kicks in and saves the day.
+$MAKE >output 2>&1 || { cat output; Exit 1; }
+cat output
+grep 'Fake automake that always fails!' output
+grep 'WARNING:.*automake.*missing' output
+grep 'Fake autoconf that always fails!' output
+grep 'WARNING:.*autoconf.*missing' output
+
+rm -f aclocal.m4
+# Check that the `missing' script kicks in and saves the day.
+$MAKE >output 2>&1 || { cat output; Exit 1; }
+cat output
+grep 'Fake aclocal that always fails!' output
+grep 'WARNING:.*aclocal.*missing' output
+grep 'Fake automake that always fails!' output
+grep 'WARNING:.*automake.*missing' output
+grep 'Fake autoconf that always fails!' output
+grep 'WARNING:.*autoconf.*missing' output
+
+# Now check that we try to bypass `missing', failures ensue.
+# NOTE: the order of the following tests *is significant*.
+#       Please do not change it.
+
+./configure AUTOMAKE=automake
+$sleep
+touch Makefile.am
+$MAKE && Exit 1
+
+./configure AUTOCONF=autoconf
+$sleep
+touch configure.in
+$MAKE && Exit 1
+
+./configure ACLOCAL=aclocal
+rm -f aclocal.m4
+$MAKE && Exit 1
+
+:
diff --git a/tests/remake8d.test b/tests/remake8d.test
new file mode 100755
index 0000000..84406fc
--- /dev/null
+++ b/tests/remake8d.test
@@ -0,0 +1,179 @@
+#! /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/>.
+
+# Make sure configure-time override of autoconf and autom4te are
+# consistently honoured by the automake-generated rebuild rules.
+# Keep this in sync with the sister test `remake8e.test'.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+ocwd=`pwd` || Exit 1
+
+no_bad_autotools_call()
+{
+  if find "$ocwd" -name '*.autofail' | grep .; then
+    Exit 1
+  else
+    :
+  fi
+}
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -Werror
+SUBDIRS = sub
+END
+
+mkdir sub
+: > sub/Makefile.am
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([foreign -Wall -Werror])
+AC_CONFIG_FILES([Makefile sub/Makefile])
+AC_OUTPUT
+END
+
+mkdir xbin
+cd xbin
+
+cat > wrap--Autoconf <<END
+#! /bin/sh
+exec $AUTOCONF \${1+"\$@"}
+END
+cat > wrap--Autom4te <<END
+#! /bin/sh
+exec $AUTOM4TE \${1+"\$@"}
+END
+
+for p in automake aclocal; do
+  p2=`echo $p | sed 's/a/A/'`
+  cat > wrap--$p2 <<END
+#! /bin/sh
+echo "\$0: INFO: AUTOCONF='\$AUTOCONF'" >&2
+echo "\$0: INFO: AUTOM4TE='\$AUTOM4TE'" >&2
+test x"\$AUTOCONF" = x"wrap--Autoconf" || {
+  : > autoconf-from-$p.autofail
+  exit 255
+}
+test x"\$AUTOM4TE" = x"wrap--Autom4te" || {
+  : > autom4te-from-$p.autofail
+  exit 255
+}
+exec '$curdir/$p-$APIVERSION' \${1+"\$@"}
+END
+done
+
+for p in aclocal automake aclocal-$APIVERSION automake-$APIVERSION \
+         autom4te autoconf
+do
+  cat > $p <<END
+#! /bin/sh
+echo "BAD: $p (\$0) called" >&2
+: > $p.autofail
+exit 255
+END
+done
+
+cd ..
+
+ls -l xbin # for debugging
+for f in xbin/*; do
+  chmod a+x $f
+  cat $f # for debugging
+done
+
+PATH=$ocwd/xbin:$PATH; export PATH
+
+unset AUTOCONF
+unset AUTOM4TE
+unset AUTOMAKE
+unset ACLOCAL
+
+AUTOCONF=wrap--Autoconf AUTOM4TE=wrap--Autom4te wrap--Aclocal -Werror
+AUTOCONF=wrap--Autoconf AUTOM4TE=wrap--Autom4te wrap--Automake -Werror -Wall
+AUTOM4TE=wrap--Autom4te wrap--Autoconf -Werror -Wall
+
+# Now check that aclocal and automake calls in Makefile always use
+# the configure-time autoconf and autom4te.
+
+for vpath in : false; do
+
+  if $vpath; then
+    srcdir=$ocwd
+    rm -rf build
+    mkdir build
+    cd build
+  else
+     srcdir=.
+  fi
+
+  "$srcdir"/configure AUTOCONF=wrap--Autoconf AUTOM4TE=wrap--Autom4te \
+                      AUTOMAKE=wrap--Automake ACLOCAL=wrap--Aclocal
+
+  # Try to trigger rebuold rules in different situations.
+  rm -f "$srcdir"/configure "$srcdir"/aclocal.m4
+  rm -f "$srcdir"/Makefile.in "$srcdir"/sub/Makefile.in
+  $MAKE
+  no_bad_autotools_call
+  test -f "$srcdir"/configure
+  test -f "$srcdir"/aclocal.m4
+  test -f "$srcdir"/Makefile.in
+  test -f "$srcdir"/sub/Makefile.in
+
+  rm -f "$srcdir"/Makefile.in "$srcdir"/sub/Makefile.in
+  cd sub
+  $MAKE
+  no_bad_autotools_call
+  cd ..
+  test -f "$srcdir"/sub/Makefile.in
+  # Rebuild rules in subdir are "greedy"
+  test -f "$srcdir"/Makefile.in
+
+  $sleep
+  touch "$srcdir"/Makefile.am
+  $MAKE
+  no_bad_autotools_call
+
+  $sleep
+  touch "$srcdir"/sub/Makefile.am
+  cd sub
+  $MAKE
+  cd ..
+  no_bad_autotools_call
+
+  $sleep
+  touch "$srcdir"/sub/Makefile.am
+  $MAKE
+  no_bad_autotools_call
+
+  $sleep
+  touch "$srcdir"/configure.in
+  rm -f aclocal.m4
+  $MAKE
+  no_bad_autotools_call
+
+  $MAKE distclean
+
+  if $vpath; then
+    cd $srcdir
+  fi
+
+done
+
+:
diff --git a/tests/remake8e.test b/tests/remake8e.test
new file mode 100755
index 0000000..a3981b7
--- /dev/null
+++ b/tests/remake8e.test
@@ -0,0 +1,175 @@
+#! /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/>.
+
+# Make sure configure-time override of autoconf and autom4te are
+# consistently honoured by the automake-generated rebuild rules.
+# Keep this in sync with the sister test `remake8d.test'.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+ocwd=`pwd` || Exit 1
+
+no_bad_autotools_call()
+{
+  if find "$ocwd" -name '*.autofail' | grep .; then
+    Exit 1
+  else
+    :
+  fi
+}
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -Werror
+SUBDIRS = sub
+END
+
+mkdir sub
+: > sub/Makefile.am
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([foreign -Wall -Werror])
+AC_CONFIG_FILES([Makefile sub/Makefile])
+AC_OUTPUT
+END
+
+mkdir xbin
+cd xbin
+
+cat > wrap--Autoconf <<END
+#! /bin/sh
+exec $AUTOCONF \${1+"\$@"}
+END
+cat > wrap--Autom4te <<END
+#! /bin/sh
+exec $AUTOM4TE \${1+"\$@"}
+END
+
+for p in autom4te autoconf; do
+  cat > $p <<END
+#! /bin/sh
+echo "BAD: $p (\$0) called" >&2
+: > $p.autofail
+exit 255
+END
+done
+
+for p in automake aclocal; do
+  cat > $p <<END
+#! /bin/sh
+echo "\$0: INFO: AUTOCONF='\$AUTOCONF'" >&2
+echo "\$0: INFO: AUTOM4TE='\$AUTOM4TE'" >&2
+test x"\$AUTOCONF" = x"wrap--Autoconf" || {
+  : > autoconf-from-$p.autofail
+  exit 255
+}
+test x"\$AUTOM4TE" = x"wrap--Autom4te" || {
+  : > autom4te-from-$p.autofail
+  exit 255
+}
+exec '$curdir/$p-$APIVERSION' \${1+"\$@"}
+END
+done
+
+cd ..
+
+ls -l xbin # for debugging
+for f in xbin/*; do
+  chmod a+x $f
+  cat $f # for debugging
+done
+
+PATH=$ocwd/xbin:$PATH; export PATH
+
+unset AUTOCONF
+unset AUTOM4TE
+unset AUTOMAKE
+unset ACLOCAL
+
+AUTOCONF=wrap--Autoconf AUTOM4TE=wrap--Autom4te aclocal -Werror
+AUTOCONF=wrap--Autoconf AUTOM4TE=wrap--Autom4te automake --foreign -Werror 
-Wall
+AUTOM4TE=wrap--Autom4te wrap--Autoconf -Werror -Wall
+
+# Now check that aclocal and automake calls in Makefile always use
+# the configure-time autoconf and autom4te.
+
+for vpath in : false; do
+
+  if $vpath; then
+    srcdir=$ocwd
+    rm -rf build
+    mkdir build
+    cd build
+  else
+     srcdir=.
+  fi
+
+  "$srcdir"/configure AUTOCONF=wrap--Autoconf AUTOM4TE=wrap--Autom4te
+
+  # Try to trigger rebuold rules in different situations.
+  rm -f "$srcdir"/configure "$srcdir"/aclocal.m4
+  rm -f "$srcdir"/Makefile.in "$srcdir"/sub/Makefile.in
+  $MAKE
+  no_bad_autotools_call
+  test -f "$srcdir"/configure
+  test -f "$srcdir"/aclocal.m4
+  test -f "$srcdir"/Makefile.in
+  test -f "$srcdir"/sub/Makefile.in
+
+  rm -f "$srcdir"/Makefile.in "$srcdir"/sub/Makefile.in
+  cd sub
+  $MAKE
+  no_bad_autotools_call
+  cd ..
+  test -f "$srcdir"/sub/Makefile.in
+  # Rebuild rules in subdir are "greedy"
+  test -f "$srcdir"/Makefile.in
+
+  $sleep
+  touch "$srcdir"/Makefile.am
+  $MAKE
+  no_bad_autotools_call
+
+  $sleep
+  touch "$srcdir"/sub/Makefile.am
+  cd sub
+  $MAKE
+  cd ..
+  no_bad_autotools_call
+
+  $sleep
+  touch "$srcdir"/sub/Makefile.am
+  $MAKE
+  no_bad_autotools_call
+
+  $sleep
+  touch "$srcdir"/configure.in
+  rm -f aclocal.m4
+  $MAKE
+  no_bad_autotools_call
+
+  $MAKE distclean
+
+  if $vpath; then
+    cd $srcdir
+  fi
+
+done
+
+:
diff --git a/tests/remake8f.test b/tests/remake8f.test
new file mode 100755
index 0000000..1554dae
--- /dev/null
+++ b/tests/remake8f.test
@@ -0,0 +1,119 @@
+#! /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/>.
+
+# We expect the `missing' script *never* to wrap autoconf and autom4te
+# calls *done by automake and aclocal* in our rebuild rules.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+: > Makefile.am
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+mkdir xbin
+cat > xbin/autoconf <<END
+#! /bin/sh
+exec $AUTOCONF \${1+"\$@"}
+END
+cat > xbin/autom4te <<END
+#! /bin/sh
+exec $AUTOM4TE \${1+"\$@"}
+END
+chmod a+x xbin/autoconf xbin/autom4te
+
+PATH=`pwd`/xbin:$PATH; export PATH
+
+cat > missing <<'END'
+#! /bin/sh
+if test x"$1" = x"--run"; then
+  shift
+  case $1 in
+    autom4te|autoconf)
+      echo "Oops!  The \`missing' script has called $1!" >&2
+      echo "This should have been never happened in this test." >&2
+      : > missing.fail
+      exit 255
+      ;;
+    *)
+      # Just assume we have the tool, and run it.  This should be safe
+      # given our usage of missing here.
+      exec "$@"
+      exit 255 # notreached
+      ;;
+  esac
+else
+  echo "Botched \`missing' call detected!" >&2
+  echo "Arguments were: $*" >&2
+  exit 255
+fi
+exit 255 # notreached
+END
+chmod a+x missing
+
+no_bad_missing_call()
+{
+  if find . -name missing.fail | grep .; then
+    Exit 1
+  else
+    :
+  fi
+}
+
+# The configure script should not take up any of these from the
+# environment.
+save_AUTOCONF=$AUTOCONF
+unset ACLOCAL
+unset AUTOMAKE
+unset AUTOCONF
+unset AUTOM4TE
+
+./configure
+
+$sleep
+touch Makefile.am
+$MAKE
+no_bad_missing_call
+
+rm -f Makefile.in
+$MAKE
+no_bad_missing_call
+
+$MAKE distclean
+
+# To test more comprehensive rebuild rules, we have to be able to
+# call autoconf.
+./configure AUTOCONF="$save_AUTOCONF"
+
+$sleep
+touch configure.in
+$MAKE
+no_bad_missing_call
+
+$sleep
+rm -f aclocal.m4
+$MAKE
+no_bad_missing_call
+
+:
diff --git a/tests/remake8g.test b/tests/remake8g.test
new file mode 100755
index 0000000..736b7d6
--- /dev/null
+++ b/tests/remake8g.test
@@ -0,0 +1,140 @@
+#! /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/>.
+
+# Make sure configure-time override of autoconf and autom4te are
+# consistently honoured by the automake-generated rebuild rules.
+# Also, check that such rebuild rules are not uselessly run.
+# See also the other `remake8*.test' related tests.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+# We might modify/unset this variables later, so save them.
+save_PATH=$PATH
+save_AUTOCONF=$AUTOCONF
+save_AUTOM4TE=$AUTOM4TE
+
+AUTOCONF=false; export AUTOCONF
+AUTOM4TE=false; export AUTOM4TE
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+END
+
+mkdir sub
+: > sub/Makefile.am
+
+cat >> configure.in <<'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+AUTOCONF="$save_AUTOCONF" AUTOM4TE="$save_AUTOM4TE" $ACLOCAL
+AUTOCONF="$save_AUTOCONF" AUTOM4TE="$save_AUTOM4TE" $AUTOMAKE
+AUTOM4TE="$save_AUTOM4TE" $save_AUTOCONF -Werror -Wall
+
+# Now check that aclocal and automake calls in Makefile always use
+# the configure-time autoconf and autom4te.
+
+mkdir xbin
+cat > xbin/wrap-autoconf <<END
+#! /bin/sh
+: > ac.run
+exec $save_AUTOCONF \${1+"\$@"}
+END
+cat > xbin/wrap-autom4te <<END
+#! /bin/sh
+: > am4t.run
+exec $save_AUTOM4TE \${1+"\$@"}
+END
+chmod a+x xbin/wrap-autoconf xbin/wrap-autom4te
+
+PATH=`pwd`/xbin:$PATH; export PATH
+
+./configure AUTOCONF=wrap-autoconf AUTOM4TE=wrap-autom4te
+
+# Try to remove every autotools-generated file, and to remake everything.
+
+rm -f configure aclocal.m4 Makefile.in sub/Makefile.in
+$MAKE
+test -f configure
+test -f aclocal.m4
+test -f Makefile.in
+test -f sub/Makefile.in
+# Check that our autotools wrappers have really run.
+test -f ac.run
+test -f am4t.run
+# Cleanup.
+rm -f *.run sub/*.run
+
+# Redo the same checks, but with subset of generated files.
+# Since we are at it, throw in also some tame "stress" tests.
+
+rm -f Makefile.in
+$MAKE
+test -f Makefile.in
+# Check that our autotools wrappers have really run.
+test -f ac.run
+test -f am4t.run
+# Cleanup.
+rm -f *.run sub/*.run
+
+cd sub
+$sleep
+touch Makefile.am
+$MAKE
+# Check that the expected code path in the Makefile has been triggered.
+# The *.run files must be in `..' because the rebuilt rules are always
+# run in the top srcdir.
+test -f ../am4t.run
+test -f ../ac.run
+test ! -r am4t.run
+test ! -r ac.run
+cd ..
+rm -f *.run sub/*.run
+
+# Now check that rebuild rules are not uselessly triggered.
+$sleep
+echo .PHONY: foo-Bar-QUUX >> Makefile
+$MAKE
+test ! -r ac.run
+test ! -r sub/ac.run
+test ! -r am4t.run
+test ! -r sub/am4t.run
+$FGREP foo-Bar-QUUX Makefile
+$sleep
+echo : foo-Bar-QUUX >> configure
+echo .PHONY: foo-Bar-QUUX >> Makefile.in
+$MAKE
+test ! -r ac.run
+test ! -r sub/ac.run
+test ! -r am4t.run
+test ! -r sub/am4t.run
+$FGREP foo-Bar-QUUX configure
+$FGREP foo-Bar-QUUX Makefile.in
+$FGREP foo-Bar-QUUX Makefile
+$sleep
+touch configure.in
+$MAKE
+test -f ac.run
+test -f am4t.run
+$FGREP foo-Bar-QUUX configure && Exit 1
+$FGREP foo-Bar-QUUX Makefile && Exit 1
+$FGREP foo-Bar-QUUX Makefile.in && Exit 1
+
+:
diff --git a/tests/remake8h.test b/tests/remake8h.test
new file mode 100755
index 0000000..3e83637
--- /dev/null
+++ b/tests/remake8h.test
@@ -0,0 +1,59 @@
+#! /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/>.
+
+# Automake-generated remake rules: some grepping checks.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+END
+
+mkdir sub
+: > sub/Makefile.am
+
+cat >> configure.in <<END
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+grep '^ACLOCAL *='  Makefile.in
+grep '^AUTOMAKE *=' Makefile.in
+grep '^AUTOCONF *=' Makefile.in
+grep '^AUTOM4TE *=' Makefile.in
+
+$AUTOCONF -Werror -Wall
+
+# We don't want AUTOCONF, AUTOMAKE etc. to be picked up by configure,
+# so unset them in case the've been exported in the environment.
+unset ACLOCAL
+unset AUTOMAKE
+unset AUTOCONF
+unset AUTOM4TE
+
+./configure
+
+grep "^ACLOCAL *=.*/missing --run aclocal-$APIVERSION *$" Makefile
+grep "^AUTOMAKE *=.*/missing --run automake-$APIVERSION *$" Makefile
+grep "^AUTOCONF *=.*/missing --run autoconf *$" Makefile
+grep "^AUTOM4TE *=.*/missing --run autom4te *$" Makefile
+
+:
-- 
1.7.1


reply via email to

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