From 390f4da8af9cf0fc44fa03588e5b3901094697e4 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Thu, 19 Jul 2012 09:49:56 +0200 Subject: autoconf: GIT_CONF_APPEND_LINE: change signature Change one-argument GIT_CONF_APPEND_LINE([VAR=VAL]) to GIT_CONF_APPEND_LINE([VAR], [VAL]), that is more similar to the usual AC_SUBST macro; this is only a preparatory change in view of future refactorings. No semantic change is intended. In fact, the generated configure file doesn't change at all. Signed-off-by: Stefano Lattarini Signed-off-by: Junio C Hamano --- configure.ac | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 4e9012f49b..5f63269f0d 100644 --- a/configure.ac +++ b/configure.ac @@ -3,11 +3,11 @@ ## Definitions of private macros. -# GIT_CONF_APPEND_LINE(LINE) -# -------------------------- -# Append LINE to file ${config_append} +# GIT_CONF_APPEND_LINE(VAL, VAR) +# ------------------------------ +# Append the line "VAR=VAL" to file ${config_append} AC_DEFUN([GIT_CONF_APPEND_LINE], - [echo "$1" >> "${config_append}"]) + [echo "$1=$2" >> "${config_append}"]) # GIT_ARG_SET_PATH(PROGRAM) # ------------------------- @@ -34,8 +34,8 @@ AC_DEFUN([GIT_CONF_APPEND_PATH], if test -n "$2"; then GIT_UC_PROGRAM[]_PATH=$withval AC_MSG_NOTICE([Disabling use of ${PROGRAM}]) - GIT_CONF_APPEND_LINE(NO_${PROGRAM}=YesPlease) - GIT_CONF_APPEND_LINE(${PROGRAM}_PATH=) + GIT_CONF_APPEND_LINE([NO_${PROGRAM}], [YesPlease]) + GIT_CONF_APPEND_LINE([${PROGRAM}_PATH], []) else AC_MSG_ERROR([You cannot use git without $1]) fi @@ -45,7 +45,7 @@ AC_DEFUN([GIT_CONF_APPEND_PATH], else GIT_UC_PROGRAM[]_PATH=$withval AC_MSG_NOTICE([Setting GIT_UC_PROGRAM[]_PATH to $withval]) - GIT_CONF_APPEND_LINE(${PROGRAM}_PATH=$withval) + GIT_CONF_APPEND_LINE([${PROGRAM}_PATH], [$withval]) fi fi m4_popdef([GIT_UC_PROGRAM])]) @@ -67,7 +67,7 @@ AC_DEFUN([GIT_PARSE_WITH], NO_[]GIT_UC_PACKAGE= GIT_UC_PACKAGE[]DIR=$withval AC_MSG_NOTICE([Setting GIT_UC_PACKAGE[]DIR to $withval]) - GIT_CONF_APPEND_LINE(${PACKAGE}DIR=$withval) + GIT_CONF_APPEND_LINE([${PACKAGE}DIR], [$withval]) fi m4_popdef([GIT_UC_PACKAGE])]) @@ -87,7 +87,7 @@ AC_DEFUN([GIT_PARSE_WITH_SET_MAKE_VAR], [a value for $1 ($2). Maybe you do...?]) fi AC_MSG_NOTICE([Setting $2 to $withval]) - GIT_CONF_APPEND_LINE($2=$withval) + GIT_CONF_APPEND_LINE([$2], [$withval]) fi)])# GIT_PARSE_WITH_SET_MAKE_VAR # @@ -150,7 +150,7 @@ AC_ARG_WITH([sane-tool-path], else AC_MSG_NOTICE([Setting SANE_TOOL_PATH to '$withval']) fi - GIT_CONF_APPEND_LINE([SANE_TOOL_PATH=$withval])], + GIT_CONF_APPEND_LINE([SANE_TOOL_PATH], [$withval])], [# If the "--with-sane-tool-path" option was not given, don't touch # SANE_TOOL_PATH here, but let defaults in Makefile take care of it. # This should minimize spurious differences in the behaviour of the @@ -169,7 +169,7 @@ AC_ARG_WITH([lib], else lib=$withval AC_MSG_NOTICE([Setting lib to '$lib']) - GIT_CONF_APPEND_LINE(lib=$withval) + GIT_CONF_APPEND_LINE([lib], [$withval]) fi]) if test -z "$lib"; then @@ -205,7 +205,7 @@ AC_ARG_ENABLE([jsmin], [ JSMIN=$enableval; AC_MSG_NOTICE([Setting JSMIN to '$JSMIN' to enable JavaScript minifying]) - GIT_CONF_APPEND_LINE(JSMIN=$enableval); + GIT_CONF_APPEND_LINE([JSMIN], [$enableval]); ]) # Define option to enable CSS minification @@ -215,7 +215,7 @@ AC_ARG_ENABLE([cssmin], [ CSSMIN=$enableval; AC_MSG_NOTICE([Setting CSSMIN to '$CSSMIN' to enable CSS minifying]) - GIT_CONF_APPEND_LINE(CSSMIN=$enableval); + GIT_CONF_APPEND_LINE([CSSMIN], [$enableval]); ]) ## Site configuration (override autodetection) @@ -256,7 +256,7 @@ AS_HELP_STRING([], [ARG can be also prefix for libpcre library and hea USE_LIBPCRE=YesPlease LIBPCREDIR=$withval AC_MSG_NOTICE([Setting LIBPCREDIR to $withval]) - GIT_CONF_APPEND_LINE(LIBPCREDIR=$withval) + GIT_CONF_APPEND_LINE([LIBPCREDIR], [$withval]) fi) # # Define NO_CURL if you do not have curl installed. git-http-pull and -- cgit v1.2.3 From 610473a6f75c495e6d4f7cd618aefcfe67ce7594 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Thu, 19 Jul 2012 09:49:57 +0200 Subject: autoconf: GIT_CONF_APPEND_LINE -> GIT_CONF_SUBST The new name fits better with the macro signature, and underlines the similarities with the autoconf-provided macro AC_SUBST (which will be made even more pronounced in planned future commits). Once again, no semantic change is intended, and indeed no change to the generated configure script is expected. Signed-off-by: Stefano Lattarini Signed-off-by: Junio C Hamano --- configure.ac | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 5f63269f0d..02b9a492a1 100644 --- a/configure.ac +++ b/configure.ac @@ -3,8 +3,8 @@ ## Definitions of private macros. -# GIT_CONF_APPEND_LINE(VAL, VAR) -# ------------------------------ +# GIT_CONF_SUBST(VAL, VAR) +# ------------------------ # Append the line "VAR=VAL" to file ${config_append} AC_DEFUN([GIT_CONF_APPEND_LINE], [echo "$1=$2" >> "${config_append}"]) @@ -34,8 +34,8 @@ AC_DEFUN([GIT_CONF_APPEND_PATH], if test -n "$2"; then GIT_UC_PROGRAM[]_PATH=$withval AC_MSG_NOTICE([Disabling use of ${PROGRAM}]) - GIT_CONF_APPEND_LINE([NO_${PROGRAM}], [YesPlease]) - GIT_CONF_APPEND_LINE([${PROGRAM}_PATH], []) + GIT_CONF_SUBST([NO_${PROGRAM}], [YesPlease]) + GIT_CONF_SUBST([${PROGRAM}_PATH], []) else AC_MSG_ERROR([You cannot use git without $1]) fi @@ -45,7 +45,7 @@ AC_DEFUN([GIT_CONF_APPEND_PATH], else GIT_UC_PROGRAM[]_PATH=$withval AC_MSG_NOTICE([Setting GIT_UC_PROGRAM[]_PATH to $withval]) - GIT_CONF_APPEND_LINE([${PROGRAM}_PATH], [$withval]) + GIT_CONF_SUBST([${PROGRAM}_PATH], [$withval]) fi fi m4_popdef([GIT_UC_PROGRAM])]) @@ -67,7 +67,7 @@ AC_DEFUN([GIT_PARSE_WITH], NO_[]GIT_UC_PACKAGE= GIT_UC_PACKAGE[]DIR=$withval AC_MSG_NOTICE([Setting GIT_UC_PACKAGE[]DIR to $withval]) - GIT_CONF_APPEND_LINE([${PACKAGE}DIR], [$withval]) + GIT_CONF_SUBST([${PACKAGE}DIR], [$withval]) fi m4_popdef([GIT_UC_PACKAGE])]) @@ -87,7 +87,7 @@ AC_DEFUN([GIT_PARSE_WITH_SET_MAKE_VAR], [a value for $1 ($2). Maybe you do...?]) fi AC_MSG_NOTICE([Setting $2 to $withval]) - GIT_CONF_APPEND_LINE([$2], [$withval]) + GIT_CONF_SUBST([$2], [$withval]) fi)])# GIT_PARSE_WITH_SET_MAKE_VAR # @@ -150,7 +150,7 @@ AC_ARG_WITH([sane-tool-path], else AC_MSG_NOTICE([Setting SANE_TOOL_PATH to '$withval']) fi - GIT_CONF_APPEND_LINE([SANE_TOOL_PATH], [$withval])], + GIT_CONF_SUBST([SANE_TOOL_PATH], [$withval])], [# If the "--with-sane-tool-path" option was not given, don't touch # SANE_TOOL_PATH here, but let defaults in Makefile take care of it. # This should minimize spurious differences in the behaviour of the @@ -169,7 +169,7 @@ AC_ARG_WITH([lib], else lib=$withval AC_MSG_NOTICE([Setting lib to '$lib']) - GIT_CONF_APPEND_LINE([lib], [$withval]) + GIT_CONF_SUBST([lib], [$withval]) fi]) if test -z "$lib"; then @@ -205,7 +205,7 @@ AC_ARG_ENABLE([jsmin], [ JSMIN=$enableval; AC_MSG_NOTICE([Setting JSMIN to '$JSMIN' to enable JavaScript minifying]) - GIT_CONF_APPEND_LINE([JSMIN], [$enableval]); + GIT_CONF_SUBST([JSMIN], [$enableval]); ]) # Define option to enable CSS minification @@ -215,7 +215,7 @@ AC_ARG_ENABLE([cssmin], [ CSSMIN=$enableval; AC_MSG_NOTICE([Setting CSSMIN to '$CSSMIN' to enable CSS minifying]) - GIT_CONF_APPEND_LINE([CSSMIN], [$enableval]); + GIT_CONF_SUBST([CSSMIN], [$enableval]); ]) ## Site configuration (override autodetection) @@ -256,7 +256,7 @@ AS_HELP_STRING([], [ARG can be also prefix for libpcre library and hea USE_LIBPCRE=YesPlease LIBPCREDIR=$withval AC_MSG_NOTICE([Setting LIBPCREDIR to $withval]) - GIT_CONF_APPEND_LINE([LIBPCREDIR], [$withval]) + GIT_CONF_SUBST([LIBPCREDIR], [$withval]) fi) # # Define NO_CURL if you do not have curl installed. git-http-pull and -- cgit v1.2.3 From 7f8cf48c4dd2bc86f8c0933a27d4f21df2033910 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Thu, 19 Jul 2012 09:49:58 +0200 Subject: autoconf: remove some redundant shell indirections They are merely useless now, but would get in the way of future changes. No semantic change is intended. Signed-off-by: Stefano Lattarini Signed-off-by: Junio C Hamano --- configure.ac | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 02b9a492a1..200776f208 100644 --- a/configure.ac +++ b/configure.ac @@ -29,13 +29,12 @@ AC_DEFUN([GIT_ARG_SET_PATH], # --without-PROGRAM is used. AC_DEFUN([GIT_CONF_APPEND_PATH], [m4_pushdef([GIT_UC_PROGRAM], m4_toupper([$1]))dnl - PROGRAM=GIT_UC_PROGRAM if test "$withval" = "no"; then if test -n "$2"; then GIT_UC_PROGRAM[]_PATH=$withval - AC_MSG_NOTICE([Disabling use of ${PROGRAM}]) - GIT_CONF_SUBST([NO_${PROGRAM}], [YesPlease]) - GIT_CONF_SUBST([${PROGRAM}_PATH], []) + AC_MSG_NOTICE([Disabling use of GIT_UC_PROGRAM]) + GIT_CONF_SUBST([NO_]GIT_UC_PROGRAM, [YesPlease]) + GIT_CONF_SUBST(GIT_UC_PROGRAM[]_PATH, []) else AC_MSG_ERROR([You cannot use git without $1]) fi @@ -45,7 +44,7 @@ AC_DEFUN([GIT_CONF_APPEND_PATH], else GIT_UC_PROGRAM[]_PATH=$withval AC_MSG_NOTICE([Setting GIT_UC_PROGRAM[]_PATH to $withval]) - GIT_CONF_SUBST([${PROGRAM}_PATH], [$withval]) + GIT_CONF_SUBST(GIT_UC_PROGRAM[]_PATH, [$withval]) fi fi m4_popdef([GIT_UC_PROGRAM])]) @@ -58,7 +57,6 @@ AC_DEFUN([GIT_CONF_APPEND_PATH], # * Unset NO_PACKAGE for --with-PACKAGE without ARG AC_DEFUN([GIT_PARSE_WITH], [m4_pushdef([GIT_UC_PACKAGE], m4_toupper([$1]))dnl - PACKAGE=GIT_UC_PACKAGE if test "$withval" = "no"; then NO_[]GIT_UC_PACKAGE=YesPlease elif test "$withval" = "yes"; then @@ -67,7 +65,7 @@ AC_DEFUN([GIT_PARSE_WITH], NO_[]GIT_UC_PACKAGE= GIT_UC_PACKAGE[]DIR=$withval AC_MSG_NOTICE([Setting GIT_UC_PACKAGE[]DIR to $withval]) - GIT_CONF_SUBST([${PACKAGE}DIR], [$withval]) + GIT_CONF_SUBST(GIT_UC_PACKAGE[DIR], [$withval]) fi m4_popdef([GIT_UC_PACKAGE])]) -- cgit v1.2.3 From c8e134a236692a64b44869717abe4080d6243a39 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Thu, 19 Jul 2012 09:49:59 +0200 Subject: autoconf: remove few redundant semicolons They are merely useless now, but would get in the way of future changes. No semantic change is intended. Signed-off-by: Stefano Lattarini Signed-off-by: Junio C Hamano --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 200776f208..b453ba5eb9 100644 --- a/configure.ac +++ b/configure.ac @@ -203,7 +203,7 @@ AC_ARG_ENABLE([jsmin], [ JSMIN=$enableval; AC_MSG_NOTICE([Setting JSMIN to '$JSMIN' to enable JavaScript minifying]) - GIT_CONF_SUBST([JSMIN], [$enableval]); + GIT_CONF_SUBST([JSMIN], [$enableval]) ]) # Define option to enable CSS minification @@ -213,7 +213,7 @@ AC_ARG_ENABLE([cssmin], [ CSSMIN=$enableval; AC_MSG_NOTICE([Setting CSSMIN to '$CSSMIN' to enable CSS minifying]) - GIT_CONF_SUBST([CSSMIN], [$enableval]); + GIT_CONF_SUBST([CSSMIN], [$enableval]) ]) ## Site configuration (override autodetection) -- cgit v1.2.3 From ac5fc1c57f2a964e1b5480a25b6fd447ab18b9b9 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Thu, 19 Jul 2012 09:50:00 +0200 Subject: autoconf: use AC_CONFIG_COMMANDS instead of ad-hoc 'config.mak.append' This will allow "./config.status --recheck; ./config.status" to work correctly as a mean of reconfiguring the tree with the same configure argument used in the previous "./configure" invocation. Signed-off-by: Stefano Lattarini Signed-off-by: Junio C Hamano --- configure.ac | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index b453ba5eb9..a63fe77b82 100644 --- a/configure.ac +++ b/configure.ac @@ -5,9 +5,22 @@ # GIT_CONF_SUBST(VAL, VAR) # ------------------------ -# Append the line "VAR=VAL" to file ${config_append} -AC_DEFUN([GIT_CONF_APPEND_LINE], - [echo "$1=$2" >> "${config_append}"]) +# Cause the line "VAR=VAL" to be eventually appended to ${config_file}. +AC_DEFUN([GIT_CONF_SUBST], + [AC_REQUIRE([GIT_CONF_SUBST_INIT]) + config_appended_defs="$config_appended_defs${newline}$1=$2"]) + +# GIT_CONF_SUBST_INIT +# ------------------- +# Prepare shell variables and autoconf machine required by later calls +# to GIT_CONF_SUBST. +AC_DEFUN([GIT_CONF_SUBST_INIT], + [config_appended_defs=; newline=' +' + AC_CONFIG_COMMANDS([$config_file], + [echo "$config_appended_defs" >> "$config_file"], + [config_file=$config_file + config_appended_defs="$config_appended_defs"])]) # GIT_ARG_SET_PATH(PROGRAM) # ------------------------- @@ -133,11 +146,8 @@ AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org]) AC_CONFIG_SRCDIR([git.c]) config_file=config.mak.autogen -config_append=config.mak.append config_in=config.mak.in -echo "# ${config_append}. Generated by configure." > "${config_append}" - # Directories holding "saner" versions of common or POSIX binaries. AC_ARG_WITH([sane-tool-path], [AS_HELP_STRING( @@ -1041,9 +1051,5 @@ AC_SUBST(PTHREAD_LIBS) AC_SUBST(NO_PTHREADS) ## Output files -AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"]) +AC_CONFIG_FILES(["${config_file}":"${config_in}"]) AC_OUTPUT - - -## Cleanup -rm -f "${config_append}" -- cgit v1.2.3 From dc7ace5f776f30fe4e10d8a3fa8146ad21893544 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Thu, 19 Jul 2012 09:50:01 +0200 Subject: build: "make clean" should not remove configure-generated files Those filed hold variables, settings and information set by the configuration process run by './configure'; in Autotools-based build system that kind of stuff should only be removed by "make distclean". Having it removed by "make clean" is not only inconsistent, but causes real confusion for that part of the Git audience that is used to the Autotools semantics; for example, an autotools old-timer that has run: ./configure --prefix /opt/git in the past, without running "make distclean" afterwards, would expect a "make install" issued after a "make clean" to rebuild and install git in '/opt/git'; but with the current behaviour, the "make clean" invocation removes (among the other things) the file 'config.mak.autogen', so that the "make install" falls back to the default prefix of '$HOME', thus installing git in the user's home directory -- definitely unexpected. Signed-off-by: Stefano Lattarini Signed-off-by: Junio C Hamano --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 285c660e14..88a76a398c 100644 --- a/Makefile +++ b/Makefile @@ -2742,6 +2742,9 @@ dist-doc: distclean: clean $(RM) configure + $(RM) config.log config.status config.cache + $(RM) config.mak.autogen config.mak.append + $(RM) -r autom4te.cache profile-clean: $(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs))) @@ -2756,8 +2759,6 @@ clean: profile-clean $(RM) -r $(dep_dirs) $(RM) -r po/build/ $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h $(ETAGS_TARGET) tags cscope* - $(RM) -r autom4te.cache - $(RM) config.log config.mak.autogen config.mak.append config.status config.cache $(RM) -r $(GIT_TARNAME) .doc-tmp-dir $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz $(RM) $(htmldocs).tar.gz $(manpages).tar.gz -- cgit v1.2.3 From 8242ff470f2a34b5c0f193c4010cbf3d9b57f9bd Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Thu, 19 Jul 2012 09:50:02 +0200 Subject: build: reconfigure automatically if configure.ac changes 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 Signed-off-by: Junio C Hamano --- Makefile | 12 ++++++++++++ configure.ac | 2 ++ 2 files changed, 14 insertions(+) diff --git a/Makefile b/Makefile index 88a76a398c..f4e8fac491 100644 --- 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 diff --git a/configure.ac b/configure.ac index a63fe77b82..df7e376590 100644 --- a/configure.ac +++ b/configure.ac @@ -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( -- cgit v1.2.3