git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] Infinite make recursion when configure.ac changes

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 21, 2013, 07:59 UTC
Message-ID
<7vbobew10y.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130221062614.GA8827@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 29 quoted lines
> Anyway, here is the patch to fix the loop.
>
> -- >8 --
> Subject: [PATCH] Makefile: avoid infinite loop on configure.ac change
>
> If you are using autoconf and change the configure.ac, the
> Makefile will notice that config.status is older than
> configure.ac, and will attempt to rebuild and re-run the
> configure script to pick up your changes. The first step in
> doing so is to run "make configure". Unfortunately, this
> tries to include config.mak.autogen, which depends on
> config.status, which depends on configure.ac; so we must
> rebuild config.status. Which leads to us running "make
> configure", and so on.
>
> It's easy to demonstrate with:
>
>   make configure
>   ./configure
>   touch configure.ac
>   make
>
> We can break this cycle by not re-invoking make to build
> "configure", and instead just putting its rules inline into
> our config.status rebuild procedure.  We can avoid a copy by
> factoring the rules into a make variable.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
Thanks.  This needs to go to both v1.8.1.x and v1.8.2.
Will apply.
Show 36 quoted lines
>  Makefile | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 3b2c92c..ee1c0b0 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1871,12 +1871,14 @@ configure: configure.ac GIT-VERSION-FILE
>  	mv $@+ $@
>  endif # NO_PYTHON
>  
> +CONFIGURE_RECIPE = $(RM) configure configure.ac+ && \
> +		   sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
> +			configure.ac >configure.ac+ && \
> +		   autoconf -o configure configure.ac+ && \
> +		   $(RM) configure.ac+
> +
>  configure: configure.ac GIT-VERSION-FILE
> -	$(QUIET_GEN)$(RM) $@ $<+ && \
> -	sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
> -	    $< > $<+ && \
> -	autoconf -o $@ $<+ && \
> -	$(RM) $<+
> +	$(QUIET_GEN)$(CONFIGURE_RECIPE)
>  
>  ifdef AUTOCONFIGURED
>  # We avoid depending on 'configure' here, because it gets rebuilt
> @@ -1885,7 +1887,7 @@ config.status: configure.ac
>  # do want to recheck when the platform/environment detection logic
>  # changes, hence this depends on configure.ac.
>  config.status: configure.ac
> -	$(QUIET_GEN)$(MAKE) configure && \
> +	$(QUIET_GEN)$(CONFIGURE_RECIPE) && \
>  	if test -f config.status; then \
>  	  ./config.status --recheck; \
>  	else \
Previous: Jeff King
Message 5 of 5 in “[BUG] Infinite make recursion when configure.ac changes”
  1. Stefano LattariniFeb 20, 2013
  2. Jeff KingFeb 21, 2013
  3. Junio C HamanoFeb 21, 2013
  4. Jeff KingFeb 21, 2013
  5. Junio C HamanoFeb 21, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.