[PATCH 1/2] configure: add function to directly set Makefile variables
- From
Ben Walton <bwalton@artsci.utoronto.ca>
- Date
- Oct 31, 2009, 20:41 UTC
- Message-ID
- <1257021695-21260-2-git-send-email-bwalton@artsci.utoronto.ca>
- In-Reply-To
- <1257021695-21260-1-git-send-email-bwalton@artsci.utoronto.ca>
Add function GIT_WITH_MAKE_VAR to provide an easy way to allow user input to directly specify values for variables in the Makefile.
An example use is: GIT_WITH_MAKE_VAR(gitconfig, ETC_GITCONFIG)
This would allow the user to add --with-gitconfig=/etc/mysiteconf to their ./configure command line to add ETC_GITCONFIG=/etc/mysiteconf to the config.mak.autogen file.
Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca> --- configure.ac | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac index 84b6cf4..2829dbb 100644 --- a/configure.ac +++ b/configure.ac @@ -68,6 +68,20 @@ else \ GIT_CONF_APPEND_LINE(${PACKAGE}DIR=$withval); \ fi \ ])# GIT_PARSE_WITH +dnl +dnl GIT_WITH_MAKE_VAR(withname, VAR) +dnl --------------------- +dnl Set VAR to the value specied by --with-$withname if --with-$withname +dnl is specified. This is a direct way to allow setting variables in the +dnl Makefile. +AC_DEFUN([GIT_WITH_MAKE_VAR], +[AC_ARG_WITH([$1], + [AS_HELP_STRING([--with-$1=VALUE], + [provide value for $2])], + if test -n "$withval"; then \ + AC_MSG_NOTICE([Setting $2 to $withval]); \ + GIT_CONF_APPEND_LINE($2=$withval); \ + fi)])# GIT_WITH_MAKE_VAR dnl dnl GIT_CHECK_FUNC(FUNCTION, IFTRUE, IFFALSE)
-- 1.6.5