[libvirt] [PATCH 3/2] build: automate the rerun of autogen.sh

Eric Blake eblake at redhat.com
Fri Mar 26 23:23:54 UTC 2010

Automate the reuse of autogen.sh, rather than just erroring out.

* cfg.mk (_update_required): Run autogen.sh, rather than just
warning about it.
(_autogen): New target.

> > Hmm, as long as make is smart enough to warn, and now that running
> > ./autogen.sh with no arguments is reliable at maintaining an
> > existing setup, I could even submit a followup patch to have make
> > blindly run ./autogen.sh instead of dying with the error that the
> > user has to run it.  Any interest in such a followup?
> I have a slight preference for automating it.
> The current failure+instructions do serve to tell the user that something
> unusual (and time-consuming) is about to happen, but it's easy
> to print a warning to that effect while automating the job.

This automates it.  It took me a while to figure out how to cause the
automation without losing output - the idea in GNUmakefile of using a
$(shell) to do a recursive make is not too good, because stdout is
consumed and the user can't see any progress.  But the trick of adding
a dependency on Makefile works nicely, so maybe I should rewrite
GNUmakefile upstream in gnulib to use the same trick.

To test the patch, I temporarily added a newline to bootstrap.conf,
then ran 'make' twice; autogen.sh reran only on the first run of the
two.  (Of course, reverting the temporary newline caused autogen.sh to
rerun again - you can save yourselves that hassle by saving off
.git-module-status before you test, and restoring it back when you
revert bootstrap.conf back to normal).

 cfg.mk |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index f01dbbf..9b8ee00 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -308,9 +308,14 @@ ifeq (0,$(MAKELEVEL))
       stamp="$$($(_submodule_hash) $(_curr_status) 2>/dev/null)";	\
       test "$$stamp" = "$$actual"; echo $$?)
   ifeq (1,$(_update_required))
-    $(error gnulib update required; run ./autogen.sh first)
+    $(info INFO: gnulib update required; running ./autogen.sh first)
+Makefile: _autogen

+.PHONY: _autogen
+	$(srcdir)/autogen.sh
 # Exempt @...@ uses of these symbols.
 _makefile_at_at_check_exceptions = ' && !/(SCHEMA|SYSCONF)DIR/'

More information about the libvir-list mailing list