build: reconfigure automatically if configure.ac changes
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 19 Jul 2012 07:50:02 +0000 (09:50 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 19 Jul 2012 17:30:26 +0000 (10:30 -0700)
This provides a reduced but still useful sibling of the Automake's
"automatic Makefile rebuild" feature.  It's important to note that
we take care to enable the new rules only if the tree that has already
be configured with './configure', so that users relying on manual
configuration won't be negatively impacted.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
configure.ac

index 88a76a3..f4e8fac 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2158,6 +2158,18 @@ configure: configure.ac GIT-VERSION-FILE
        autoconf -o $@ $<+ && \
        $(RM) $<+
 
+ifdef AUTOCONFIGURED
+config.status: configure
+       $(QUIET_GEN)if test -f config.status; then \
+         ./config.status --recheck; \
+       else \
+         ./configure; \
+       fi
+reconfigure config.mak.autogen: config.status
+       $(QUIET_GEN)./config.status
+.PHONY: reconfigure # This is a convenience target.
+endif
+
 XDIFF_OBJS += xdiff/xdiffi.o
 XDIFF_OBJS += xdiff/xprepare.o
 XDIFF_OBJS += xdiff/xutils.o
index a63fe77..df7e376 100644 (file)
@@ -148,6 +148,8 @@ AC_CONFIG_SRCDIR([git.c])
 config_file=config.mak.autogen
 config_in=config.mak.in
 
+GIT_CONF_SUBST([AUTOCONFIGURED], [YesPlease])
+
 # Directories holding "saner" versions of common or POSIX binaries.
 AC_ARG_WITH([sane-tool-path],
   [AS_HELP_STRING(